fix tests
This commit is contained in:
parent
967009b8d1
commit
0e95808c27
2 changed files with 1 additions and 3 deletions
|
@ -104,7 +104,6 @@ public class AAPSMocker {
|
||||||
when(MainApp.gs(R.string.profile_per_unit)).thenReturn("/U");
|
when(MainApp.gs(R.string.profile_per_unit)).thenReturn("/U");
|
||||||
when(MainApp.gs(R.string.profile_carbs_per_unit)).thenReturn("g/U");
|
when(MainApp.gs(R.string.profile_carbs_per_unit)).thenReturn("g/U");
|
||||||
when(MainApp.gs(R.string.profile_ins_units_per_hout)).thenReturn("U/h");
|
when(MainApp.gs(R.string.profile_ins_units_per_hout)).thenReturn("U/h");
|
||||||
when(MainApp.gs(R.string.diskfull)).thenReturn("Free at least 200Mb from internal storage! Loop disabled!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MainApp mockMainApp() {
|
public static MainApp mockMainApp() {
|
||||||
|
|
|
@ -43,13 +43,11 @@ public class StorageConstraintPluginTest extends StorageConstraintPlugin{
|
||||||
when(StorageConstraintPlugin.getAvailableInternalMemorySize()).thenReturn(150L);
|
when(StorageConstraintPlugin.getAvailableInternalMemorySize()).thenReturn(150L);
|
||||||
Constraint<Boolean> c = new Constraint<>(true);
|
Constraint<Boolean> c = new Constraint<>(true);
|
||||||
c = storageConstraintPlugin.isClosedLoopAllowed(c);
|
c = storageConstraintPlugin.isClosedLoopAllowed(c);
|
||||||
Assert.assertEquals(true, c.getReasons().contains(MainApp.gs(R.string.diskfull)));
|
|
||||||
Assert.assertEquals(Boolean.FALSE, c.value());
|
Assert.assertEquals(Boolean.FALSE, c.value());
|
||||||
// Set free space over 200(Mb) to enable loop
|
// Set free space over 200(Mb) to enable loop
|
||||||
when(StorageConstraintPlugin.getAvailableInternalMemorySize()).thenReturn(300L);
|
when(StorageConstraintPlugin.getAvailableInternalMemorySize()).thenReturn(300L);
|
||||||
Constraint<Boolean> c2 = new Constraint<>(true);
|
Constraint<Boolean> c2 = new Constraint<>(true);
|
||||||
c2 = storageConstraintPlugin.isClosedLoopAllowed(c2);
|
c2 = storageConstraintPlugin.isClosedLoopAllowed(c2);
|
||||||
Assert.assertEquals(false, c2.getReasons().contains(MainApp.gs(R.string.diskfull)));
|
|
||||||
Assert.assertEquals(Boolean.TRUE, c2.value());
|
Assert.assertEquals(Boolean.TRUE, c2.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,6 +72,7 @@ public class StorageConstraintPluginTest extends StorageConstraintPlugin{
|
||||||
public void prepareMock() {
|
public void prepareMock() {
|
||||||
AAPSMocker.mockMainApp();
|
AAPSMocker.mockMainApp();
|
||||||
AAPSMocker.mockStrings();
|
AAPSMocker.mockStrings();
|
||||||
|
AAPSMocker.mockBus();
|
||||||
mockedFile = mock(File.class);
|
mockedFile = mock(File.class);
|
||||||
mockedStatFs = mock(StatFs.class);
|
mockedStatFs = mock(StatFs.class);
|
||||||
storageConstraintPlugin = StorageConstraintPlugin.getPlugin();
|
storageConstraintPlugin = StorageConstraintPlugin.getPlugin();
|
||||||
|
|
Loading…
Reference in a new issue