FreemarkerAutotagRuntime implements AutotagRuntime<Request>, TemplateDirectiveModel { @Override public ModelBody createModelBody() { return new FreemarkerModelBody(env.getOut(), body); }  @SuppressWarnings("unchecked") @Override void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body); @Override Request createRequest(); @Override ModelBody createModelBody(); @Override T getParameter(String name, Class<T> type, T defaultValue);  }
@Test public void testCreateModelBody() { Template template = createMock(Template.class); TemplateHashModel rootDataModel = createMock(TemplateHashModel.class); Writer out = createMock(Writer.class); expect(template.getMacros()).andReturn(new HashMap<String, Macro>()); replay(template, rootDataModel, out); Environment env = new Environment(template, rootDataModel, out); @SuppressWarnings("unchecked") Map<String, TemplateModel> params = createMock(Map.class); TemplateDirectiveBody body = createMock(TemplateDirectiveBody.class); replay(params, body); FreemarkerAutotagRuntime runtime = new FreemarkerAutotagRuntime(); runtime.execute(env, params, new TemplateModel[0], body); ModelBody modelBody = runtime.createModelBody(); assertTrue(modelBody instanceof FreemarkerModelBody); verify(template, rootDataModel, out, params, body); }