@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 testDoLogout() throws Exception { accountService.addUser(testUser); accountService.doLogin(TEST_SESSION_ID, testLoginRequest); final boolean result = accountService.doLogout(TEST_SESSION_ID); assertTrue(result); }
@Test public void testDoLoginInvalidPassFail() throws Exception { accountService.addUser(testUser); final UserLoginRequest userLoginRequest = new UserLoginRequest("testlogin", "invalidPass"); final UserProfile result = accountService.doLogin(TEST_SESSION_ID, userLoginRequest); assertNull(result); }
@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 testUpdateUser() throws Exception { final long userId = accountService.addUser(testUser); accountService.doLogin(TEST_SESSION_ID, testLoginRequest); final UserProfile newProfile = new UserProfile("newLogin", "testpass"); final boolean result = accountService.updateUser(TEST_SESSION_ID, userId, newProfile); assertTrue(result); final UserProfile updatedUser = accountService.getUser(userId); assertEquals(updatedUser, newProfile); }
@Test public void testDoLoginNoUserFail() throws Exception { final UserProfile result = accountService.doLogin(TEST_SESSION_ID, testLoginRequest); assertNull(result); }
@Test public void testDoLogin() throws Exception { accountService.addUser(testUser); final UserProfile result = accountService.doLogin(TEST_SESSION_ID, testLoginRequest); assertNotNull(result); }