UserAction extends BaseAction { public String save() throws UserExistsException { if (log.isDebugEnabled()) { log.debug("entering 'save' method"); } try { userManager.saveUser(user); } catch (UserExistsException uex) { addActionError(getText("user.exists")); return INPUT; } List<String> args = new ArrayList<String>(); args.add(user.getFullName()); saveMessage(getText("user.saved", args)); return SUCCESS; }  void setUserManager(UserManager userManager); List<User> getUsers(); void setId(String id); User getUser(); void setUser(User user); String delete(); String edit(); String execute(); String save(); String list();  }
@Test public void testSave() throws Exception { action.setId("-1"); action.edit(); assertNotNull(action.getUser()); action.getUser().setFirstName("Jack"); assertEquals("success", action.save()); assertNotNull(action.getUser()); }