* @throws IOException If something goes wrong.
* @throws TemplateException If something goes wrong.
*/
@Test
public void testExecute() throws TemplateException, IOException {
AddListAttributeModel tModel = createMock(AddListAttributeModel.class);
AddListAttributeFMModel fmModel = new AddListAttributeFMModel(tModel);
HttpServletRequest request = createMock(HttpServletRequest.class);
HttpRequestHashModel requestModel = new HttpRequestHashModel(request, objectWrapper);
expect(model.get(FreemarkerServlet.KEY_REQUEST)).andReturn(requestModel);
initEnvironment();
TemplateDirectiveBody body = createMock(TemplateDirectiveBody.class);
ArrayStack<Object> composeStack = new ArrayStack<Object>();
Map<String, Object> params = new HashMap<String, Object>();
params.put("role", objectWrapper.wrap("myRole"));
expect(request.getAttribute(FreeMarkerUtil.COMPOSE_STACK_ATTRIBUTE_NAME)).andReturn(composeStack);
tModel.start(composeStack, "myRole");
tModel.end(composeStack);
body.render(isA(NullWriter.class));
replay(request, tModel, body);
fmModel.execute(env, params, null, body);
verify(template, model, request, tModel, body);