@Test
public void testSave() throws Exception {

    final User user = createUser();
    final User user2 = createUser();
    action.setUser(user);
    // set mock response so setting cookies doesn't fail
    ServletActionContext.setResponse(new MockHttpServletResponse());
    // start SMTP Server
    final Wiser wiser = startWiser(getSmtpPort());
    assertNull(action.getUser().getId());
    assertEquals("success", action.save());
    assertFalse(action.hasActionErrors());
    assertNotNull(action.getUser().getId());
    // verify an account information e-mail was sent
    wiser.stop();
    assertTrue(wiser.getMessages().size() == 1);
    // verify that success messages are in the session
    assertNotNull(action.getSession().getAttribute(Constants.REGISTERED));
    // try it again with same user
    action.setUser(user2);
    assertEquals(Action.INPUT, action.save());
    assertTrue(action.hasActionErrors());
    SecurityContextHolder.getContext().setAuthentication(null);
}