示例#1
0
 @Test
 public void testFind() throws Exception {
   User foundUser = h2User.find(user.getId());
   assertEquals(email, foundUser.getEmail());
   assertEquals(password, foundUser.getPassword());
   assertEquals(type, foundUser.getType());
 }
示例#2
0
  @Test
  public void testLoginUser() throws Exception {
    User user = createUser();
    api.createUser(user);

    String token = api.loginUser(user.getUsername(), user.getPassword());
    assertTrue(token.startsWith("logged in user session:"));
  }
  @Test
  public void
      verifyLogIn_should_return_a_user_with_matching_password_and_username_but_password_should_be_null() {
    User loginUser = new User(42, "User1", null, null, null, "123");
    ArrayList<User> expected = new ArrayList<User>();
    expected.add(loginUser);
    dbHandler.populateUserResult(expected);
    initProvider();
    String json = jsonHandler.userToJSON(loginUser);
    User user = provider.verifyLogIn(json);

    assertEquals("User1", user.getUsername());
    assertNull(user.getPassword());
  }
示例#4
0
 @Test
 public void testCreate() throws Exception {
   assertEquals(email, user.getEmail());
   assertEquals(password, user.getPassword());
   assertEquals(type, user.getType());
 }