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

源代码在线查看: userformtest.java

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

相关代码

				package org.appfuse.webapp.action;
				
				import org.appfuse.model.User;
				
				public class UserFormTest extends BasePageTestCase {
				    private UserForm bean;
				
				    protected void setUp() throws Exception {    
				        super.setUp();
				        bean = (UserForm) getManagedBean("userForm");
				    }
				    
				    protected void tearDown() throws Exception {
				        super.tearDown();
				        bean = null;
				    }
				    
				    public void testEdit() throws Exception {
				        bean.setUsername("tomcat");
				        assertEquals(bean.edit(), "editProfile");
				        assertNotNull(bean.getUser().getUsername());
				        assertFalse(bean.hasErrors());
				    }
				
				    public void testSave() throws Exception {
				        user.setPassword("tomcat");
				        user.setConfirmPassword("tomcat");
				        bean.setUser(user);
				
				        assertEquals(bean.save(), "mainMenu");
				        assertNotNull(bean.getUser());
				        assertFalse(bean.hasErrors());
				    }
				    
				    public void testRemove() throws Exception {
				        User user2Delete = new User();
				        user2Delete.setId(new Long(2));
				        bean.setUser(user2Delete);
				        assertEquals(bean.delete(), "list");
				        assertFalse(bean.hasErrors());
				    }
				}
							

相关资源