@Test
  public void testDeleteUser() {
    VCloudDirectorAdminClient client =
        requestsSendResponses(
            loginRequest,
            sessionResponse,
            new VcloudHttpRequestPrimer()
                .apiCommand("DELETE", "/admin/user/b37223f3-8792-477a-820f-334998f61cd6")
                .acceptAnyMedia()
                .httpRequestBuilder()
                .build(),
            new VcloudHttpResponsePrimer().httpResponseBuilder().statusCode(204).build());

    client.getUserClient().deleteUser(userRef.getHref());
  }
  @Test
  public void testGetUser() {
    VCloudDirectorAdminClient client =
        requestsSendResponses(
            loginRequest,
            sessionResponse,
            new VcloudHttpRequestPrimer()
                .apiCommand("GET", "/admin/user/b37223f3-8792-477a-820f-334998f61cd6")
                .acceptAnyMedia()
                .httpRequestBuilder()
                .build(),
            new VcloudHttpResponsePrimer()
                .xmlFilePayload("/user/user.xml", VCloudDirectorMediaType.USER)
                .httpResponseBuilder()
                .build());

    User expected = user();

    assertEquals(client.getUserClient().getUser(userRef.getHref()), expected);
  }
  @Test
  public void testCreateUser() {
    VCloudDirectorAdminClient client =
        requestsSendResponses(
            loginRequest,
            sessionResponse,
            new VcloudHttpRequestPrimer()
                .apiCommand("POST", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/users")
                .xmlFilePayload("/user/createUserSource.xml", VCloudDirectorMediaType.USER)
                .acceptMedia(VCloudDirectorMediaType.USER)
                .httpRequestBuilder()
                .build(),
            new VcloudHttpResponsePrimer()
                .xmlFilePayload("/user/createUser.xml", VCloudDirectorMediaType.USER)
                .httpResponseBuilder()
                .build());

    User source = createUserSource();
    User expected = createUser();

    assertEquals(client.getUserClient().createUser(orgRef.getHref(), source), expected);
  }
  @Test(expectedExceptions = ResourceNotFoundException.class)
  public void testUnlockUserFailNotFound() {
    VCloudDirectorAdminClient client =
        requestsSendResponses(
            loginRequest,
            sessionResponse,
            new VcloudHttpRequestPrimer()
                .apiCommand(
                    "POST", "/admin/user/b37223f3-8792-477a-820f-334998f61cd6/action/unlock")
                .acceptAnyMedia()
                .httpRequestBuilder()
                .build(),
            new VcloudHttpResponsePrimer()
                .httpResponseBuilder()
                .statusCode(403)
                .payload(
                    payloadFromResourceWithContentType(
                        "/org/error400.xml", VCloudDirectorMediaType.ERROR))
                .build());

    client.getUserClient().unlockUser(userRef.getHref());
  }