コード例 #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 getUserByLogin() throws Exception {
   accountService.addUser(testUser);
   final UserProfile user = accountService.getUserByLogin(testUser.getLogin());
   assertNotNull(user);
   assertEquals(testUser, user);
 }
コード例 #3
0
 @Test
 public void getUser() throws Exception {
   final long userId = accountService.addUser(testUser);
   assertNotNull(userId);
   final UserProfile createdUser = accountService.getUser(userId);
   assertEquals(testUser, createdUser);
 }
コード例 #4
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);
 }
コード例 #5
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);
 }
コード例 #6
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);
 }
コード例 #7
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);
 }
コード例 #8
0
 @Test
 public void testRemoveUser() throws Exception {
   final long userId = accountService.addUser(testUser);
   assertNotNull(accountService.getUser(userId));
   final boolean result = accountService.removeUser(userId);
   assertTrue(result);
   assertNull(accountService.getUser(userId));
 }
コード例 #9
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);
 }
コード例 #10
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);
 }
コード例 #11
0
 @Test(expected = DatabaseException.class)
 public void testAddSameLoginFail() throws Exception {
   accountService.addUser(testUser);
   accountService.addUser(new UserProfile(testUser.getLogin(), "password"));
 }
コード例 #12
0
 @Test(expected = DatabaseException.class)
 public void testAddSameUserFail() throws Exception {
   accountService.addUser(testUser);
   accountService.addUser(testUser);
 }
コード例 #13
0
 @Test
 public void testAddUser() throws Exception {
   assertNotNull(accountService.addUser(testUser));
 }
コード例 #14
0
 @Test
 public void testDoLogin() throws Exception {
   accountService.addUser(testUser);
   final UserProfile result = accountService.doLogin(TEST_SESSION_ID, testLoginRequest);
   assertNotNull(result);
 }