Merge pull request #1203 from jotomo/test-fixes

(Hopefully) fix iob(AMA|SMB)shouldBeLimited tests.
This commit is contained in:
Milos Kozak 2018-07-11 17:11:18 +03:00 committed by GitHub
commit f37bec7852
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -233,13 +233,14 @@ public class ConstraintsCheckerTest {
// No limit by default
when(SP.getDouble(R.string.key_openapsma_max_iob, 1.5d)).thenReturn(1.5d);
when(SP.getString(R.string.key_age, "")).thenReturn("teenage");
OpenAPSMAPlugin.getPlugin().setPluginEnabled(PluginType.APS, true);
OpenAPSAMAPlugin.getPlugin().setPluginEnabled(PluginType.APS, true);
OpenAPSMAPlugin.getPlugin().setPluginEnabled(PluginType.APS, false);
OpenAPSSMBPlugin.getPlugin().setPluginEnabled(PluginType.APS, false);
// Apply all limits
Constraint<Double> d = constraintChecker.getMaxIOBAllowed();
Assert.assertEquals(1.5d, d.value());
Assert.assertEquals(3, d.getReasonList().size());
Assert.assertEquals(d.getReasonList().toString(),2, d.getReasonList().size());
Assert.assertEquals("Safety: Limiting IOB to 1.5 U because of max value in preferences", d.getMostLimitedReasons());
}
@ -250,11 +251,13 @@ public class ConstraintsCheckerTest {
when(SP.getDouble(R.string.key_openapssmb_max_iob, 3d)).thenReturn(3d);
when(SP.getString(R.string.key_age, "")).thenReturn("teenage");
OpenAPSSMBPlugin.getPlugin().setPluginEnabled(PluginType.APS, true);
OpenAPSAMAPlugin.getPlugin().setPluginEnabled(PluginType.APS, false);
OpenAPSMAPlugin.getPlugin().setPluginEnabled(PluginType.APS, false);
// Apply all limits
Constraint<Double> d = constraintChecker.getMaxIOBAllowed();
Assert.assertEquals(3d, d.value());
Assert.assertEquals(4, d.getReasonList().size());
Assert.assertEquals(d.getReasonList().toString(), 2, d.getReasonList().size());
Assert.assertEquals("Safety: Limiting IOB to 3.0 U because of max value in preferences", d.getMostLimitedReasons());
}