@Test public void lookupShouldReturnNullWhenPlaceHasNoSplashScreen() throws Exception { SplashScreenActivity splashScreenActivity = activityManager.getSplashScreenInterceptor(kansas); assertNull(splashScreenActivity); }
@Test public void lookupShouldReturnNullWhenPlaceHasNoSplashScreen() throws Exception { SplashScreenActivity splashScreenActivity = activityManager.getSplashScreenInterceptor(kansas); assertNull(splashScreenActivity); }
/** * At the time this test was made, splash screens were handled as special cases because they're ApplicationScoped rather than Dependent. */ @Test public void shouldNotStartDisabledSplashScreens() throws Exception { List<SplashScreenActivity> splashScreenList = new ArrayList<SplashScreenActivity>(); SplashScreenActivity expectedSplashScreenActivity = makeSplashScreenThatIntercepts(kansas, false); splashScreenList.add(expectedSplashScreenActivity); when(activityBeansCache.getSplashScreens()).thenReturn(splashScreenList); SplashScreenActivity splashScreenActivity = activityManager.getSplashScreenInterceptor(kansas); assertNull(splashScreenActivity); }
/** * At the time this test was made, splash screens were handled as special cases because they're ApplicationScoped rather than Dependent. */ @Test public void shouldNotStartDisabledSplashScreens() throws Exception { List<SplashScreenActivity> splashScreenList = new ArrayList<SplashScreenActivity>(); SplashScreenActivity expectedSplashScreenActivity = makeSplashScreenThatIntercepts(kansas, false); splashScreenList.add(expectedSplashScreenActivity); when(activityBeansCache.getSplashScreens()).thenReturn(splashScreenList); SplashScreenActivity splashScreenActivity = activityManager.getSplashScreenInterceptor(kansas); assertNull(splashScreenActivity); }
/** * 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 shouldStartSplashScreens() throws Exception { PlaceRequest oz = new DefaultPlaceRequest("oz"); List<SplashScreenActivity> splashScreenList = new ArrayList<SplashScreenActivity>(); SplashScreenActivity expectedSplashScreenActivity = makeEnabledSplashScreenThatIntercepts(kansas); SplashScreenActivity nonExpectedSplashScreenActivity = makeEnabledSplashScreenThatIntercepts(oz); splashScreenList.add(expectedSplashScreenActivity); when(activityBeansCache.getSplashScreens()).thenReturn(splashScreenList); SplashScreenActivity splashScreenActivity = activityManager.getSplashScreenInterceptor(kansas); assertSame(expectedSplashScreenActivity, splashScreenActivity); verify(splashScreenActivity, times(1)).onStartup(kansas); verify(nonExpectedSplashScreenActivity, never()).onStartup(any(PlaceRequest.class)); }
@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); }
/** * At the time this test was made, splash screens were handled as special cases because they're ApplicationScoped rather than Dependent. */ @Test public void shouldStartSplashScreens() throws Exception { PlaceRequest oz = new DefaultPlaceRequest("oz"); List<SplashScreenActivity> splashScreenList = new ArrayList<SplashScreenActivity>(); SplashScreenActivity expectedSplashScreenActivity = makeEnabledSplashScreenThatIntercepts(kansas); SplashScreenActivity nonExpectedSplashScreenActivity = makeEnabledSplashScreenThatIntercepts(oz); splashScreenList.add(expectedSplashScreenActivity); when(activityBeansCache.getSplashScreens()).thenReturn(splashScreenList); SplashScreenActivity splashScreenActivity = activityManager.getSplashScreenInterceptor(kansas); assertSame(expectedSplashScreenActivity, splashScreenActivity); verify(splashScreenActivity, times(1)).onStartup(kansas); verify(nonExpectedSplashScreenActivity, never()).onStartup(any(PlaceRequest.class)); }
/** * 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); }
/** * At the time this test was made, splash screens were handled as special cases because they're ApplicationScoped rather than Dependent. */ @Test public void shouldThrowExceptionWhenDoubleDestroyingSplashScreen() 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); try { activityManager.destroyActivity(splashScreenActivity); fail("should have thrown exception on double destroy"); } catch (IllegalStateException e) { // expected } verify(expectedSplashScreenActivity, times(1)).onShutdown(); // 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 shouldThrowExceptionWhenDoubleDestroyingSplashScreen() 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); try { activityManager.destroyActivity(splashScreenActivity); fail("should have thrown exception on double destroy"); } catch (IllegalStateException e) { // expected } verify(expectedSplashScreenActivity, times(1)).onShutdown(); // never try to destroy singleton beans! verify(iocManager, never()).destroyBean(expectedSplashScreenActivity); }