appfuse一套结合STRUTS+SPRING+HIBERNATE的框架

源代码在线查看: userlisttest.java

软件大小: 31310 K
上传用户: sun67512945
关键词: HIBERNATE appfuse STRUTS SPRING
下载地址: 免注册下载 普通下载 VIP

相关代码

				package org.appfuse.webapp.action;
				
				import org.apache.tapestry.engine.RequestCycle;
				import org.appfuse.service.UserManager;
				
				import java.util.HashMap;
				import java.util.Map;
				
				public class UserListTest extends BasePageTestCase {
				    private UserList page;
				
				    protected void onSetUp() throws Exception {
				        super.onSetUp();        
				        // these can be mocked if you want a more "pure" unit test
				        Map map = new HashMap();
				        map.put("userManager", applicationContext.getBean("userManager"));
				        page = (UserList) getPage(UserList.class, map);
				    }
				
				    protected void onTearDown() throws Exception {
				        super.onTearDown();
				        page = null;
				    }
				    
				    public void testEdit() throws Exception {
				        RequestCycle cycle = new MockRequestCycle();
				        cycle.setServiceParameters(new Object[] {"tomcat"});
				        page.edit(cycle);
				        assertFalse(page.hasErrors());
				    }
				
				    public void testSearch() throws Exception {
				        assertTrue(page.getUserManager().getUsers(null).size() >= 1);
				    }
				}
							

相关资源