JspAutotagRuntime extends SimpleTagSupport implements AutotagRuntime<Request> { @Override public Request createRequest() { JspContext pageContext = getJspContext(); return JspRequest.createServletJspRequest(org.apache.tiles.request.jsp.JspUtil.getApplicationContext(pageContext), (PageContext) pageContext); }  @Override void doTag(); @Override Request createRequest(); @Override ModelBody createModelBody(); @Override T getParameter(String name, Class<T> type, T defaultValue);  }
@Test public void testCreateRequest() { JspFragment jspBody = createMock(JspFragment.class); PageContext pageContext = createMock(PageContext.class); JspTag parent = createMock(JspTag.class); ApplicationContext applicationContext = createMock(ApplicationContext.class); HttpServletRequest httpServletRequest = createMock(HttpServletRequest.class); HttpServletResponse httpServletResponse = createMock(HttpServletResponse.class); expect(pageContext.getAttribute( ApplicationAccess.APPLICATION_CONTEXT_ATTRIBUTE, PageContext.APPLICATION_SCOPE)).andReturn(applicationContext); expect(pageContext.getRequest()).andReturn(httpServletRequest); expect(pageContext.getResponse()).andReturn(httpServletResponse); replay(jspBody, pageContext, parent, applicationContext, httpServletRequest, httpServletResponse); JspAutotagRuntime runtime = new JspAutotagRuntime(); runtime.setJspBody(jspBody); runtime.setJspContext(pageContext); runtime.setParent(parent); runtime.doTag(); Request jspRequest = runtime.createRequest(); assertTrue(jspRequest instanceof JspRequest); verify(jspBody, pageContext, parent, applicationContext, httpServletRequest, httpServletResponse); }