- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {}
@Override public void reload(ResourceConfig configuration) { LOG.info("reloading container..."); appHandler.onShutdown(this); appHandler = createNewApplicationHandler(configuration); appHandler.onReload(this); appHandler.onStartup(this); LOG.info("reloaded container"); }
@Test public void reload_ConfigGiven_ShouldReloadNewAppHandler() { ResourceConfig config = new ApplicationHandler().getConfiguration(); ApplicationHandler newAppHandler = mock(ApplicationHandler.class); doReturn(newAppHandler).when(container).createNewApplicationHandler(any()); container.reload(config); verify(newAppHandler, times(1)).onReload(container); }
@Test public void reload_ConfigGiven_ShouldStartNewAppHandler() { ResourceConfig config = new ApplicationHandler().getConfiguration(); ApplicationHandler newAppHandler = mock(ApplicationHandler.class); doReturn(newAppHandler).when(container).createNewApplicationHandler(any()); container.reload(config); verify(newAppHandler, times(1)).onStartup(container); }
@Test public void reload_ConfigGiven_ShouldCreateAppHandlerUsingConfiguration() { ResourceConfig config = new ApplicationHandler().getConfiguration(); container.reload(config); verify(container, times(1)).createNewApplicationHandler(config); }
@Test public void reload_ConfigGiven_ShouldResetAppHandler() { ResourceConfig config = new ApplicationHandler().getConfiguration(); ApplicationHandler newAppHandler = mock(ApplicationHandler.class); doReturn(newAppHandler).when(container).createNewApplicationHandler(any()); container.reload(config); assertSame(newAppHandler, container.getApplicationHandler()); }