UserForm extends BasePage { public String edit() { if (id == null) { id = getParameter("id"); } if (id != null) { setUser(userManager.getUser(id)); } return "success"; }  @Autowired void setUserManager(UserManager userManager); String getId(); void setId(String id); User getUser(); void setUser(User user); String edit(); String save(); String delete(); public User user; transient UserManager userManager; }
@Test public void testEdit() throws Exception { bean.setId("-1"); assertEquals(bean.edit(), "success"); assertNotNull(bean.getUser().getFirstName()); }