@Test public final void testDoGetShouldCallJsonBuilderAndWriteResponse() throws IOException, ServletException { given(properties.getMaintainerProperties()).willReturn(maintainerProperties); given(response.getWriter()).willReturn(printWriter); given(maintainerPropertiesJsonBuilder.buildMaintainerPropertiesJson(maintainerProperties)).willReturn("json"); underTest.doGet(request, response); verify(response).setContentType("application/json"); verify(printWriter).write("json"); verify(printWriter).flush(); verify(printWriter).close(); }
@Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { resp.setContentType(APPLICATION_JSON); PrintWriter out = resp.getWriter(); PropertyDTO properties = webAppConfigurationAccess.getProperties(); MaintainerProperties maintainerProperties = properties.getMaintainerProperties(); out.write(maintainerPropertiesJsonBuilder.buildMaintainerPropertiesJson(maintainerProperties)); out.flush(); out.close(); }
MaintainerPropertiesServlet extends HttpServlet { @Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { resp.setContentType(APPLICATION_JSON); PrintWriter out = resp.getWriter(); PropertyDTO properties = webAppConfigurationAccess.getProperties(); MaintainerProperties maintainerProperties = properties.getMaintainerProperties(); out.write(maintainerPropertiesJsonBuilder.buildMaintainerPropertiesJson(maintainerProperties)); out.flush(); out.close(); } }
MaintainerPropertiesServlet extends HttpServlet { @Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { resp.setContentType(APPLICATION_JSON); PrintWriter out = resp.getWriter(); PropertyDTO properties = webAppConfigurationAccess.getProperties(); MaintainerProperties maintainerProperties = properties.getMaintainerProperties(); out.write(maintainerPropertiesJsonBuilder.buildMaintainerPropertiesJson(maintainerProperties)); out.flush(); out.close(); } @Autowired  MaintainerPropertiesServlet(MaintainerPropertiesJsonBuilder maintainerPropertiesJsonBuilder, WebAppConfigurationAccess webAppConfigurationAccess); }
MaintainerPropertiesServlet extends HttpServlet { @Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { resp.setContentType(APPLICATION_JSON); PrintWriter out = resp.getWriter(); PropertyDTO properties = webAppConfigurationAccess.getProperties(); MaintainerProperties maintainerProperties = properties.getMaintainerProperties(); out.write(maintainerPropertiesJsonBuilder.buildMaintainerPropertiesJson(maintainerProperties)); out.flush(); out.close(); } @Autowired  MaintainerPropertiesServlet(MaintainerPropertiesJsonBuilder maintainerPropertiesJsonBuilder, WebAppConfigurationAccess webAppConfigurationAccess);  }
MaintainerPropertiesServlet extends HttpServlet { @Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { resp.setContentType(APPLICATION_JSON); PrintWriter out = resp.getWriter(); PropertyDTO properties = webAppConfigurationAccess.getProperties(); MaintainerProperties maintainerProperties = properties.getMaintainerProperties(); out.write(maintainerPropertiesJsonBuilder.buildMaintainerPropertiesJson(maintainerProperties)); out.flush(); out.close(); } @Autowired  MaintainerPropertiesServlet(MaintainerPropertiesJsonBuilder maintainerPropertiesJsonBuilder, WebAppConfigurationAccess webAppConfigurationAccess);   }