unit testing Freemarker and Spring -
i have freemarker template , want write test checks output given model input.
@test public void testprocesstemplatewithmodel() throws exception { final configuration configuration = new configuration(); configuration.setdirectoryfortemplateloading(directoryfortemplateloading); configuration.setobjectwrapper(new defaultobjectwrapper()); final template template = configuration.gettemplate("template.ftl"); final map<string, object> model = new hashmap<string, object>(); /* populate model */ template.process(model, new outputstreamwriter(system.out)); }
trouble first line in template is:
<#import "spring.ftl" spring />
so get:
error [main] freemarker.runtime - error reading imported file spring.ftl error reading imported file spring.ftl problematic instruction: ---------- ==> import "spring.ftl" spring [on line 1, column 1 in template.ftl] ----------
setting import on template seems impossible.
Comments
Post a Comment