/** * Stops the container. * <p> * May be called once, only. * <p> * {@link #start()} must be called, first. */ public final void stop() { checkState(started, "container has already been stopped"); container.onShutdown(); started = false; }
@Test public void onShutdown_ShouldShutdownAppHandler() { container.onShutdown(); verify(appHandler, times(1)).onShutdown(container); }
@Test public void stop_Running_ShouldDelegateStopToContainer() { @SuppressWarnings("unchecked") JRestlessHandlerContainer<JRestlessContainerRequest> customContainer = mock(JRestlessHandlerContainer.class); SimpleRequestHandlerImpl customHandler = new SimpleRequestHandlerImpl(); customHandler.init(customContainer); customHandler.start(); customHandler.stop(); verify(customContainer).onShutdown(); }