spring struts hibernate

源代码在线查看: userformtest.java

软件大小: 23297 K
上传用户: gxjun686
关键词: hibernate spring struts
下载地址: 免注册下载 普通下载 VIP

相关代码

				package org.appfuse.webapp.action;
				
				
				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.setUsername("mraible");
				        bean.setUser(user);
				        assertEquals(bean.delete(), "list");
				        assertFalse(bean.hasErrors());
				    }
				}
							

相关资源