@Test
  public void replace_user_which_not_existing_raises_exception() {

    thrown.expect(NoResultException.class);
    thrown.expectMessage(Matchers.containsString("not found"));

    accessToken = OSIAM_CONNECTOR.retrieveAccessToken("marissa", "koala", Scope.ADMIN);
    UpdateUser patchedUser = new UpdateUser.Builder().build();
    OSIAM_CONNECTOR.updateUser(NOT_EXISTING_ID, patchedUser, accessToken);
  }
  @Test
  @Ignore("Fails because of a bug in resource-server")
  public void deleting_and_add_of_same_mail_address_works_independent_of_order() {
    User user = createFullUser(IRRELEVANT);
    Email email = user.getEmails().get(0);
    UpdateUser updateUser = new UpdateUser.Builder().addEmail(email).deleteEmail(email).build();

    User updatedUser = OSIAM_CONNECTOR.updateUser(user.getId(), updateUser, accessToken);

    assertThat(updatedUser.getEmails(), is(equalTo(user.getEmails())));
  }
 private void updateUser() {
   returnUser = OSIAM_CONNECTOR.updateUser(idExistingUser, updateUser, accessToken);
   // get user again from database to be able to compare with return object
   databaseUser = OSIAM_CONNECTOR.getUser(returnUser.getId(), accessToken);
 }