@@ -59,7 +59,7 @@ public class ReportIndicatorDaoImplTest {
59
59
private IndicatorQueryRepository indicatorQueryRepository ;
60
60
@ Mock
61
61
private CoreLibrary coreLibrary ;
62
- @ Mock
62
+
63
63
private AppProperties appProperties ;
64
64
@ Mock
65
65
private Context context ;
@@ -68,6 +68,12 @@ public class ReportIndicatorDaoImplTest {
68
68
public void setUp () {
69
69
MockitoAnnotations .initMocks (this );
70
70
reportIndicatorDao = new ReportIndicatorDaoImpl (indicatorQueryRepository , dailyIndicatorCountRepository , indicatorRepository );
71
+ ReflectionHelpers .setStaticField (CoreLibrary .class , "instance" , coreLibrary );
72
+
73
+ Mockito .when (coreLibrary .context ()).thenReturn (context );
74
+ appProperties = new AppProperties ();
75
+ appProperties .setProperty (Constants .ReportingConfig .SHOULD_ALLOW_ZERO_TALLIES , "true" );
76
+ Mockito .when (context .getAppProperties ()).thenReturn (appProperties );
71
77
}
72
78
73
79
@ Test
@@ -112,13 +118,6 @@ public void testGenerateDailyIndicatorTalliesCallsSaveTalliesEqualToNumberOfRepo
112
118
Repository repository = Mockito .mock (Repository .class );
113
119
Mockito .doReturn (database ).when (repository ).getWritableDatabase ();
114
120
115
- ReflectionHelpers .setStaticField (CoreLibrary .class , "instance" , coreLibrary );
116
-
117
- Mockito .when (coreLibrary .context ()).thenReturn (context );
118
- Mockito .when (context .getAppProperties ()).thenReturn (appProperties );
119
- Mockito .when (appProperties .hasProperty (Constants .ReportingConfig .SHOULD_ALLOW_ZERO_TALLIES )).thenReturn (true );
120
- Mockito .when (appProperties .getPropertyBoolean (Constants .ReportingConfig .SHOULD_ALLOW_ZERO_TALLIES )).thenReturn (true );
121
-
122
121
ReportingLibrary reportingLibrarySpy = Mockito .mock (ReportingLibrary .class );
123
122
ReflectionHelpers .setStaticField (ReportingLibrary .class , "instance" , reportingLibrarySpy );
124
123
@@ -157,12 +156,6 @@ public void testGenerateDailyIndicatorTalliesCallsSaveTalliesEqualToNumberOfRepo
157
156
158
157
@ Test
159
158
public void saveTalliesGeneratesTallyObject () {
160
- ReflectionHelpers .setStaticField (CoreLibrary .class , "instance" , coreLibrary );
161
-
162
- Mockito .when (coreLibrary .context ()).thenReturn (context );
163
- Mockito .when (context .getAppProperties ()).thenReturn (appProperties );
164
- Mockito .when (appProperties .hasProperty (Constants .ReportingConfig .SHOULD_ALLOW_ZERO_TALLIES )).thenReturn (true );
165
- Mockito .when (appProperties .getPropertyBoolean (Constants .ReportingConfig .SHOULD_ALLOW_ZERO_TALLIES )).thenReturn (true );
166
159
167
160
SQLiteDatabase database = Mockito .mock (SQLiteDatabase .class );
168
161
Map <String , IndicatorQuery > indicatorQueries = new HashMap <>();
0 commit comments