Search in sources :

Example 46 with Template

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

the class GoTest method testContinueAndReturn.

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

Example 47 with Template

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

the class SelectTest method testSwitch.

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

Example 48 with Template

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

the class SelectTest method testSelect2.

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

Example 49 with Template

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

the class SwitchTest method testDefault.

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

Example 50 with Template

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

the class TryCatchTest method testGenera.

@Test
public void testGenera() throws Exception {
    Template t = gt.getTemplate("/control/trycatch/general_template.html");
    String str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/control/trycatch/general_expected.html"), str);
    t = gt.getTemplate("/control/trycatch/general_template.html");
    str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/control/trycatch/general_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