UserAction extends BaseAction implements Preparable { public String cancel() { if (!"list".equals(from)) { return "home"; } return "cancel"; }  void prepare(); List<User> getUsers(); void setId(String id); User getUser(); void setUser(User user); void setQ(String q); String delete(); String edit(); String execute(); String cancel(); String save(); String list();  }
@Test public void testCancel() throws Exception { assertEquals(action.cancel(), "home"); assertFalse(action.hasActionErrors()); action.setFrom("list"); assertEquals("cancel", action.cancel()); }