@Test public void test() throws Exception { servlet.doGet(request, response); Assert.assertTrue(response.getMockServletOutputStream().getBytes() != null); String responseStr = new String(response.getMockServletOutputStream().getBytes()); Assert.assertTrue(responseStr.contains("Environment")); }
@Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { SearchResult searchResult = null; response.setContentType("text/json"); try{ searchResult = new Moneta().findAllTopics(); ServletUtils.writeResult(searchResult, response.getOutputStream()); } catch (Exception e) { response.setStatus(500); ServletUtils.writeError(500, e, response.getOutputStream()); } IOUtils.closeQuietly(response.getOutputStream()); }
MonetaTopicListServlet extends HttpServlet { @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { SearchResult searchResult = null; response.setContentType("text/json"); try{ searchResult = new Moneta().findAllTopics(); ServletUtils.writeResult(searchResult, response.getOutputStream()); } catch (Exception e) { response.setStatus(500); ServletUtils.writeError(500, e, response.getOutputStream()); } IOUtils.closeQuietly(response.getOutputStream()); } }
MonetaTopicListServlet extends HttpServlet { @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { SearchResult searchResult = null; response.setContentType("text/json"); try{ searchResult = new Moneta().findAllTopics(); ServletUtils.writeResult(searchResult, response.getOutputStream()); } catch (Exception e) { response.setStatus(500); ServletUtils.writeError(500, e, response.getOutputStream()); } IOUtils.closeQuietly(response.getOutputStream()); }  }
MonetaTopicListServlet extends HttpServlet { @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { SearchResult searchResult = null; response.setContentType("text/json"); try{ searchResult = new Moneta().findAllTopics(); ServletUtils.writeResult(searchResult, response.getOutputStream()); } catch (Exception e) { response.setStatus(500); ServletUtils.writeError(500, e, response.getOutputStream()); } IOUtils.closeQuietly(response.getOutputStream()); }  @Override void doGet(HttpServletRequest request, HttpServletResponse response); }
MonetaTopicListServlet extends HttpServlet { @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { SearchResult searchResult = null; response.setContentType("text/json"); try{ searchResult = new Moneta().findAllTopics(); ServletUtils.writeResult(searchResult, response.getOutputStream()); } catch (Exception e) { response.setStatus(500); ServletUtils.writeError(500, e, response.getOutputStream()); } IOUtils.closeQuietly(response.getOutputStream()); }  @Override void doGet(HttpServletRequest request, HttpServletResponse response);  }