DefaultPageResult implements PageResult { public void include() { try { String to = resolver.pathFor(requestInfo.getResourceMethod()); logger.debug("including {}", to); request.getRequestDispatcher(to).include(request, response); } catch (ServletException e) { throw new ResultException(e); } catch (IOException e) { throw new ResultException(e); } } @Inject  DefaultPageResult(MutableRequest req, MutableResponse res, MethodInfo requestInfo,
			PathResolver resolver, Proxifier proxifier); void defaultView(); void include(); void redirectTo(String url); void forwardTo(String url); T of(final Class<T> controllerType); void redirect(String url); void forward(String url); void forward();  }
@Test public void shouldAllowCustomPathResolverWhileIncluding() throws ServletException, IOException { when(request.getRequestDispatcher("fixed")).thenReturn(dispatcher); view.include(); verify(dispatcher, only()).include(request, response); }
@Test(expected = ResultException.class) public void shouldThrowResultExceptionIfServletExceptionOccursWhileIncluding() throws Exception { when(request.getRequestDispatcher(anyString())).thenReturn(dispatcher); doThrow(new ServletException()).when(dispatcher).include(request, response); view.include(); }
@Test(expected = ResultException.class) public void shouldThrowResultExceptionIfIOExceptionOccursWhileIncluding() throws Exception { when(request.getRequestDispatcher(anyString())).thenReturn(dispatcher); doThrow(new IOException()).when(dispatcher).include(request, response); view.include(); }