MessageLoggingStatusServlet extends HttpServlet { @Override protected void doPost(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { doGet(req, resp); } @Autowired  MessageLoggingStatusServlet(MessageLoggingToggle messageLoggingToggle);   }
@Test public final void testDoPostSetsResponseTypeAndWritesResponse() throws ServletException, IOException { given(response.getWriter()).willReturn(printWriter); given(messageLoggingToggle.isRequestLoggingOn()).willReturn(false); given(messageLoggingToggle.isResponseLoggingOn()).willReturn(false); underTest.doPost(request, response); verify(response).setContentType("application/json"); verify(messageLoggingToggle).isRequestLoggingOn(); verify(messageLoggingToggle).isResponseLoggingOn(); verify(printWriter).write("{\"requestLogging\":false,\"responseLogging\":false}"); }