@Test public void testPost() throws Exception { ServletCaller caller = new ServletCaller(); caller.setRequestUri("/stop"); caller.doPost(new BaleenManagerServlet(manager)); verify(manager).stop(); }
@Override protected void post(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String servletPath = req.getRequestURI(); if (servletPath.endsWith("stop")) { manager.stop(); } else { respondWithError(resp, HttpStatus.BAD_REQUEST_400, "Unknown request"); } }
BaleenManagerServlet extends AbstractApiServlet { @Override protected void post(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String servletPath = req.getRequestURI(); if (servletPath.endsWith("stop")) { manager.stop(); } else { respondWithError(resp, HttpStatus.BAD_REQUEST_400, "Unknown request"); } } }
BaleenManagerServlet extends AbstractApiServlet { @Override protected void post(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String servletPath = req.getRequestURI(); if (servletPath.endsWith("stop")) { manager.stop(); } else { respondWithError(resp, HttpStatus.BAD_REQUEST_400, "Unknown request"); } } BaleenManagerServlet(BaleenManager manager); }
BaleenManagerServlet extends AbstractApiServlet { @Override protected void post(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String servletPath = req.getRequestURI(); if (servletPath.endsWith("stop")) { manager.stop(); } else { respondWithError(resp, HttpStatus.BAD_REQUEST_400, "Unknown request"); } } BaleenManagerServlet(BaleenManager manager); @Override WebPermission[] getPermissions(); }
BaleenManagerServlet extends AbstractApiServlet { @Override protected void post(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String servletPath = req.getRequestURI(); if (servletPath.endsWith("stop")) { manager.stop(); } else { respondWithError(resp, HttpStatus.BAD_REQUEST_400, "Unknown request"); } } BaleenManagerServlet(BaleenManager manager); @Override WebPermission[] getPermissions();  }