Assert.assertEquals("", q);
}
public void testFile() {
final Map<String,String> fileContent = new HashMap<String,String>();
TemplatesFacade env = new TestTemplatesFacade(new DefaultNavigationFactory(), new ClassTemplateLoader(getClass().getClassLoader(), TEMPLATES_LOCATION, TEMPLATES_CHARSET)) {
@Override
public void createFile(String name, String contents) {
fileContent.put(name, contents);
}
};
EvaluationContext context = new EvaluationContext(new String[] { "aa", "bb" });
// test 1
String q = env.executeTemplate("file.file1", context, null, null);
Assert.assertEquals("", q);
Assert.assertEquals("Next\n", fileContent.get("aaaa.txt"));
Assert.assertEquals(1, fileContent.size());
fileContent.clear();
// test 2
q = env.executeTemplate("file.file2", context, null, null);
Assert.assertEquals("", q);
Assert.assertEquals(2, fileContent.size());
Assert.assertEquals("Next\n", fileContent.get("aa.txt"));
Assert.assertEquals("Next2\n", fileContent.get("bb.txt"));
}