Merge branch 'dev' into dagger3

This commit is contained in:
Milos Kozak 2020-01-14 13:50:29 +01:00
commit 344c77ef53
4 changed files with 13 additions and 5 deletions

View file

@ -83,8 +83,8 @@ public class SafetyPlugin extends PluginBase implements ConstraintsInterface {
} }
value.set(false, resourceHelper.gs(R.string.closed_loop_disabled_on_dev_branch), this); value.set(false, resourceHelper.gs(R.string.closed_loop_disabled_on_dev_branch), this);
} }
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
if (TreatmentsPlugin.getPlugin().isInHistoryExtendedBoluslInProgress()) { if (pump != null && !pump.isFakingTempsByExtendedBoluses() && TreatmentsPlugin.getPlugin().isInHistoryExtendedBoluslInProgress()) {
value.set(false, MainApp.gs(R.string.closed_loop_disabled_with_eb), this); value.set(false, MainApp.gs(R.string.closed_loop_disabled_with_eb), this);
} }
return value; return value;

View file

@ -30,6 +30,8 @@ import info.nightscout.androidaps.plugins.pump.danaRS.DanaRSPlugin;
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin; import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin;
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin; import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin;
import info.nightscout.androidaps.plugins.source.GlimpPlugin; import info.nightscout.androidaps.plugins.source.GlimpPlugin;
import info.nightscout.androidaps.plugins.treatments.TreatmentService;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.FabricPrivacy; import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.SP; import info.nightscout.androidaps.utils.SP;
@ -39,7 +41,7 @@ import static org.mockito.Mockito.when;
* Created by mike on 18.03.2018. * Created by mike on 18.03.2018.
*/ */
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest({MainApp.class, ConfigBuilderPlugin.class, FabricPrivacy.class, SP.class, Context.class, OpenAPSMAPlugin.class, OpenAPSAMAPlugin.class, OpenAPSSMBPlugin.class}) @PrepareForTest({MainApp.class, ConfigBuilderPlugin.class, FabricPrivacy.class, SP.class, Context.class, OpenAPSMAPlugin.class, OpenAPSAMAPlugin.class, OpenAPSSMBPlugin.class, TreatmentsPlugin.class, TreatmentService.class})
public class ConstraintsCheckerTest { public class ConstraintsCheckerTest {
VirtualPumpPlugin pump = new VirtualPumpPlugin(); VirtualPumpPlugin pump = new VirtualPumpPlugin();
@ -278,6 +280,8 @@ public class ConstraintsCheckerTest {
AAPSMocker.mockStrings(); AAPSMocker.mockStrings();
AAPSMocker.mockSP(); AAPSMocker.mockSP();
AAPSMocker.mockCommandQueue(); AAPSMocker.mockCommandQueue();
AAPSMocker.mockTreatmentService();
AAPSMocker.mockTreatmentPlugin();
when(mainApp.getPackageName()).thenReturn("info.nightscout.androidaps"); when(mainApp.getPackageName()).thenReturn("info.nightscout.androidaps");

View file

@ -21,6 +21,8 @@ import info.nightscout.androidaps.plugins.aps.openAPSMA.OpenAPSMAPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker; import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker;
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin; import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin;
import info.nightscout.androidaps.plugins.source.GlimpPlugin; import info.nightscout.androidaps.plugins.source.GlimpPlugin;
import info.nightscout.androidaps.plugins.treatments.TreatmentService;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.SP; import info.nightscout.androidaps.utils.SP;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@ -30,7 +32,7 @@ import static org.mockito.Mockito.when;
*/ */
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest({MainApp.class, ConfigBuilderPlugin.class, SP.class, Context.class}) @PrepareForTest({MainApp.class, ConfigBuilderPlugin.class, SP.class, Context.class, TreatmentsPlugin.class, TreatmentService.class})
public class SafetyPluginTest { public class SafetyPluginTest {
private VirtualPumpPlugin pump = new VirtualPumpPlugin(); private VirtualPumpPlugin pump = new VirtualPumpPlugin();
@ -230,6 +232,8 @@ public class SafetyPluginTest {
AAPSMocker.mockConstraintsChecker(); AAPSMocker.mockConstraintsChecker();
AAPSMocker.mockSP(); AAPSMocker.mockSP();
AAPSMocker.mockStrings(); AAPSMocker.mockStrings();
AAPSMocker.mockTreatmentService();
AAPSMocker.mockTreatmentPlugin();
when(ConfigBuilderPlugin.getPlugin().getActivePump()).thenReturn(pump); when(ConfigBuilderPlugin.getPlugin().getActivePump()).thenReturn(pump);

View file

@ -652,7 +652,7 @@ public class SmsCommunicatorPluginTest {
passCode = smsCommunicatorPlugin.getMessageToConfirm().getConfirmCode(); passCode = smsCommunicatorPlugin.getMessageToConfirm().getConfirmCode();
smsCommunicatorPlugin.processSms(new Sms("1234", passCode)); smsCommunicatorPlugin.processSms(new Sms("1234", passCode));
Assert.assertEquals(passCode, smsCommunicatorPlugin.getMessages().get(2).getText()); Assert.assertEquals(passCode, smsCommunicatorPlugin.getMessages().get(2).getText());
Assert.assertEquals("Extended bolus 1.00U for 20 min started successfully\nVirtual Pump", smsCommunicatorPlugin.getMessages().get(3).getText()); Assert.assertEquals("Extended bolus 1.00U for 20 min started successfully\nnull\nVirtual Pump", smsCommunicatorPlugin.getMessages().get(3).getText());
} }
@Test @Test