@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 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 getUser() throws Exception {
   final long userId = accountService.addUser(testUser);
   assertNotNull(userId);
   final UserProfile createdUser = accountService.getUser(userId);
   assertEquals(testUser, createdUser);
 }
 @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 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 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));
 }
 @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 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 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"));
 }
 @Test
 public void testDoLoginNoUserFail() throws Exception {
   final UserProfile result = accountService.doLogin(TEST_SESSION_ID, testLoginRequest);
   assertNull(result);
 }
 @Test
 public void testAddUser() throws Exception {
   assertNotNull(accountService.addUser(testUser));
 }
 @Test
 public void getLocalStatus() throws Exception {
   final String result = accountService.getLocalStatus();
   assertEquals(result, "ACTIVE");
 }
 @Test
 public void testDoLogoutNoSessionFail() throws Exception {
   final boolean result = accountService.doLogout(INVALID_SESSION_ID);
   assertFalse(result);
 }
 @Test(expected = DatabaseException.class)
 public void testAddSameUserFail() throws Exception {
   accountService.addUser(testUser);
   accountService.addUser(testUser);
 }
 @Test
 public void testDoLogin() throws Exception {
   accountService.addUser(testUser);
   final UserProfile result = accountService.doLogin(TEST_SESSION_ID, testLoginRequest);
   assertNotNull(result);
 }