DefinitionModel { public void execute(String name, String template, String role, @Parameter(name = "extends") String extendsParam, String preparer, Request request, ModelBody modelBody) throws IOException { Deque<Object> composeStack = ComposeStackUtil .getComposeStack(request); Definition definition = createDefinition(name, template, role, extendsParam, preparer); composeStack.push(definition); modelBody.evaluateWithoutWriting(); MutableTilesContainer container = (MutableTilesContainer) TilesAccess .getCurrentContainer(request); definition = (Definition) composeStack.pop(); registerDefinition(definition, container, composeStack, request); }  void execute(String name, String template, String role,
            @Parameter(name = "extends") String extendsParam, String preparer,
            Request request, ModelBody modelBody);  }
@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); }