@Test public void testRemoveUserWrongSessionFail() throws Exception { accountService.addUser(testUser); accountService.doLogin(TEST_SESSION_ID, testLoginRequest); final boolean result = accountService.removeUser(INVALID_SESSION_ID, testUser.getId()); assertFalse(result); }
@Test public void getUserByLogin() throws Exception { accountService.addUser(testUser); final UserProfile user = accountService.getUserByLogin(testUser.getLogin()); assertNotNull(user); assertEquals(testUser, user); }
@Test public void testUpdateUserInvalidSessionFail() throws Exception { accountService.addUser(testUser); accountService.doLogin(TEST_SESSION_ID, testLoginRequest); final UserProfile newUser = new UserProfile("newLogin", "testpass"); final boolean result = accountService.updateUser(INVALID_SESSION_ID, testUser.getId(), newUser); assertFalse(result); }
@Test public void testRemoveUserWrongIdFail() throws Exception { accountService.addUser(testUser); accountService.doLogin(TEST_SESSION_ID, testLoginRequest); final long wrondId = testUser.getId() + 1; final boolean result = accountService.removeUser(TEST_SESSION_ID, wrondId); assertFalse(result); }
@Test public void testUpdateUserWrongUserIdFail() throws Exception { accountService.addUser(testUser); accountService.doLogin(TEST_SESSION_ID, testLoginRequest); final long wrongId = testUser.getId() + 1; final UserProfile newUser = new UserProfile("newLogin", "testpass"); final boolean result = accountService.updateUser(TEST_SESSION_ID, wrongId, newUser); assertFalse(result); }
@Test public void testRemoveNoUserFail() throws Exception { final boolean result = accountService.removeUser(testUser.getId()); assertFalse(result); }
@Test(expected = DatabaseException.class) public void testAddSameLoginFail() throws Exception { accountService.addUser(testUser); accountService.addUser(new UserProfile(testUser.getLogin(), "password")); }