예제 #1
0
  @Test
  public void checkPasswordTrueTest() {

    String encryptedPW = BCrypt.hashpw("testPW", BCrypt.gensalt());
    userRepository.addUser(new User("testEmail", encryptedPW, "testUser", "testRole"));

    userRepository.checkPassword("testEmail", "testPW");
  }
예제 #2
0
  @Test(expected = InvalidInputException.class)
  public void checkPasswordFalseTest() {

    String encryptedPW = BCrypt.hashpw("testPW", BCrypt.gensalt());
    userRepository.addUser(new User("testEmail", encryptedPW, "testUser", "testRole"));

    userRepository.checkPassword("testEmail", "testFalse");
  }
예제 #3
0
  @Test
  public void getUserByEmail() {

    User user1 = new User("testEmail", "testPW", "testUser", "testRole");
    userRepository.addUser(user1);
    User user2 = userRepository.getUserByEmail("testEmail");

    assertThat(user1.getUserId(), is(user2.getUserId()));
  }
예제 #4
0
 @Test
 public void getUserRole() {
   userRepository.addUser(new User("testEmail", "testPW", "testUser", "testRole"));
   assertThat(userRepository.getUserRole("testEmail"), is("testRole"));
 }
예제 #5
0
 @Test(expected = ObjectAlreadyExistException.class)
 public void userIdAlreadyTest() {
   userRepository.addUser(new User("testEmail", "testPW", "testUser", "testRole"));
   userRepository.checkUserIdAlreadyExists("testUser");
 }