Esempio n. 1
0
 @Test
 public void testExecuteNoPasswordHintUserName() throws Exception {
   action.setUsername("manager");
   final User user = userManager.getUserByUsername("admin");
   user.setPasswordHint("  ");
   userManager.save(user);
   assertEquals(Action.INPUT, action.execute());
   assertTrue(action.hasActionErrors());
   user.setPasswordHint(null);
   userManager.save(user);
   assertEquals(Action.INPUT, action.execute());
   assertTrue(action.hasActionErrors());
 }
Esempio n. 2
0
  @Test
  public void testExecute() throws Exception {
    // start SMTP Server
    Wiser wiser = new Wiser();
    wiser.setPort(getSmtpPort());
    wiser.start();

    action.setUsername("user");
    assertEquals("success", action.execute());
    assertFalse(action.hasActionErrors());

    // verify an account information e-mail was sent
    wiser.stop();
    assertTrue(wiser.getMessages().size() == 1);

    // verify that success messages are in the request
    assertNotNull(action.getSession().getAttribute("messages"));
  }
Esempio n. 3
0
 @Test
 public void testExecuteWrongUserName() throws Exception {
   action.setUsername("UNKNOWN123");
   assertEquals(Action.INPUT, action.execute());
   assertTrue(action.hasActionErrors());
 }
Esempio n. 4
0
 @Test
 public void testExecuteNoUserName() throws Exception {
   action.setUsername(null);
   assertEquals(Action.INPUT, action.execute());
   assertTrue(action.hasActionErrors());
 }