diff --git a/opensrp-core/build.gradle b/opensrp-core/build.gradle index 26d085c12..44c3d13b7 100644 --- a/opensrp-core/build.gradle +++ b/opensrp-core/build.gradle @@ -87,7 +87,7 @@ android { targetSdkVersion androidTargetSdkVersion versionCode Integer.parseInt(project.VERSION_CODE) versionName project.VERSION_NAME - testInstrumentationRunner "android.test.InstrumentationTestRunner" + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' buildConfigField "long", "BUILD_TIMESTAMP", System.currentTimeMillis() + "L" buildConfigField "int", "DB_ENCRYPTION_VERSION", '1' buildConfigField("int", "VERSION_CODE", "${defaultConfig.versionCode}") diff --git a/opensrp-core/src/test/java/org/smartregister/location/helper/LocationHelperTest.java b/opensrp-core/src/test/java/org/smartregister/location/helper/LocationHelperTest.java index 243dcbdad..6b8feb7a0 100644 --- a/opensrp-core/src/test/java/org/smartregister/location/helper/LocationHelperTest.java +++ b/opensrp-core/src/test/java/org/smartregister/location/helper/LocationHelperTest.java @@ -232,6 +232,7 @@ public void testGenerateDefaultLocationHierarchyWithRegisteredANMNotSetReturnsNu LocationHelper spyLocationHelper = Mockito.spy(locationHelper); AllSharedPreferences spiedAllSharedPreferences = Mockito.spy((AllSharedPreferences) ReflectionHelpers.getField(spyLocationHelper, "allSharedPreferences")); ReflectionHelpers.setField(spyLocationHelper, "allSharedPreferences", spiedAllSharedPreferences); + Mockito.doReturn("demo").when(spiedAllSharedPreferences).fetchRegisteredANM(); ANMLocationController anmLocationController = Mockito.spy(CoreLibrary.getInstance().context().anmLocationController()); ReflectionHelpers.setField(CoreLibrary.getInstance().context(), "anmLocationController", anmLocationController); @@ -242,7 +243,7 @@ public void testGenerateDefaultLocationHierarchyWithRegisteredANMNotSetReturnsNu List allowedLevels = Arrays.asList("District", "Village"); List result = spyLocationHelper.generateDefaultLocationHierarchy(allowedLevels); - Mockito.verify(spiedAllSharedPreferences).fetchDefaultLocalityId(Mockito.eq("")); + Mockito.verify(spiedAllSharedPreferences).fetchDefaultLocalityId(Mockito.eq("demo")); Mockito.verify(spyLocationHelper).getDefaultLocationHierarchy(Mockito.isNull(), Mockito.any(), Mockito.anyList(), Mockito.eq(allowedLevels), Mockito.eq(false)); assertNull(result); }