InsertTemplateModel { public void execute(@Parameter(required = true) String template, String templateType, String templateExpression, String role, String preparer, boolean flush, Request request, ModelBody modelBody) throws IOException { TilesContainer container = TilesAccess.getCurrentContainer(request); container.startContext(request); modelBody.evaluateWithoutWriting(); container = TilesAccess.getCurrentContainer(request); renderTemplate(container, template, templateType, templateExpression, role, preparer, flush, request); }  void execute(@Parameter(required = true) String template,
            String templateType, String templateExpression, String role,
            String preparer, boolean flush, Request request, ModelBody modelBody);  }
@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); }