Search in sources :

Example 61 with Template

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

the class GeneralNumberTest method testDiv.

@Test
public void testDiv() throws Exception {
    Template t = gt.getTemplate("/exp/general_div_template.html");
    this.bind(t, "d1", d1, "d2", d2);
    String str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/exp/general_div_expected.html"), str);
    t = gt.getTemplate("/exp/general_div_template.html");
    this.bind(t, "d1", d1, "d2", d2);
    str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/exp/general_div_expected.html"), str);
}
Also used : Template(org.beetl.core.Template) Test(org.testng.annotations.Test)

Example 62 with Template

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

the class GeneralNumberTest method testAdd.

@Test
public void testAdd() throws Exception {
    Template t = gt.getTemplate("/exp/general_add_template.html");
    this.bind(t, "d1", d1, "d2", d2);
    String str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/exp/general_add_expected.html"), str);
    t = gt.getTemplate("/exp/general_add_template.html");
    this.bind(t, "d1", d1, "d2", d2);
    str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/exp/general_add_expected.html"), str);
}
Also used : Template(org.beetl.core.Template) Test(org.testng.annotations.Test)

Example 63 with Template

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

the class GoTest method testBreak2.

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

Example 64 with Template

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

the class Pojo2 method testWrongSimple.

@Test
public void testWrongSimple() throws Exception {
    Pojo2 p = new Pojo2();
    Template t = gt.getTemplate("/lang/pojo2_template.html");
    t.binding("p", p);
    String str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/lang/pojo2_expected.html"), str);
}
Also used : Template(org.beetl.core.Template) Test(org.testng.annotations.Test)

Example 65 with Template

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

the class NativeTest method testMethodParameter.

@Test
public void testMethodParameter() throws Exception {
    NativeTest test = new NativeTest();
    Template t = gt.getTemplate("/nat/nat_method2_template.html");
    this.bind(t, "test", test);
    String str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/nat/nat_method2_expected.html"), str);
    t = gt.getTemplate("/nat/nat_method2_template.html");
    this.bind(t, "test", test);
    str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/nat/nat_method2_expected.html"), str);
}
Also used : GroupTemplate(org.beetl.core.GroupTemplate) 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