HttpServletRequest httpServletRequest = createMock(HttpServletRequest.class);
HttpServletResponse httpServletResponse = createMock(HttpServletResponse.class);
@SuppressWarnings("unchecked")
Map<String, Object> applicationScope = createMock(Map.class);
TilesContainer container = createMock(TilesContainer.class);
AttributeContext attributeContext = createMock(AttributeContext.class);
Attribute attribute = createMock(Attribute.class);
expect(pageContext.getAttribute(
ApplicationAccess.APPLICATION_CONTEXT_ATTRIBUTE,
PageContext.APPLICATION_SCOPE)).andReturn(applicationContext);
expect(applicationContext.getApplicationScope()).andReturn(applicationScope).anyTimes();
expect(pageContext.getRequest()).andReturn(httpServletRequest);
expect(pageContext.getResponse()).andReturn(httpServletResponse);
expect(pageContext.getAttribute(TilesAccess.CURRENT_CONTAINER_ATTRIBUTE_NAME, PageContext.REQUEST_SCOPE)).andReturn(container);
expect(container.getAttributeContext(isA(JspRequest.class))).andReturn(attributeContext);
expect(attributeContext.getAttribute("name")).andReturn(attribute);
expect(container.evaluate(isA(Attribute.class), isA(JspRequest.class))).andReturn(new Integer(1));
pageContext.setAttribute("id", new Integer(1), PageContext.PAGE_SCOPE);
replay(jspBody, pageContext, parent,
applicationContext, httpServletRequest, httpServletResponse,
applicationScope, container, attributeContext, attribute);