private void verifyHandlerWasFoundForPathInfo(String pathInfo, String actualMethod, String overrideMethod) throws Exception { setupRequest(pathInfo, actualMethod, overrideMethod); String method = Strings.isNullOrEmpty(overrideMethod) ? actualMethod : overrideMethod; EasyMock.expect(jsonConverter.convertToString( ImmutableMap.of("entry", TestHandler.REST_RESULTS.get(method)))) .andReturn("{ 'entry' : " + TestHandler.REST_RESULTS.get(method) + " }"); PrintWriter writerMock = EasyMock.createMock(PrintWriter.class); EasyMock.expect(res.getWriter()).andReturn(writerMock); writerMock.write(TestHandler.GET_RESPONSE); EasyMock.expectLastCall(); res.setCharacterEncoding("UTF-8"); res.setContentType(ContentTypes.OUTPUT_JSON_CONTENT_TYPE); mockControl.replay(); servlet.service(req, res); mockControl.verify(); mockControl.reset(); }
private void verifyHandlerWasFoundForPathInfo(String pathInfo, String actualMethod, String overrideMethod) throws Exception { setupRequest(pathInfo, actualMethod, overrideMethod); String method = Strings.isNullOrEmpty(overrideMethod) ? actualMethod : overrideMethod; EasyMock.expect(jsonConverter.convertToString( ImmutableMap.of("entry", TestHandler.REST_RESULTS.get(method)))) .andReturn("{ 'entry' : " + TestHandler.REST_RESULTS.get(method) + " }"); PrintWriter writerMock = EasyMock.createMock(PrintWriter.class); EasyMock.expect(res.getWriter()).andReturn(writerMock); writerMock.write(TestHandler.GET_RESPONSE); EasyMock.expectLastCall(); res.setCharacterEncoding("UTF-8"); res.setContentType(ContentTypes.OUTPUT_JSON_CONTENT_TYPE); mockControl.replay(); servlet.service(req, res); mockControl.verify(); mockControl.reset(); }
private void verifyHandlerWasFoundForPathInfo(String pathInfo, String actualMethod, String overrideMethod) throws Exception { setupRequest(pathInfo, actualMethod, overrideMethod); String method = StringUtils.isEmpty(overrideMethod) ? actualMethod : overrideMethod; EasyMock.expect(jsonConverter.convertToString( ImmutableMap.of("entry", TestHandler.REST_RESULTS.get(method)))) .andReturn("{ 'entry' : " + TestHandler.REST_RESULTS.get(method) + " }"); PrintWriter writerMock = EasyMock.createMock(PrintWriter.class); EasyMock.expect(res.getWriter()).andReturn(writerMock); writerMock.write(TestHandler.GET_RESPONSE); EasyMock.expectLastCall(); res.setCharacterEncoding("UTF-8"); res.setContentType(ContentTypes.OUTPUT_JSON_CONTENT_TYPE); mockControl.replay(); servlet.service(req, res); mockControl.verify(); mockControl.reset(); }
private void verifyHandlerWasFoundForPathInfo(String pathInfo, String actualMethod, String overrideMethod) throws Exception { setupRequest(pathInfo, actualMethod, overrideMethod); String method = Strings.isNullOrEmpty(overrideMethod) ? actualMethod : overrideMethod; EasyMock.expect(jsonConverter.convertToString( ImmutableMap.of("entry", TestHandler.REST_RESULTS.get(method)))) .andReturn("{ 'entry' : " + TestHandler.REST_RESULTS.get(method) + " }"); PrintWriter writerMock = EasyMock.createMock(PrintWriter.class); EasyMock.expect(res.getWriter()).andReturn(writerMock); writerMock.write(TestHandler.GET_RESPONSE); EasyMock.expectLastCall(); res.setCharacterEncoding("UTF-8"); res.setContentType(ContentTypes.OUTPUT_JSON_CONTENT_TYPE); mockControl.replay(); servlet.service(req, res); mockControl.verify(); mockControl.reset(); }
private void verifyHandlerWasFoundForPathInfo(String pathInfo, String actualMethod, String overrideMethod) throws Exception { setupRequest(pathInfo, actualMethod, overrideMethod); String method = StringUtils.isEmpty(overrideMethod) ? actualMethod : overrideMethod; EasyMock.expect(jsonConverter.convertToString( ImmutableMap.of("entry", TestHandler.REST_RESULTS.get(method)))) .andReturn("{ 'entry' : " + TestHandler.REST_RESULTS.get(method) + " }"); PrintWriter writerMock = EasyMock.createMock(PrintWriter.class); EasyMock.expect(res.getWriter()).andReturn(writerMock); writerMock.write(TestHandler.GET_RESPONSE); EasyMock.expectLastCall(); res.setCharacterEncoding("UTF-8"); res.setContentType(ContentTypes.OUTPUT_JSON_CONTENT_TYPE); mockControl.replay(); servlet.service(req, res); mockControl.verify(); mockControl.reset(); }
/** * Tests a data handler that returns a failed Future */ @Test public void testFailedRequest() throws Exception { String route = "/test"; setupRequest(route, "DELETE", null); // Shouldnt these be expectations res.sendError(HttpServletResponse.SC_BAD_REQUEST, TestHandler.FAILURE_MESSAGE); res.setCharacterEncoding("UTF-8"); res.setContentType(ContentTypes.OUTPUT_JSON_CONTENT_TYPE); mockControl.replay(); servlet.service(req, res); mockControl.verify(); mockControl.reset(); }
/** * Tests a data handler that returns a failed Future */ @Test public void testFailedRequest() throws Exception { String route = "/test"; setupRequest(route, "DELETE", null); // Shouldnt these be expectations res.sendError(HttpServletResponse.SC_BAD_REQUEST, TestHandler.FAILURE_MESSAGE); res.setCharacterEncoding("UTF-8"); res.setContentType(ContentTypes.OUTPUT_JSON_CONTENT_TYPE); mockControl.replay(); servlet.service(req, res); mockControl.verify(); mockControl.reset(); }
/** * Tests a data handler that returns a failed Future */ @Test public void testFailedRequest() throws Exception { String route = "/test"; setupRequest(route, "DELETE", null); // Shouldnt these be expectations res.sendError(HttpServletResponse.SC_BAD_REQUEST, TestHandler.FAILURE_MESSAGE); res.setCharacterEncoding("UTF-8"); res.setContentType(ContentTypes.OUTPUT_JSON_CONTENT_TYPE); mockControl.replay(); servlet.service(req, res); mockControl.verify(); mockControl.reset(); }
/** * Tests a data handler that returns a failed Future */ @Test public void testFailedRequest() throws Exception { String route = "/test"; setupRequest(route, "DELETE", null); // Shouldnt these be expectations res.sendError(HttpServletResponse.SC_BAD_REQUEST, TestHandler.FAILURE_MESSAGE); res.setCharacterEncoding("UTF-8"); res.setContentType(ContentTypes.OUTPUT_JSON_CONTENT_TYPE); mockControl.replay(); servlet.service(req, res); mockControl.verify(); mockControl.reset(); }
/** * Tests a data handler that returns a failed Future */ @Test public void testFailedRequest() throws Exception { String route = "/test"; setupRequest(route, "DELETE", null); // Shouldnt these be expectations res.sendError(HttpServletResponse.SC_BAD_REQUEST, TestHandler.FAILURE_MESSAGE); res.setCharacterEncoding("UTF-8"); res.setContentType(ContentTypes.OUTPUT_JSON_CONTENT_TYPE); mockControl.replay(); servlet.service(req, res); mockControl.verify(); mockControl.reset(); }
servlet.service(req, res); EasyMock.verify(res); EasyMock.reset(res);
servlet.service(req, res); EasyMock.verify(res); EasyMock.reset(res);
servlet.service(req, res); EasyMock.verify(res); EasyMock.reset(res);