Worker extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String key = request.getParameter("key"); log.info("Worker is processing " + key); }    }
@Test public void doPost_writesResponse() throws Exception { servletUnderTest.doPost(mockRequest, mockResponse); String out = stderr.toString(); assertThat(out).contains("Worker is processing " + FAKE_KEY_VALUE); }