use of org.beetl.core.Template in project beetl2.0 by javamonkey.
the class FunctionTest method testCore.
@Test
public void testCore() throws Exception {
Map map = new HashMap();
map.put("a", "hi");
map.put("b", 1);
Template t = gt.getTemplate("/function/function_template.html");
t.binding(map);
String str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/function/function_expected.html"), str);
t = gt.getTemplate("/function/function_template.html");
t.binding(map);
str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/function/function_expected.html"), str);
}
use of org.beetl.core.Template in project beetl2.0 by javamonkey.
the class FunctionTest method testPackage.
public void testPackage() throws Exception {
gt.registerFunctionPackage("test", new SampleFunctionPackage());
Template t = gt.getTemplate("/function/function_package_template.html");
String str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/function/function_package_expected.html"), str);
t = gt.getTemplate("/function/function_package_template.html");
str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/function/function_package_expected.html"), str);
}
use of org.beetl.core.Template in project beetl2.0 by javamonkey.
the class FunctionTest method testMutilContext.
public void testMutilContext() throws Exception {
gt.registerFunctionPackage("test", new SampleFunctionPackage());
Template t = gt.getTemplate("/function/context_template.html");
String str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/function/context_expected.html"), str);
t = gt.getTemplate("/function/context_template.html");
str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/function/context_expected.html"), str);
}
use of org.beetl.core.Template in project beetl2.0 by javamonkey.
the class GoTest method testContinue.
@Test
public void testContinue() throws Exception {
Template t = gt.getTemplate("/control/go/continue_template.html");
this.bind(t, "dataList", data);
String str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/control/go/continue_expected.html"), str);
t = gt.getTemplate("/control/go/continue_template.html");
this.bind(t, "dataList", data);
str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/control/go/continue_expected.html"), str);
}
use of org.beetl.core.Template in project beetl2.0 by javamonkey.
the class GoTest method testBreak3.
@Test
public void testBreak3() throws Exception {
Template t = gt.getTemplate("/control/go/break3_template.html");
this.bind(t, "dataList", data);
String str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/control/go/break3_expected.html"), str);
t = gt.getTemplate("/control/go/break3_template.html");
this.bind(t, "dataList", data);
str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/control/go/break3_expected.html"), str);
}
Aggregations