fix tests
This commit is contained in:
parent
15ebfc1193
commit
ad7ec4daca
2 changed files with 10 additions and 6 deletions
|
@ -30,13 +30,13 @@ public class ConstraintTest {
|
|||
|
||||
Constraint<Double> d = new Constraint<>(10d);
|
||||
d.set(5d, "Set 5d");
|
||||
Assert.assertEquals(5d, b.value());
|
||||
Assert.assertEquals("Set 5d", b.getReasons());
|
||||
Assert.assertEquals(5d, d.value());
|
||||
Assert.assertEquals("Set 5d", d.getReasons());
|
||||
d.setIfSmaller(6d, "Set 6d");
|
||||
Assert.assertEquals(5d, b.value());
|
||||
Assert.assertEquals("Set 5d", b.getReasons());
|
||||
Assert.assertEquals(5d, d.value());
|
||||
Assert.assertEquals("Set 5d\nSet 6d", d.getReasons());
|
||||
d.setIfSmaller(4d, "Set 4d");
|
||||
Assert.assertEquals(4d, b.value());
|
||||
Assert.assertEquals("Set 5d\nSet 4d", b.getReasons());
|
||||
Assert.assertEquals(4d, d.value());
|
||||
Assert.assertEquals("Set 5d\nSet 6d\nSet 4d", d.getReasons());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,12 +20,14 @@ import info.nightscout.androidaps.MainApp;
|
|||
import info.nightscout.androidaps.data.ConstraintChecker;
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.interfaces.Constraint;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.PumpMDI.MDIPlugin;
|
||||
import info.nightscout.androidaps.queue.commands.Command;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
|
@ -125,6 +127,8 @@ public class CommandQueueTest extends CommandQueue {
|
|||
when(MainApp.instance()).thenReturn(mainApp);
|
||||
when(MainApp.getConstraintChecker().applyBolusConstraints(insulin)).thenReturn(insulin);
|
||||
when(MainApp.getConstraintChecker().applyCarbsConstraints(carbs)).thenReturn(carbs);
|
||||
Constraint<Double> rateConstraint = new Constraint<>(0d);
|
||||
when(MainApp.getConstraintChecker().applyBasalConstraints(any(), any())).thenReturn(rateConstraint);
|
||||
|
||||
PowerMockito.mockStatic(ToastUtils.class);
|
||||
Context context = mock(Context.class);
|
||||
|
|
Loading…
Reference in a new issue