fix tests
This commit is contained in:
parent
6f5332af0a
commit
1ede3df627
3 changed files with 8 additions and 4 deletions
|
@ -155,15 +155,18 @@ public class AAPSMocker {
|
|||
when(ConfigBuilderPlugin.getCommandQueue()).thenReturn(queue);
|
||||
}
|
||||
|
||||
public static TreatmentsPlugin mockTreatmentPlugin() throws Exception {
|
||||
TreatmentService treatmentService = PowerMockito.mock(TreatmentService.class);
|
||||
public static TreatmentsPlugin mockTreatmentPlugin() {
|
||||
PowerMockito.mockStatic(TreatmentsPlugin.class);
|
||||
TreatmentsPlugin treatmentsPlugin = PowerMockito.mock(TreatmentsPlugin.class);
|
||||
PowerMockito.whenNew(TreatmentService.class).withNoArguments().thenReturn(treatmentService);
|
||||
when(TreatmentsPlugin.getPlugin()).thenReturn(treatmentsPlugin);
|
||||
return treatmentsPlugin;
|
||||
}
|
||||
|
||||
public static void mockTreatmentService() throws Exception {
|
||||
TreatmentService treatmentService = PowerMockito.mock(TreatmentService.class);
|
||||
PowerMockito.whenNew(TreatmentService.class).withNoArguments().thenReturn(treatmentService);
|
||||
}
|
||||
|
||||
public static Profile getValidProfile() {
|
||||
try {
|
||||
if (profile == null)
|
||||
|
|
|
@ -67,7 +67,7 @@ public class NewNSTreatmentDialogTest {
|
|||
AAPSMocker.mockApplicationContext();
|
||||
AAPSMocker.mockStrings();
|
||||
PowerMockito.mockStatic(NSUpload.class);
|
||||
AAPSMocker.mockTreatmentPlugin();
|
||||
AAPSMocker.mockTreatmentService();
|
||||
AAPSMocker.mockBus();
|
||||
AAPSMocker.mockDatabaseHelper();
|
||||
|
||||
|
|
|
@ -157,6 +157,7 @@ public class APSREsultTest {
|
|||
AAPSMocker.mockStrings();
|
||||
AAPSMocker.mockBus();
|
||||
AAPSMocker.mockProfileFunctions();
|
||||
AAPSMocker.mockTreatmentService();
|
||||
treatmentsPlugin = AAPSMocker.mockTreatmentPlugin();
|
||||
ConstraintChecker constraintChecker = AAPSMocker.mockConstraintsChecker();
|
||||
|
||||
|
|
Loading…
Reference in a new issue