@Test
public void testExecute() throws IOException {

    TilesContainer container = createMock(TilesContainer.class);
    Request request = createMock(Request.class);
    AttributeContext attributeContext = createMock(AttributeContext.class);
    Map<String, Object> requestScope = new HashMap<String, Object>();
    requestScope.put(TilesAccess.CURRENT_CONTAINER_ATTRIBUTE_NAME, container);
    ApplicationContext applicationContext = createMock(ApplicationContext.class);
    ModelBody modelBody = createMock(ModelBody.class);
    modelBody.evaluateWithoutWriting();
    expect(request.getApplicationContext()).andReturn(applicationContext).times(2);
    expect(request.getContext("request")).andReturn(requestScope).anyTimes();
    expect(container.startContext(request)).andReturn(attributeContext);
    expect(container.getAttributeContext(request)).andReturn(attributeContext);
    container.endContext(request);
    attributeContext.setPreparer("myPreparer");
    attributeContext.setTemplateAttribute((Attribute) notNull());
    container.renderContext(request);
    replay(container, attributeContext, request, applicationContext, modelBody);
    model.execute("myTemplate", "myTemplateType", "myTemplateExpression",
            "myRole", "myPreparer", false, request, modelBody);
    verify(container, attributeContext, request, applicationContext, modelBody);
}