コード例 #1
0
 @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);
 }
コード例 #2
0
 @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);
 }
コード例 #3
0
 @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);
 }
コード例 #4
0
 @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);
 }
コード例 #5
0
 @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);
 }
コード例 #6
0
 @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);
 }
コード例 #7
0
 @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);
 }
コード例 #8
0
 @Test
 public void testDoLoginNoUserFail() throws Exception {
   final UserProfile result = accountService.doLogin(TEST_SESSION_ID, testLoginRequest);
   assertNull(result);
 }
コード例 #9
0
 @Test
 public void testDoLogin() throws Exception {
   accountService.addUser(testUser);
   final UserProfile result = accountService.doLogin(TEST_SESSION_ID, testLoginRequest);
   assertNotNull(result);
 }