@Test
public void testDoInclude() throws IOException, ServletException {

    String path = "this way";
    ServletRequest enclosedRequest = createMock(ServletRequest.class);
    HttpServletRequest servletRequest = createMock(HttpServletRequest.class);
    HttpServletResponse response = createMock(HttpServletResponse.class);
    RequestDispatcher dispatcher = createMock(RequestDispatcher.class);
    expect(servletRequest.getRequestDispatcher("this way")).andReturn(dispatcher);
    dispatcher.include(eq(servletRequest), isA(ExternalWriterHttpServletResponse.class));
    replay(servletRequest, response, dispatcher);
    expect(enclosedRequest.getRequest()).andReturn(servletRequest);
    expect(enclosedRequest.getResponse()).andReturn(response);
    expect(enclosedRequest.getAvailableScopes()).andReturn(Collections.singletonList("parent"));
    replay(velocityContext, enclosedRequest);
    context = new VelocityRequest(enclosedRequest, velocityContext, writer);
    context.doInclude(path);
    verify(velocityContext, enclosedRequest, servletRequest, response, dispatcher);
}