}
}};
FunctionRegistry.add("testFunction2", function2);
// #if #elseif #else
TemplateFactory t = new TemplateFactory(new File(TestConfig.class.getResource("/page").toURI())).init();
// System.out.println(t.getConfig().getViewPath());
// System.out.println(t.getConfig().getCompiledPath());
View view = t.getView("/testIf.html");
ByteArrayOutputStream out = new ByteArrayOutputStream();
Model model = new ModelMock();
view.render(model, out);
out.close();
System.out.println(out.toString());
System.out.println("=======================================");
out = new ByteArrayOutputStream();
model.put("otherAge", 33);
model.put("user", user);
model.put("login", true);
view.render(model, out);
out.close();
System.out.println(out.toString());
System.out.println("=======================================for");
// #for
model = new ModelMock();
out = new ByteArrayOutputStream();
view = t.getView("/testFor.html");
List<User> list = new ArrayList<User>();
user = new User();
user.setName("Tom");
user.setAge(20);
list.add(user);
user = new User();
user.setName("小明");
user.setAge(13);
list.add(user);
user = new User();
user.setName("小红");
user.setAge(20);
list.add(user);
model.put("users", list);
model.put("intArr", new int[]{1,2,3,4,5});
view.render(model, out);
out.close();
System.out.println(out.toString());
System.out.println("=======================================");
// #switch #case #default
model = new ModelMock();
out = new ByteArrayOutputStream();
view = t.getView("/testSwitch.html");
model.put("stage", 2);
view.render(model, out);
out.close();
System.out.println(out.toString());
System.out.println("=======================================");
// #set
model = new ModelMock();
out = new ByteArrayOutputStream();
view = t.getView("/testSet.html");
model.put("name", "迈克");
view.render(model, out);
out.close();
System.out.println(out.toString());
System.out.println("=======================================");
// #include
model = new ModelMock();
out = new ByteArrayOutputStream();
view = t.getView("/testInclude.html");
view.render(model, out);
out.close();
System.out.println(out.toString());
System.out.println("=======================================");
// #function
model = new ModelMock();
model.put("teststr", "好长好长,好大好大,的一个东东!");
model.put("testXmlEscape", "<input type=\"text\">测试</input>");
out = new ByteArrayOutputStream();
view = t.getView("/testFunction.html");
view.render(model, out);
out.close();
System.out.println(out.toString());
// FunctionRegistry.MAP.get("").render(model, out, obj)
}