use of com.github.bordertech.wcomponents.WTemplate in project wcomponents by BorderTech.
the class WTemplateRenderer_Test method testVelocityInvalidTemplate.
@Test(expected = SystemException.class)
public void testVelocityInvalidTemplate() {
WTemplate template = new WTemplate("notexist.vm", TemplateRendererFactory.TemplateEngine.VELOCITY);
toXHtml(template);
}
use of com.github.bordertech.wcomponents.WTemplate in project wcomponents by BorderTech.
the class WTemplateRenderer_Test method testHandlebarsInlineTemplate.
@Test
public void testHandlebarsInlineTemplate() throws IOException, SAXException, XpathException {
StringBuffer inline = new StringBuffer();
inline.append("id={{wc.id}}");
inline.append("param={{mytest}}");
inline.append("firstName={{wc.bean.firstName}}");
inline.append("lastName={{wc.bean.lastName}}");
inline.append("child={{child1}}");
inline.append("not1=[{{notexist}}]");
inline.append("not2=[{{wc.notexist}}]");
WTemplate template = new WTemplate();
setupTemplate(template);
template.setEngineName(TemplateRendererFactory.TemplateEngine.HANDLEBARS);
template.setInlineTemplate(inline.toString());
String output = toXHtml(template);
assertOutput(output);
}
use of com.github.bordertech.wcomponents.WTemplate in project wcomponents by BorderTech.
the class WTemplateRenderer_Test method testHandlebarsInvalidTemplate.
@Test(expected = SystemException.class)
public void testHandlebarsInvalidTemplate() {
WTemplate template = new WTemplate("notexist.hbs", TemplateRendererFactory.TemplateEngine.HANDLEBARS);
toXHtml(template);
}
use of com.github.bordertech.wcomponents.WTemplate in project wcomponents by BorderTech.
the class WTemplateRenderer_Test method testPlainTextInvalidTemplate.
@Test(expected = SystemException.class)
public void testPlainTextInvalidTemplate() {
WTemplate template = new WTemplate("notexist.txt", TemplateRendererFactory.TemplateEngine.PLAINTEXT);
toXHtml(template);
}
use of com.github.bordertech.wcomponents.WTemplate in project wcomponents by BorderTech.
the class WTemplateRenderer_Test method testPlainTextInlineTemplate.
@Test
public void testPlainTextInlineTemplate() throws IOException, SAXException, XpathException {
String inline = "Hello from plain text.";
WTemplate template = new WTemplate();
setupTemplate(template);
template.setEngineName(TemplateRendererFactory.TemplateEngine.PLAINTEXT);
template.setInlineTemplate(inline);
String output = toXHtml(template);
Assert.assertTrue("Text not in output", output.contains(inline));
}
Aggregations