@Test public void testDoGetShouldCallWriteErrorToResponseBecauseOfWrongParameterFormat() throws ServletException, IOException { given(request.getParameter(PARAMETER_CONSTANS_DIRECTION)).willReturn("dawdaw"); given(response.getWriter()).willReturn(writer); underTest.doGet(request, response); verify(response).setStatus(HttpServletResponse.SC_NOT_FOUND); verify(response).getWriter(); }
@Override protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { String groupName = request.getParameter("groupname"); String tempDir = request.getParameter("direction"); try { int direction = Integer.parseInt(tempDir); stubConfigurationOrderService.doChange(direction, groupName, request); } catch (ClassNotFoundException|NumberFormatException e) { logger.debug(ERROR_MSG, e); writeErrorToResponse(response); } }
StubConfigurationOrderServlet extends HttpServlet { @Override protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { String groupName = request.getParameter("groupname"); String tempDir = request.getParameter("direction"); try { int direction = Integer.parseInt(tempDir); stubConfigurationOrderService.doChange(direction, groupName, request); } catch (ClassNotFoundException|NumberFormatException e) { logger.debug(ERROR_MSG, e); writeErrorToResponse(response); } } }
StubConfigurationOrderServlet extends HttpServlet { @Override protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { String groupName = request.getParameter("groupname"); String tempDir = request.getParameter("direction"); try { int direction = Integer.parseInt(tempDir); stubConfigurationOrderService.doChange(direction, groupName, request); } catch (ClassNotFoundException|NumberFormatException e) { logger.debug(ERROR_MSG, e); writeErrorToResponse(response); } } @Autowired  StubConfigurationOrderServlet(StubConfigurationOrderService stubConfigurationOrderService); }
StubConfigurationOrderServlet extends HttpServlet { @Override protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { String groupName = request.getParameter("groupname"); String tempDir = request.getParameter("direction"); try { int direction = Integer.parseInt(tempDir); stubConfigurationOrderService.doChange(direction, groupName, request); } catch (ClassNotFoundException|NumberFormatException e) { logger.debug(ERROR_MSG, e); writeErrorToResponse(response); } } @Autowired  StubConfigurationOrderServlet(StubConfigurationOrderService stubConfigurationOrderService);  }
StubConfigurationOrderServlet extends HttpServlet { @Override protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { String groupName = request.getParameter("groupname"); String tempDir = request.getParameter("direction"); try { int direction = Integer.parseInt(tempDir); stubConfigurationOrderService.doChange(direction, groupName, request); } catch (ClassNotFoundException|NumberFormatException e) { logger.debug(ERROR_MSG, e); writeErrorToResponse(response); } } @Autowired  StubConfigurationOrderServlet(StubConfigurationOrderService stubConfigurationOrderService);   }