Search in sources :

Example 56 with Template

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

the class AssignTest method testId.

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

Example 57 with Template

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

the class BigNumberTest method testMul.

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

Example 58 with Template

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

the class BigNumberTest method testDiv.

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

Example 59 with Template

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

the class CompareTest method testBasic.

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

Example 60 with Template

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

the class GeneralNumberTest method testMinus.

@Test
public void testMinus() throws Exception {
    Template t = gt.getTemplate("/exp/general_minus_template.html");
    this.bind(t, "d1", d1, "d2", d2);
    String str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/exp/general_minus_expected.html"), str);
    t = gt.getTemplate("/exp/general_minus_template.html");
    this.bind(t, "d1", d1, "d2", d2);
    str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/exp/general_minus_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