BuildInformationServlet extends HttpServlet { @Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("application/json"); PrintWriter out = resp.getWriter(); out.write("{\"wilmaVersion\":\"" + wilmaBuildInformation + "\"}"); out.flush(); out.close(); } @Autowired  BuildInformationServlet(VersionTitleProvider versionTitleProvider);   }
@Test public final void testDoGetSetsResponseTypeAndWritesResponseUsingBuildInformation() throws ServletException, IOException { given(response.getWriter()).willReturn(printWriter); underTest.doGet(request, response); verify(response).setContentType("application/json"); verify(printWriter).write(Mockito.anyString()); }