use of org.beetl.core.Template in project beetl2.0 by javamonkey.
the class JsonTest method testData.
@Test
public void testData() throws Exception {
Template t = gt.getTemplate("/exp/json/data_template.html");
String str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/exp/json/data_expected.html"), str);
t = gt.getTemplate("/exp/json/data_template.html");
str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/exp/json/data_expected.html"), str);
}
use of org.beetl.core.Template in project beetl2.0 by javamonkey.
the class FormatterTest method testCore.
@Test
public void testCore() throws Exception {
gt.registerFormat("date.short", new ShortDateFormatter());
Map map = new HashMap();
map.put("a", 1.12);
Template t = gt.getTemplate("/formatter/formatter_template.html");
t.binding(map);
String str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/formatter/formatter_expected.html"), str);
t = gt.getTemplate("/formatter/formatter_template.html");
t.binding(map);
str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/formatter/formatter_expected.html"), str);
}
use of org.beetl.core.Template in project beetl2.0 by javamonkey.
the class FileFunctionTest method testFunctionDilimter.
@Test
public void testFunctionDilimter() throws Exception {
// 测试html 方法和注解允许使用特殊符号
Template t = newGt.getTemplate("/function/dilimter_template.html");
String str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/function/dilimter_expected.html"), str);
t = newGt.getTemplate("/function/dilimter_template.html");
str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/function/dilimter_expected.html"), str);
}
use of org.beetl.core.Template in project beetl2.0 by javamonkey.
the class FunctionTest method testSafeOutput.
public void testSafeOutput() throws Exception {
gt.registerFunction("nullFunction", new NullFunction());
Template t = gt.getTemplate("/function/null_template.html");
String str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/function/null_expected.html"), str);
t = gt.getTemplate("/function/null_template.html");
str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/function/null_expected.html"), str);
}
use of org.beetl.core.Template in project beetl2.0 by javamonkey.
the class FunctionTest method testToolKit.
public void testToolKit() throws Exception {
gt.registerFunction("str2Json", new Str2Json());
Template t = gt.getTemplate("/function/tojson_template.html");
String str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/function/tojson_expected.html"), str);
t = gt.getTemplate("/function/tojson_template.html");
str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/function/tojson_expected.html"), str);
}
Aggregations