@Test public void testDoGetShouldWriteJsonMessage() throws ServletException, IOException { given(resp.getWriter()).willReturn(printWriter); given(sequenceInformationCollector.collectInformation()).willReturn(new HashMap<String, Object>()); underTest.doGet(req, resp); verify(resp).setContentType("application/json"); verify(printWriter).write("{}"); 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(); Map<String, Object> information = sequenceInformationCollector.collectInformation(); out.write(getJson(information)); out.flush(); out.close(); }
SequenceInformationServlet extends HttpServlet { @Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("application/json"); PrintWriter out = resp.getWriter(); Map<String, Object> information = sequenceInformationCollector.collectInformation(); out.write(getJson(information)); out.flush(); out.close(); } }
SequenceInformationServlet extends HttpServlet { @Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("application/json"); PrintWriter out = resp.getWriter(); Map<String, Object> information = sequenceInformationCollector.collectInformation(); out.write(getJson(information)); out.flush(); out.close(); } @Autowired  SequenceInformationServlet(SequenceInformationCollector sequenceInformationCollector); }
SequenceInformationServlet extends HttpServlet { @Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("application/json"); PrintWriter out = resp.getWriter(); Map<String, Object> information = sequenceInformationCollector.collectInformation(); out.write(getJson(information)); out.flush(); out.close(); } @Autowired  SequenceInformationServlet(SequenceInformationCollector sequenceInformationCollector);  }
SequenceInformationServlet extends HttpServlet { @Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("application/json"); PrintWriter out = resp.getWriter(); Map<String, Object> information = sequenceInformationCollector.collectInformation(); out.write(getJson(information)); out.flush(); out.close(); } @Autowired  SequenceInformationServlet(SequenceInformationCollector sequenceInformationCollector);   }