@Test public void testEdit() throws Exception { log.debug("testing edit..."); action.setId(1L); assertNull(action.getPerson()); assertEquals("success", action.edit()); assertNotNull(action.getPerson()); assertFalse(action.hasActionErrors()); }
@Test public void testSave() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest(); ServletActionContext.setRequest(request); action.setId(1L); assertEquals("success", action.edit()); assertNotNull(action.getPerson()); // update last name and save action.getPerson().setLastName("Updated Last Name"); assertEquals("input", action.save()); assertEquals("Updated Last Name", action.getPerson().getLastName()); assertFalse(action.hasActionErrors()); assertFalse(action.hasFieldErrors()); assertNotNull(request.getSession().getAttribute("messages")); }