Search in sources :

Example 6 with User

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

the class DeleteTagTest method testDeleteTag.

@Test
public void testDeleteTag() throws Exception {
    User user = User.getTestUser();
    Template t = gt.getTemplate("/tag/delete_template.html");
    this.bind(t, "user", user);
    String str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/tag/delete_expected.html"), str);
    t = gt.getTemplate("/tag/delete_template.html");
    this.bind(t, "user", user);
    str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/tag/delete_expected.html"), str);
}
Also used : User(org.beetl.core.User) Template(org.beetl.core.Template) Test(org.testng.annotations.Test)

Example 7 with User

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

the class IncludeTest method testInclude.

@Test
public void testInclude() throws Exception {
    User user = User.getTestUser();
    Template t = gt.getTemplate("/tag/include_template.html");
    this.bind(t, "user", user);
    String str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/tag/include_expected.html"), str);
    t = gt.getTemplate("/tag/include_template.html");
    this.bind(t, "user", user);
    str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/tag/include_expected.html"), str);
}
Also used : User(org.beetl.core.User) Template(org.beetl.core.Template) Test(org.testng.annotations.Test)

Example 8 with User

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

the class IncludeTest method testIncludeRel.

@Test
public void testIncludeRel() throws Exception {
    User user = User.getTestUser();
    Template t = gt.getTemplate("/tag/main_include_template.html");
    this.bind(t, "user", user);
    String str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/tag/main_include_expected.html"), str);
    t = gt.getTemplate("/tag/main_include_template.html");
    this.bind(t, "user", user);
    str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/tag/main_include_expected.html"), str);
}
Also used : User(org.beetl.core.User) Template(org.beetl.core.Template) Test(org.testng.annotations.Test)

Example 9 with User

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

the class LayoutTagTest method testLayout.

@Test
public void testLayout() throws Exception {
    User user = User.getTestUser();
    Template t = gt.getTemplate("/tag/layout_template.html");
    this.bind(t, "user", user);
    String str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/tag/layout_expected.html"), str);
    t = gt.getTemplate("/tag/layout_template.html");
    this.bind(t, "user", user);
    str = t.render();
    AssertJUnit.assertEquals(this.getFileContent("/tag/layout_expected.html"), str);
}
Also used : User(org.beetl.core.User) Template(org.beetl.core.Template) Test(org.testng.annotations.Test)

Example 10 with User

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

the class NullFunction method call.

@Override
public Map call(Object[] paras, Context ctx) {
    Boolean b = (Boolean) paras[0];
    if (b) {
        return null;
    } else {
        Map map = new HashMap();
        User user = new User("name");
        map.put("user", user);
        return map;
    }
}
Also used : User(org.beetl.core.User) HashMap(java.util.HashMap) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

User (org.beetl.core.User)16 Template (org.beetl.core.Template)14 Test (org.testng.annotations.Test)14 HashMap (java.util.HashMap)5 Map (java.util.Map)5 List (java.util.List)2 JSONObject (com.alibaba.fastjson.JSONObject)1 Context (org.beetl.core.Context)1 VirtualClassAttribute (org.beetl.core.VirtualClassAttribute)1