fix tests

This commit is contained in:
Milos Kozak 2020-01-14 11:44:28 +01:00
parent dd37ec9bb9
commit 230ef4e988
3 changed files with 11 additions and 3 deletions

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.SourceGlimpPlugin; import info.nightscout.androidaps.plugins.source.SourceGlimpPlugin;
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

@ -20,6 +20,8 @@ import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin;
import info.nightscout.androidaps.plugins.aps.openAPSMA.OpenAPSMAPlugin; import info.nightscout.androidaps.plugins.aps.openAPSMA.OpenAPSMAPlugin;
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin; import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin;
import info.nightscout.androidaps.plugins.source.SourceGlimpPlugin; import info.nightscout.androidaps.plugins.source.SourceGlimpPlugin;
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;
@ -29,7 +31,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();
@ -229,6 +231,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

@ -648,7 +648,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