@Test public void doGetShouldWriteJsonMessage() throws ServletException, IOException { given(resp.getWriter()).willReturn(printWriter); ProxyServer.setResponseVolatile(true); underTest.doGet(req, resp); verify(resp).setContentType("application/json"); verify(printWriter).write("{\"responseVolatility\":true}"); }
@Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("application/json"); PrintWriter out = resp.getWriter(); boolean responseVolatility = ProxyServer.getResponseVolatile(); out.write("{\"responseVolatility\":" + responseVolatility + "}"); out.flush(); out.close(); }
ResponseMessageVolatilityStatusServlet extends HttpServlet { @Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("application/json"); PrintWriter out = resp.getWriter(); boolean responseVolatility = ProxyServer.getResponseVolatile(); out.write("{\"responseVolatility\":" + responseVolatility + "}"); out.flush(); out.close(); } }
ResponseMessageVolatilityStatusServlet extends HttpServlet { @Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("application/json"); PrintWriter out = resp.getWriter(); boolean responseVolatility = ProxyServer.getResponseVolatile(); out.write("{\"responseVolatility\":" + responseVolatility + "}"); out.flush(); out.close(); }  }
ResponseMessageVolatilityStatusServlet extends HttpServlet { @Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("application/json"); PrintWriter out = resp.getWriter(); boolean responseVolatility = ProxyServer.getResponseVolatile(); out.write("{\"responseVolatility\":" + responseVolatility + "}"); out.flush(); out.close(); }   }
ResponseMessageVolatilityStatusServlet extends HttpServlet { @Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("application/json"); PrintWriter out = resp.getWriter(); boolean responseVolatility = ProxyServer.getResponseVolatile(); out.write("{\"responseVolatility\":" + responseVolatility + "}"); out.flush(); out.close(); }    }