Ejemplo n.º 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");
  }
Ejemplo n.º 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");
  }
Ejemplo n.º 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()));
  }
Ejemplo n.º 4
0
 @Test
 public void getUserRole() {
   userRepository.addUser(new User("testEmail", "testPW", "testUser", "testRole"));
   assertThat(userRepository.getUserRole("testEmail"), is("testRole"));
 }
Ejemplo n.º 5
0
 @Test(expected = ObjectAlreadyExistException.class)
 public void userIdAlreadyTest() {
   userRepository.addUser(new User("testEmail", "testPW", "testUser", "testRole"));
   userRepository.checkUserIdAlreadyExists("testUser");
 }