@Test
public void testExecute() throws IOException {

    MutableTilesContainer container = createMock(MutableTilesContainer.class);
    Request request = createMock(Request.class);
    Deque<Object> composeStack = new ArrayDeque<Object>();
    Attribute attribute = new Attribute();
    composeStack.push(attribute);
    Map<String, Object> requestScope = new HashMap<String, Object>();
    requestScope.put(ComposeStackUtil.COMPOSE_STACK_ATTRIBUTE_NAME, composeStack);
    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);
    expect(request.getContext("request")).andReturn(requestScope).anyTimes();
    container.register((Definition) notNull(), eq(request));
    replay(container, request, modelBody, applicationContext);
    model.execute("myName", "myTemplate", "myRole", "myExtends",
            "myPreparer", request, modelBody);
    assertEquals(1, composeStack.size());
    attribute = (Attribute) composeStack.peek();
    assertEquals("definition", attribute.getRenderer());
    verify(container, request, modelBody, applicationContext);
}