Merge remote-tracking branch 'milosremote/newconstraints' into newconstraints2

This commit is contained in:
AdrianLxM 2018-03-19 18:49:26 +01:00
commit f4cebd8a7c

View file

@ -16,6 +16,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.data.ConstraintChecker;
import info.nightscout.androidaps.data.DetailedBolusInfo; import info.nightscout.androidaps.data.DetailedBolusInfo;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.PumpInterface;
@ -105,8 +106,7 @@ public class CommandQueueTest extends CommandQueue {
private void prepareMock(Double insulin, Integer carbs) throws Exception { private void prepareMock(Double insulin, Integer carbs) throws Exception {
ConfigBuilderPlugin configBuilderPlugin = mock(ConfigBuilderPlugin.class); ConfigBuilderPlugin configBuilderPlugin = mock(ConfigBuilderPlugin.class);
when(configBuilderPlugin.applyBolusConstraints(insulin)).thenReturn(insulin); ConstraintChecker constraintChecker = mock(ConstraintChecker.class);
when(configBuilderPlugin.applyCarbsConstraints(carbs)).thenReturn(carbs);
PowerMockito.mockStatic(ConfigBuilderPlugin.class); PowerMockito.mockStatic(ConfigBuilderPlugin.class);
PumpInterface pump = MDIPlugin.getPlugin(); PumpInterface pump = MDIPlugin.getPlugin();
@ -115,8 +115,11 @@ public class CommandQueueTest extends CommandQueue {
PowerMockito.mockStatic(MainApp.class); PowerMockito.mockStatic(MainApp.class);
MainApp mainApp = mock(MainApp.class); MainApp mainApp = mock(MainApp.class);
when(MainApp.getConfigBuilder()).thenReturn(configBuilderPlugin); when(MainApp.getConfigBuilder()).thenReturn(configBuilderPlugin);
when(MainApp.getConstraintChecker()).thenReturn(constraintChecker);
when(MainApp.isEngineeringModeOrRelease()).thenReturn(true); when(MainApp.isEngineeringModeOrRelease()).thenReturn(true);
when(MainApp.instance()).thenReturn(mainApp); when(MainApp.instance()).thenReturn(mainApp);
when(MainApp.getConstraintChecker().applyBolusConstraints(insulin)).thenReturn(insulin);
when(MainApp.getConstraintChecker().applyCarbsConstraints(carbs)).thenReturn(carbs);
PowerMockito.mockStatic(ToastUtils.class); PowerMockito.mockStatic(ToastUtils.class);
Context context = mock(Context.class); Context context = mock(Context.class);