RequestsServlet extends HttpServlet { @Override public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType("text/plain"); resp.getWriter().println("Hello, world"); }  @Override void doGet(HttpServletRequest req, HttpServletResponse resp);  }
@Test public void doGet_writesResponse() throws Exception { servletUnderTest.doGet(mockRequest, mockResponse); assertWithMessage("RequestsServlet response") .that(responseWriter.toString()) .contains("Hello, world"); }