use of org.beetl.core.Template in project beetl2.0 by javamonkey.
the class SetTest method testArrayMap.
@Test
public void testArrayMap() throws Exception {
Template t = gt.getTemplate("/exp/set_template.html");
int[] c = new int[] { 1, 2 };
int[][] d = new int[][] { { 1, 2 }, { 3, 4 } };
t.binding("c", c);
t.binding("d", d);
String str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/exp/set_expected.html"), str);
t = gt.getTemplate("/exp/set_template.html");
t.binding("c", c);
t.binding("d", d);
str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/exp/set_expected.html"), str);
}
use of org.beetl.core.Template in project beetl2.0 by javamonkey.
the class SetTest method testPojo.
@Test
public void testPojo() throws Exception {
Template t = gt.getTemplate("/exp/set_pojo_template.html");
User user = new User("joelli");
User lover = new User("lucymiao");
t.binding("user", user);
t.binding("lover", lover);
String str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/exp/set_pojo_expected.html"), str);
t = gt.getTemplate("/exp/set_pojo_template.html");
t.binding("user", user);
t.binding("lover", lover);
str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/exp/set_pojo_expected.html"), str);
}
use of org.beetl.core.Template in project beetl2.0 by javamonkey.
the class TernaryTest method testId.
@Test
public void testId() throws Exception {
Template t = gt.getTemplate("/exp/ternary_template.html");
String str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/exp/ternary_expected.html"), str);
t = gt.getTemplate("/exp/ternary_template.html");
str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/exp/ternary_expected.html"), str);
}
use of org.beetl.core.Template in project beetl2.0 by javamonkey.
the class FileFunctionTest method testFileFunctionRetrun.
@Test
public void testFileFunctionRetrun() throws Exception {
Template t = gt.getTemplate("/function/file_template.html");
String str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/function/file_expected.html"), str);
t = gt.getTemplate("/function/file_template.html");
str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/function/file_expected.html"), str);
}
use of org.beetl.core.Template in project beetl2.0 by javamonkey.
the class FileFunctionTest method testRecurFileFunctionRetrun.
@Test
public void testRecurFileFunctionRetrun() throws Exception {
Template t = gt.getTemplate("/function/file_recur_template.html");
String str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/function/file_recur_expected.html"), str);
t = gt.getTemplate("/function/file_recur_template.html");
str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/function/file_recur_expected.html"), str);
}
Aggregations