ShutdownServlet extends HttpServlet { @Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { logger.info(SHUTDOWN_MESSAGE); writeResponse(resp); webAppStopper.stopAsync(); } ShutdownServlet(final WebAppStopper webAppStopper);   }
@Test public void testDoGetShouldLogShutdownMessage() throws ServletException, IOException { underTest.doGet(req, resp); verify(logger).info(SHUTDOWN_MESSAGE); }
@Test public void testDoGetShouldWriteResponse() throws ServletException, IOException { underTest.doGet(req, resp); verify(printWriter).write(SHUTDOWN_MESSAGE); verify(printWriter).flush(); verify(printWriter).close(); }
@Test public void testDoGetShouldStopWebApp() throws ServletException, IOException { underTest.doGet(req, resp); verify(webAppStopper).stopAsync(); }