コード例 #1
0
  @Test(expected = LoginAttemptsExceededException.class)
  public void testAuthenticate3Times() throws Exception {
    LoginHandler lh = new LoginHandler(users);
    assertFalse(lh.authenticate("username", "psword")); // ID PW 틀릴때
    assertEquals(1, lh.getTimes());

    assertFalse(lh.authenticate("username", "password")); // ID PW 틀릴때
    assertEquals(2, lh.getTimes());

    assertFalse(lh.authenticate("admin", "p ")); // ID PW 틀릴때
    assertEquals(3, lh.getTimes());

    assertFalse(lh.authenticate("admin", "p ")); // ID PW 틀릴때
    assertEquals(4, lh.getTimes());

    assertFalse(lh.authenticate("admin", "p ")); // ID PW 틀릴때
    assertEquals(5, lh.getTimes());
  }
コード例 #2
0
 @Test
 public void testAuthenticateTTCase() throws Exception {
   LoginHandler lh = new LoginHandler(users);
   assertTrue(lh.authenticate("admin", "password")); // ID PW 틀릴때
   assertEquals(0, lh.getTimes());
 }
コード例 #3
0
 @Test
 public void testResetHandler() {
   LoginHandler lh = new LoginHandler(users);
   lh.resetHandler();
   assertEquals(0, lh.getTimes());
 }
コード例 #4
0
 @Test
 public void testAuthenticateFTCase() throws Exception {
   LoginHandler lh = new LoginHandler(users);
   assertFalse(lh.authenticate("username", "password")); // ID PW 틀릴때
   assertEquals(1, lh.getTimes());
 }
コード例 #5
0
 @Test
 public void testLoginHandler() {
   LoginHandler lh = new LoginHandler(users);
   assertEquals(0, lh.getTimes());
   assertSame(users, lh.getValidUsers());
 }