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