diff --git a/app/src/androidTestKiwix/java/org/kiwix/kiwixmobile/splash/SplashActivityTest.java b/app/src/androidTestKiwix/java/org/kiwix/kiwixmobile/splash/SplashActivityTest.java index 67af4fd39..663b5246f 100644 --- a/app/src/androidTestKiwix/java/org/kiwix/kiwixmobile/splash/SplashActivityTest.java +++ b/app/src/androidTestKiwix/java/org/kiwix/kiwixmobile/splash/SplashActivityTest.java @@ -61,12 +61,12 @@ public class SplashActivityTest { @Before public void setUp(){ + Intents.init(); context = getInstrumentation().getTargetContext(); } @Test public void testFirstRun() { - Intents.init(); activityTestRule.launchActivity(); BaristaSleepInteractions.sleep(TEST_PAUSE_MS); @@ -76,12 +76,10 @@ public class SplashActivityTest { // Verify that the value of the "intro shown" boolean inside the SharedPreferences Database is not changed until the "Get started" button is pressed SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); assertEquals(true, preferences.getBoolean(PREF_SHOW_INTRO, true)); - Intents.release(); } @Test public void testNormalRun() { - Intents.init(); SharedPreferences.Editor preferencesEditor = PreferenceManager.getDefaultSharedPreferences(context).edit(); preferencesEditor.putBoolean(PREF_SHOW_INTRO, false).apply(); @@ -90,6 +88,10 @@ public class SplashActivityTest { // Verify that the SplashActivity is followed by MainActivity intended(hasComponent(MainActivity.class.getName())); + } + + @After + public void endTest() { Intents.release(); } } \ No newline at end of file