Search in sources :

Example 51 with Template

use of org.beetl.core.Template in project beetl2.0 by javamonkey.

the class WhileTest method testWhile.

@Test
public void testWhile() throws Exception {
    Template t = gt.getTemplate("/control/while/while_template.html");
    String str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/control/while/while_expected.html"), str);
    t = gt.getTemplate("/control/while/while_template.html");
    str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/control/while/while_expected.html"), str);
}
Also used : Template(org.beetl.core.Template) Test(org.testng.annotations.Test)

Example 52 with Template

use of org.beetl.core.Template in project beetl2.0 by javamonkey.

the class generalForTest method testBreak.

@Test
public void testBreak() throws Exception {
    Template t = gt.getTemplate("/control/generalFor/general_break_template.html");
    String str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/control/generalFor/general_break_expected.html"), str);
// t = gt.getTemplate("/control/generalFor/general_break_template.html");
// //this.bind(t, "dataList", data);
// str = t.render();
// AssertJUnit.assertEquals(this.getFileContent("/control/generalFor/general_break_expected.html"), str);
}
Also used : Template(org.beetl.core.Template) Test(org.testng.annotations.Test)

Example 53 with Template

use of org.beetl.core.Template in project beetl2.0 by javamonkey.

the class AssignTest method testVarBlock.

@Test
public void testVarBlock() throws Exception {
    Template t = gt.getTemplate("/exp/assign/block_template.html");
    String str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/exp/assign/block_expected.html"), str);
    t = gt.getTemplate("/exp/assign/block_template.html");
    str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/exp/assign/block_expected.html"), str);
}
Also used : Template(org.beetl.core.Template) Test(org.testng.annotations.Test)

Example 54 with Template

use of org.beetl.core.Template in project beetl2.0 by javamonkey.

the class AssignTest method testLeftAsign.

@Test
public void testLeftAsign() throws Exception {
    Template t = gt.getTemplate("/exp/assign/left_template.html");
    t.binding("d", 100);
    String str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/exp/assign/left_expected.html"), str);
    t = gt.getTemplate("/exp/assign/left_template.html");
    t.binding("d", 100);
    str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/exp/assign/left_expected.html"), str);
}
Also used : Template(org.beetl.core.Template) Test(org.testng.annotations.Test)

Example 55 with Template

use of org.beetl.core.Template in project beetl2.0 by javamonkey.

the class AssignTest method testNull.

@Test
public void testNull() throws Exception {
    Template t = gt.getTemplate("/exp/assign/assign_null_template.html");
    String str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/exp/assign/assign_null_expected.html"), str);
    t = gt.getTemplate("/exp/assign/assign_null_template.html");
    str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/exp/assign/assign_null_expected.html"), str);
}
Also used : Template(org.beetl.core.Template) Test(org.testng.annotations.Test)

Aggregations

Template (org.beetl.core.Template)122 Test (org.testng.annotations.Test)96 GroupTemplate (org.beetl.core.GroupTemplate)41 Map (java.util.Map)15 User (org.beetl.core.User)14 HashMap (java.util.HashMap)13 Configuration (org.beetl.core.Configuration)13 FileResourceLoader (org.beetl.core.resource.FileResourceLoader)6 StringTemplateResourceLoader (org.beetl.core.resource.StringTemplateResourceLoader)6 Context (org.beetl.core.Context)5 JSONObject (com.alibaba.fastjson.JSONObject)4 List (java.util.List)4 ClasspathResourceLoader (org.beetl.core.resource.ClasspathResourceLoader)4 VirtualAttributeEval (org.beetl.core.VirtualAttributeEval)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 HttpServletResponse (javax.servlet.http.HttpServletResponse)2 BodyContent (org.beetl.core.BodyContent)2 BeetlException (org.beetl.core.exception.BeetlException)2 WebRender (org.beetl.ext.web.WebRender)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1