diff --git a/app/src/main/java/info/nightscout/utils/HardLimits.java b/app/src/main/java/info/nightscout/utils/HardLimits.java index ed58687f8f..8e1a05db0d 100644 --- a/app/src/main/java/info/nightscout/utils/HardLimits.java +++ b/app/src/main/java/info/nightscout/utils/HardLimits.java @@ -40,7 +40,7 @@ public class HardLimits { public static final double MAXISF = 720; // mgdl public static final double[] MAXIOB_AMA = {3, 5, 7, 12}; - public static final double[] MAXIOB_SMB = {3, 7, 20, 25}; + public static final double[] MAXIOB_SMB = {3, 7, 12, 25}; public static final double[] MAXBASAL = {2, 5, 10, 12}; diff --git a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.java b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.java index 9430d941c9..655cc23282 100644 --- a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.java +++ b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.java @@ -76,7 +76,7 @@ public class ConstraintsCheckerTest { @Test public void isClosedLoopAllowedTest() throws Exception { when(SP.getString("aps_mode", "open")).thenReturn("closed"); - objectivesPlugin.objectives.get(3).setStarted(new Date(0)); + objectivesPlugin.objectives.get(3).setStartedOn(null); Constraint c = constraintChecker.isClosedLoopAllowed(); Assert.assertEquals(true, c.getReasonList().size() == 2); // Safety & Objectives @@ -92,7 +92,7 @@ public class ConstraintsCheckerTest { @Test public void isAutosensModeEnabledTest() throws Exception { - objectivesPlugin.objectives.get(5).setStarted(new Date(0)); + objectivesPlugin.objectives.get(5).setStartedOn(null); when(SP.getBoolean(R.string.key_openapsama_useautosens, false)).thenReturn(false); Constraint c = constraintChecker.isAutosensModeEnabled(); @@ -103,7 +103,7 @@ public class ConstraintsCheckerTest { @Test public void isAMAModeEnabledTest() throws Exception { - objectivesPlugin.objectives.get(6).setStarted(new Date(0)); + objectivesPlugin.objectives.get(6).setStartedOn(null); Constraint c = constraintChecker.isAMAModeEnabled(); Assert.assertEquals(true, c.getReasonList().size() == 1); // Objectives @@ -123,7 +123,7 @@ public class ConstraintsCheckerTest { @Test public void isSMBModeEnabledTest() throws Exception { - objectivesPlugin.objectives.get(7).setStarted(new Date(0)); + objectivesPlugin.objectives.get(7).setStartedOn(null); when(SP.getBoolean(R.string.key_use_smb, false)).thenReturn(false); when(MainApp.getConstraintChecker().isClosedLoopAllowed()).thenReturn(new Constraint<>(true)); diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesFragmentTest.java b/app/src/test/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesFragmentTest.java deleted file mode 100644 index ca47477905..0000000000 --- a/app/src/test/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesFragmentTest.java +++ /dev/null @@ -1,56 +0,0 @@ -package info.nightscout.androidaps.plugins.ConstraintsObjectives; - -import org.junit.Test; -import static org.junit.Assert.assertEquals; - -public class ObjectivesFragmentTest { - - @Test - public void testModifyVisibility() { - - ObjectivesFragment fragment = new ObjectivesFragment(); - - int currentPosition = 1; - long prevObjectiveAccomplishedTime = 0; - long objectiveStartedTime = 0; - int durationInDays = 0; - long objectiveAccomplishedTime = 0; - boolean requirementsMet = false; - boolean enableFakeValue = false; - - // previous objective is not accomplished yet - assertEquals(0, fragment.modifyVisibility(currentPosition, prevObjectiveAccomplishedTime, - objectiveStartedTime, durationInDays, objectiveAccomplishedTime, requirementsMet, enableFakeValue)); - - // not started yet - prevObjectiveAccomplishedTime = 4711; - assertEquals(1, fragment.modifyVisibility(currentPosition, prevObjectiveAccomplishedTime, - objectiveStartedTime, durationInDays, objectiveAccomplishedTime, requirementsMet, enableFakeValue)); - - // started - // time calculation is true, requirements met is false - objectiveStartedTime = Long.MAX_VALUE; - durationInDays = 0; - assertEquals(2, fragment.modifyVisibility(currentPosition, prevObjectiveAccomplishedTime, - objectiveStartedTime, durationInDays, objectiveAccomplishedTime, requirementsMet, enableFakeValue)); - - // started - // time calculation is true, requirements met is true - objectiveStartedTime = 10; - durationInDays = 0; - requirementsMet = true; - assertEquals(3, fragment.modifyVisibility(currentPosition, prevObjectiveAccomplishedTime, - objectiveStartedTime, durationInDays, objectiveAccomplishedTime, requirementsMet, enableFakeValue)); - - // finished - objectiveStartedTime = Long.MAX_VALUE; - durationInDays = 0; - requirementsMet = true; - objectiveAccomplishedTime = Long.MAX_VALUE; - assertEquals(4, fragment.modifyVisibility(currentPosition, prevObjectiveAccomplishedTime, - objectiveStartedTime, durationInDays, objectiveAccomplishedTime, requirementsMet, enableFakeValue)); - - - } - -} \ No newline at end of file diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesPluginTest.java b/app/src/test/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesPluginTest.java index 1cd42ba0b9..d3dbcb3402 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesPluginTest.java +++ b/app/src/test/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesPluginTest.java @@ -27,19 +27,19 @@ public class ObjectivesPluginTest { ObjectivesPlugin objectivesPlugin; @Test - public void notStartedObjectivesShouldLimitLoopInvokation() throws Exception { - objectivesPlugin.objectives.get(0).setStarted(new Date(0)); + public void notStartedObjectivesShouldLimitLoopInvocation() throws Exception { + objectivesPlugin.objectives.get(0).setStartedOn(null); Constraint c = new Constraint<>(true); c = objectivesPlugin.isLoopInvocationAllowed(c); Assert.assertEquals("Objectives: Objective 1 not started", c.getReasons()); Assert.assertEquals(Boolean.FALSE, c.value()); - objectivesPlugin.objectives.get(0).setStarted(new Date()); + objectivesPlugin.objectives.get(0).setStartedOn(new Date()); } @Test public void notStartedObjective4ShouldLimitClosedLoop() throws Exception { - objectivesPlugin.objectives.get(3).setStarted(new Date(0)); + objectivesPlugin.objectives.get(3).setStartedOn(null); Constraint c = new Constraint<>(true); c = objectivesPlugin.isClosedLoopAllowed(c); @@ -49,7 +49,7 @@ public class ObjectivesPluginTest { @Test public void notStartedObjective6ShouldLimitAutosensMode() throws Exception { - objectivesPlugin.objectives.get(5).setStarted(new Date(0)); + objectivesPlugin.objectives.get(5).setStartedOn(null); Constraint c = new Constraint<>(true); c = objectivesPlugin.isAutosensModeEnabled(c); @@ -59,7 +59,7 @@ public class ObjectivesPluginTest { @Test public void notStartedObjective7ShouldLimitAMAMode() throws Exception { - objectivesPlugin.objectives.get(6).setStarted(new Date(0)); + objectivesPlugin.objectives.get(6).setStartedOn(null); Constraint c = new Constraint<>(true); c = objectivesPlugin.isAMAModeEnabled(c); @@ -69,7 +69,7 @@ public class ObjectivesPluginTest { @Test public void notStartedObjective8ShouldLimitSMBMode() throws Exception { - objectivesPlugin.objectives.get(7).setStarted(new Date(0)); + objectivesPlugin.objectives.get(7).setStartedOn(null); Constraint c = new Constraint<>(true); c = objectivesPlugin.isSMBModeEnabled(c);