use of com.github.bordertech.wcomponents.WTemplate in project wcomponents by BorderTech.
the class WTemplateRenderer_Test method testVelocityTemplate.
@Test
public void testVelocityTemplate() throws IOException, SAXException, XpathException {
WTemplate template = new WTemplate("templates/Test_Velocity.vm", TemplateRendererFactory.TemplateEngine.VELOCITY);
setupTemplate(template);
String output = toXHtml(template);
assertOutput(output);
}
use of com.github.bordertech.wcomponents.WTemplate in project wcomponents by BorderTech.
the class WTemplateRenderer_Test method testVelocityInlineTemplate.
@Test
public void testVelocityInlineTemplate() 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.VELOCITY);
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 testPlainTextTemplate.
@Test
public void testPlainTextTemplate() throws IOException, SAXException, XpathException {
WTemplate template = new WTemplate("templates/Test_Plain.txt", TemplateRendererFactory.TemplateEngine.PLAINTEXT);
setupTemplate(template);
String output = toXHtml(template);
String text = "Hello from plain text.";
Assert.assertTrue("Text not in output", output.contains(text));
}
use of com.github.bordertech.wcomponents.WTemplate in project wcomponents by BorderTech.
the class WTemplateRenderer_Test method testHandlebarsTemplate.
@Test
public void testHandlebarsTemplate() throws IOException, SAXException, XpathException {
WTemplate template = new WTemplate("templates/Test_Handlebars.hbs", TemplateRendererFactory.TemplateEngine.HANDLEBARS);
setupTemplate(template);
String output = toXHtml(template);
assertOutput(output);
}
use of com.github.bordertech.wcomponents.WTemplate in project wcomponents by BorderTech.
the class WTemplateRenderer_Test method testRendererCorrectlyConfigured.
@Test
public void testRendererCorrectlyConfigured() {
WTemplate template = new WTemplate();
Assert.assertTrue("Incorrect renderer supplied", getWebXmlRenderer(template) instanceof WTemplateRenderer);
}
Aggregations