fix tests

This commit is contained in:
Milos Kozak 2019-03-08 22:26:26 +01:00
parent 967009b8d1
commit 0e95808c27
2 changed files with 1 additions and 3 deletions

View file

@ -104,7 +104,6 @@ public class AAPSMocker {
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_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() {

View file

@ -43,13 +43,11 @@ public class StorageConstraintPluginTest extends StorageConstraintPlugin{
when(StorageConstraintPlugin.getAvailableInternalMemorySize()).thenReturn(150L);
Constraint<Boolean> c = new Constraint<>(true);
c = storageConstraintPlugin.isClosedLoopAllowed(c);
Assert.assertEquals(true, c.getReasons().contains(MainApp.gs(R.string.diskfull)));
Assert.assertEquals(Boolean.FALSE, c.value());
// Set free space over 200(Mb) to enable loop
when(StorageConstraintPlugin.getAvailableInternalMemorySize()).thenReturn(300L);
Constraint<Boolean> c2 = new Constraint<>(true);
c2 = storageConstraintPlugin.isClosedLoopAllowed(c2);
Assert.assertEquals(false, c2.getReasons().contains(MainApp.gs(R.string.diskfull)));
Assert.assertEquals(Boolean.TRUE, c2.value());
}
@ -74,6 +72,7 @@ public class StorageConstraintPluginTest extends StorageConstraintPlugin{
public void prepareMock() {
AAPSMocker.mockMainApp();
AAPSMocker.mockStrings();
AAPSMocker.mockBus();
mockedFile = mock(File.class);
mockedStatFs = mock(StatFs.class);
storageConstraintPlugin = StorageConstraintPlugin.getPlugin();