ShutdownServlet extends HttpServlet { @Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { writeResponse(resp); logger.info(urlAccessLogMessageAssembler.assembleMessage(req, SHUTDOWN_MESSAGE)); wilmaService.stop(); } @Autowired  ShutdownServlet(WilmaService wilmaService, UrlAccessLogMessageAssembler urlAccessLogMessageAssembler);   }
@Test public void testDoGetShouldStopService() throws ServletException, IOException { underTest.doGet(req, resp); verify(wilmaService).stop(); }
@Test public void testDoGetShouldLogMessage() throws ServletException, IOException { given(urlAccessLogMessageAssembler.assembleMessage(req, SHUTDOWN_MESSAGE)).willReturn("logmessage"); underTest.doGet(req, resp); verify(logger).info("logmessage"); }
@Test public void testDoGetShouldWriteResponse() throws ServletException, IOException { underTest.doGet(req, resp); verify(printWriter).write(SHUTDOWN_MESSAGE); }