コード例 #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");
 }