param = new TemplateParameter("modelBody", "modelBody", ModelBody.class.getName(), null, false, false);
param.setDocumentation("The body.");
params.add(param);
TemplateMethod executeMethod = new TemplateMethod("execute", params);
TemplateClass clazz = new TemplateClass("org.apache.tiles.autotag.template.DoStuffTemplate",
"doStuff", "DoStuff", executeMethod);
clazz.setDocumentation("Documentation of the DoStuff class.");
generator.generate(file, "org.apache.tiles.autotag.freemarker.test", suite, clazz, null,
"org.apache.tiles.autotag.freemarker.test.Runtime", REQUEST_CLASS);
InputStream expected = getClass()
.getResourceAsStream(
"/org/apache/tiles/autotag/freemarker/test/DoStuffFMModel.javat");
File effectiveFile = new File(file, "/org/apache/tiles/autotag/freemarker/test/DoStuffFMModel.java");
assertTrue(effectiveFile.exists());
InputStream effective = new FileInputStream(effectiveFile);
assertTrue(IOUtils.contentEquals(effective, expected));
effective.close();
expected.close();
suite.addTemplateClass(clazz);
params = new ArrayList<TemplateParameter>();
param = new TemplateParameter("one", "one", "java.lang.Double", null, true, false);
param.setDocumentation("Parameter one.");
params.add(param);
param = new TemplateParameter("two", "two", "float", null, false, false);
param.setDocumentation("Parameter two.");
params.add(param);
param = new TemplateParameter("three", "three", "java.util.Date", null, false, false);
param.setDocumentation("Parameter three.");
params.add(param);
param = new TemplateParameter("request", "request", REQUEST_CLASS, null, false, true);
param.setDocumentation("The request.");
params.add(param);
executeMethod = new TemplateMethod("execute", params);
clazz = new TemplateClass("org.apache.tiles.autotag.template.DoStuffNoBodyTemplate",
"doStuffNoBody", "DoStuffNoBody", executeMethod);
clazz.setDocumentation("Documentation of the DoStuffNoBody class.");
suite.addTemplateClass(clazz);
generator.generate(file, "org.apache.tiles.autotag.freemarker.test", suite, clazz, null,
"org.apache.tiles.autotag.freemarker.test.Runtime", REQUEST_CLASS);