首页>代码>自己在项目中写的简单的仿 freemarker 模板引擎工具 V2 版本,支持迭代 template4javaniu>/template4javaniu/TemplateUtilsTest.java
/* * Copyright 2012-2013 The Haohui Network Corporation */ package com.haohui.baidamei.client.web.json.template; import static org.junit.Assert.*; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.junit.Test; /** * <pre> * * </pre> * * @project baidamei * @author cevencheng <cevencheng@gmail.com> * @create 2012-11-25 上午6:04:54 */ public class TemplateUtilsTest { /** * Test method for {@link com.haohui.baidamei.client.web.json.template.TemplateUtils#getResource(java.lang.String)}. */ @Test public void testGetResource() { fail("Not yet implemented"); } /** * Test method for {@link com.haohui.baidamei.client.web.json.template.TemplateUtils#processTemplateIntoString(java.lang.String)}. */ @Test public void testProcessTemplateIntoStringString() { fail("Not yet implemented"); } /** * Test method for {@link com.haohui.baidamei.client.web.json.template.TemplateUtils#processTemplateIntoString(java.lang.String, java.lang.String)}. */ @Test public void testProcessTemplateIntoStringStringString() { fail("Not yet implemented"); } /** * Test method for {@link com.haohui.baidamei.client.web.json.template.TemplateUtils#processTemplateIntoString(java.lang.String, java.lang.String, java.util.Map)}. */ @Test public void testProcessTemplateIntoStringStringStringMapOfObjectObject() throws Exception { Map<String, Object> map = new HashMap<String, Object>(); Bean bean = new Bean("101", "小叶子"); Bean bean2 = new Bean("102", "石头"); List<Bean> list = new ArrayList<Bean>(2); list.add(bean); list.add(bean2); map.put("userlist", list); String content = TemplateUtils.processTemplateIntoString("tpl.txt", "utf8", map); System.out.println("content:" + content); } /** * Test method for {@link com.haohui.baidamei.client.web.json.template.TemplateUtils#main(java.lang.String[])}. */ @Test public void testMain() { fail("Not yet implemented"); } }