use of org.springframework.web.servlet.view.groovy.GroovyMarkupConfig in project spring-boot by spring-projects.
the class GroovyTemplateAutoConfigurationTests method renderTemplate.
@Test
public void renderTemplate() throws Exception {
registerAndRefreshContext();
GroovyMarkupConfig config = this.context.getBean(GroovyMarkupConfig.class);
MarkupTemplateEngine engine = config.getTemplateEngine();
Writer writer = new StringWriter();
engine.createTemplate(new ClassPathResource("templates/message.tpl").getFile()).make(new HashMap<String, Object>(Collections.singletonMap("greeting", "Hello World"))).writeTo(writer);
assertThat(writer.toString()).contains("Hello World");
}
Aggregations