UserForm extends BasePage implements Serializable { public String edit() { HttpServletRequest request = getRequest(); if (id != null) { log.debug("Editing user, id is: " + id); user = userManager.getUser(id); } else { user = userManager.getUserByUsername(request.getRemoteUser()); } if (user.getUsername() != null) { user.setConfirmPassword(user.getPassword()); if (isRememberMe()) { log.debug("checking for remember me login..."); log.trace("User '" + user.getUsername() + "' logged in with cookie"); addMessage("userProfile.cookieLogin"); } } return "editProfile"; }  void setId(String id); User getUser(); void setUser(User user); void setRoleManager(RoleManager roleManager); String add(); String cancel(); String edit(); boolean isRememberMe(); String save(); String delete(); String getFrom(); @SuppressWarnings("unchecked") Map<String, String> getAvailableRoles(); String[] getUserRoles(); void setUserRoles(String[] userRoles); String getCountry(); void setCountry(String country);  }
@Test public void testEdit() throws Exception { bean.setId("-1"); assertEquals("editProfile", bean.edit()); assertNotNull(bean.getUser().getUsername()); assertFalse(bean.hasErrors()); }