public void testInstantiateVAppTemplateInVDCURIOptions()
      throws SecurityException, NoSuchMethodException, IOException {
    Method method =
        TerremarkVCloudExpressAsyncClient.class.getMethod(
            "instantiateVAppTemplateInVDC",
            URI.class,
            URI.class,
            String.class,
            InstantiateVAppTemplateOptions[].class);
    HttpRequest request =
        processor.createRequest(
            method,
            URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"),
            URI.create("https://vcloud/vAppTemplate/3"),
            "name",
            TerremarkInstantiateVAppTemplateOptions.Builder.processorCount(2)
                .memory(512)
                .inGroup("group")
                .withPassword("password")
                .inRow("row")
                .addNetworkConfig(new NetworkConfig(URI.create("http://network"))));

    assertRequestLineEquals(
        request,
        "POST https://vcloud.safesecureweb.com/api/v0.8/vdc/1/action/instantiateVAppTemplate HTTP/1.1");
    assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
    assertPayloadEquals(
        request,
        Strings2.toStringAndClose(
            getClass()
                .getResourceAsStream("/terremark/InstantiateVAppTemplateParams-options-test.xml")),
        "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml",
        false);

    assertResponseParserClassEquals(method, request, ParseSax.class);
    assertSaxResponseParserClassEquals(method, VCloudExpressVAppHandler.class);
    assertExceptionParserClassEquals(method, null);

    checkFilters(request);
  }
  public void testInstantiateVAppTemplateOptions()
      throws SecurityException, NoSuchMethodException, IOException {
    Method method =
        TerremarkVCloudAsyncClient.class.getMethod(
            "instantiateVAppTemplateInVDC",
            String.class,
            String.class,
            String.class,
            Array.newInstance(InstantiateVAppTemplateOptions.class, 0).getClass());
    GeneratedHttpRequest<TerremarkVCloudAsyncClient> httpMethod =
        processor.createRequest(
            method,
            "1",
            "name",
            3 + "",
            TerremarkInstantiateVAppTemplateOptions.Builder.processorCount(2)
                .memory(512)
                .inRow("row")
                .inGroup("group")
                .withPassword("password")
                .inNetwork(URI.create("http://network")));

    assertRequestLineEquals(
        httpMethod, "POST http://vcloud/vdc/1/action/instantiateVAppTemplate HTTP/1.1");
    assertHeadersEqual(
        httpMethod,
        "Accept: application/vnd.vmware.vcloud.vApp+xml\nContent-Length: 1902\nContent-Type: application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml\n");
    assertPayloadEquals(
        httpMethod,
        Utils.toStringAndClose(
            getClass()
                .getResourceAsStream("/terremark/InstantiateVAppTemplateParams-options-test.xml")));

    assertResponseParserClassEquals(method, httpMethod, ParseSax.class);
    assertSaxResponseParserClassEquals(method, VAppHandler.class);
    assertExceptionParserClassEquals(method, null);

    checkFilters(httpMethod);
  }