public void testExecutePage() throws IOException {
HttpServletRequest request = createMock(HttpServletRequest.class);
HttpServletResponse response = createMock(HttpServletResponse.class);
Context velocityContext = createMock(Context.class);
TilesContainer container = createMock(TilesContainer.class);
InternalContextAdapter internalContextAdapter = createMock(InternalContextAdapter.class);
Writer writer = new StringWriter();
Map<String, Object> params = createParams();
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put("one", "value1");
attributes.put("two", "value2");
expect(request.getAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME)).andReturn(container);
expect(tModel.getImportedAttributes(container, "myName", "myToName", false,
velocityContext, request, response)).andReturn(attributes);
expect(internalContextAdapter.put("one", "value1")).andReturn("value1");
expect(internalContextAdapter.put("two", "value2")).andReturn("value2");
replay(tModel, servletContext, request, response, velocityContext, container, internalContextAdapter);
initializeModel();
Renderable renderable = model.execute(request, response, velocityContext, params);
renderable.render(internalContextAdapter, writer);