/** * At the time this test was made, splash screens were handled as special cases because they're ApplicationScoped rather than Dependent. */ @Test public void shouldStopSplashScreensWhenDestroyed() throws Exception { List<SplashScreenActivity> splashScreenList = new ArrayList<SplashScreenActivity>(); SplashScreenActivity expectedSplashScreenActivity = makeEnabledSplashScreenThatIntercepts(kansas); splashScreenList.add(expectedSplashScreenActivity); when(activityBeansCache.getSplashScreens()).thenReturn(splashScreenList); SplashScreenActivity splashScreenActivity = activityManager.getSplashScreenInterceptor(kansas); activityManager.destroyActivity(splashScreenActivity); verify(expectedSplashScreenActivity, times(1)).onShutdown(); assertFalse(activityManager.isStarted(expectedSplashScreenActivity)); // never try to destroy singleton beans! verify(iocManager, never()).destroyBean(expectedSplashScreenActivity); }
/** * At the time this test was made, splash screens were handled as special cases because they're ApplicationScoped rather than Dependent. */ @Test public void shouldStopSplashScreensWhenDestroyed() throws Exception { List<SplashScreenActivity> splashScreenList = new ArrayList<SplashScreenActivity>(); SplashScreenActivity expectedSplashScreenActivity = makeEnabledSplashScreenThatIntercepts(kansas); splashScreenList.add(expectedSplashScreenActivity); when(activityBeansCache.getSplashScreens()).thenReturn(splashScreenList); SplashScreenActivity splashScreenActivity = activityManager.getSplashScreenInterceptor(kansas); activityManager.destroyActivity(splashScreenActivity); verify(expectedSplashScreenActivity, times(1)).onShutdown(); assertFalse(activityManager.isStarted(expectedSplashScreenActivity)); // never try to destroy singleton beans! verify(iocManager, never()).destroyBean(expectedSplashScreenActivity); }
@Test public void shouldNotGetConfusedAboutSplashScreensWithSamePlaceAsTheirScreen() throws Exception { List<SplashScreenActivity> splashScreenList = new ArrayList<SplashScreenActivity>(); SplashScreenActivity expectedSplashScreenActivity = makeEnabledSplashScreenThatIntercepts(kansas); when(expectedSplashScreenActivity.getPlace()).thenReturn(kansas); splashScreenList.add(expectedSplashScreenActivity); when(activityBeansCache.getSplashScreens()).thenReturn(splashScreenList); // this loads the regular kansas activity (not the splash screen) into the activityBeansCache activityManager.getActivity(kansas); SplashScreenActivity splashScreenActivity = activityManager.getSplashScreenInterceptor(kansas); // this must not get confused even though expectedSplashScreenActivity and kansasActivity both have the same PlaceRequest activityManager.destroyActivity(splashScreenActivity); verify(expectedSplashScreenActivity, times(1)).onShutdown(); assertFalse(activityManager.isStarted(expectedSplashScreenActivity)); // never try to destroy singleton beans! verify(iocManager, never()).destroyBean(expectedSplashScreenActivity); }
@Test public void shouldNotGetConfusedAboutSplashScreensWithSamePlaceAsTheirScreen() throws Exception { List<SplashScreenActivity> splashScreenList = new ArrayList<SplashScreenActivity>(); SplashScreenActivity expectedSplashScreenActivity = makeEnabledSplashScreenThatIntercepts(kansas); when(expectedSplashScreenActivity.getPlace()).thenReturn(kansas); splashScreenList.add(expectedSplashScreenActivity); when(activityBeansCache.getSplashScreens()).thenReturn(splashScreenList); // this loads the regular kansas activity (not the splash screen) into the activityBeansCache activityManager.getActivity(kansas); SplashScreenActivity splashScreenActivity = activityManager.getSplashScreenInterceptor(kansas); // this must not get confused even though expectedSplashScreenActivity and kansasActivity both have the same PlaceRequest activityManager.destroyActivity(splashScreenActivity); verify(expectedSplashScreenActivity, times(1)).onShutdown(); assertFalse(activityManager.isStarted(expectedSplashScreenActivity)); // never try to destroy singleton beans! verify(iocManager, never()).destroyBean(expectedSplashScreenActivity); }