public void testListTypesByNamesWhenResponseIs2xx() throws Exception {
    HttpRequest listWithOptions =
        HttpRequest.builder()
            .method("POST")
            .endpoint("https://elasticloadbalancing.us-east-1.amazonaws.com/")
            .addHeader("Host", "elasticloadbalancing.us-east-1.amazonaws.com")
            .payload(
                payloadFromStringWithContentType(
                    "Action=DescribeLoadBalancerPolicyTypes"
                        + "&PolicyTypeNames.member.1=moo"
                        + "&Signature=cX8twwn2E6%2B7V3CGZ4ac69NhyolJLsV1nzpQl3wQXW8%3D"
                        + "&SignatureMethod=HmacSHA256"
                        + "&SignatureVersion=2"
                        + "&Timestamp=2009-11-08T15%3A54%3A08.897Z"
                        + "&Version=2012-06-01"
                        + "&AWSAccessKeyId=identity",
                    "application/x-www-form-urlencoded"))
            .build();

    HttpResponse listWithOptionsResponse =
        HttpResponse.builder()
            .statusCode(200)
            .payload(payloadFromResourceWithContentType("/describe_policy_types.xml", "text/xml"))
            .build();

    ELBApi apiWhenWithOptionsExist = requestSendsResponse(listWithOptions, listWithOptionsResponse);

    assertEquals(
        apiWhenWithOptionsExist.getPolicyApi().listTypes(ImmutableSet.of("moo")).toString(),
        new DescribeLoadBalancerPolicyTypesResponseTest().expected().toString());
  }
  public void testListWithOptionsWhenResponseIs2xx() throws Exception {
    HttpRequest listWithOptions =
        HttpRequest.builder()
            .method("POST")
            .endpoint("https://elasticloadbalancing.us-east-1.amazonaws.com/")
            .addHeader("Host", "elasticloadbalancing.us-east-1.amazonaws.com")
            .payload(
                payloadFromStringWithContentType(
                    "Action=DescribeLoadBalancerPolicies"
                        + "&LoadBalancerName=moo"
                        + "&Signature=c8PG1b5wI5YMU0motVEo5Mz7d5w8gy8u51kfCR6SnRI%3D"
                        + "&SignatureMethod=HmacSHA256"
                        + "&SignatureVersion=2"
                        + "&Timestamp=2009-11-08T15%3A54%3A08.897Z"
                        + "&Version=2012-06-01"
                        + "&AWSAccessKeyId=identity",
                    "application/x-www-form-urlencoded"))
            .build();

    HttpResponse listWithOptionsResponse =
        HttpResponse.builder()
            .statusCode(200)
            .payload(payloadFromResourceWithContentType("/describe_policies.xml", "text/xml"))
            .build();

    ELBApi apiWhenWithOptionsExist = requestSendsResponse(listWithOptions, listWithOptionsResponse);

    assertEquals(
        apiWhenWithOptionsExist.getPolicyApi().list(loadBalancerName("moo")).toString(),
        new DescribeLoadBalancerPoliciesResponseTest().expected().toString());
  }
  public void testGetWhenResponseIs404() throws Exception {

    HttpResponse getResponse = HttpResponse.builder().statusCode(404).build();

    ELBApi apiWhenDontExist = requestSendsResponse(get, getResponse);

    assertNull(apiWhenDontExist.getPolicyApi().get("name"));
  }
  public void testListTypesWhenResponseIs404() throws Exception {

    HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();

    ELBApi apiWhenDontExist = requestSendsResponse(listTypes, listResponse);

    apiWhenDontExist.getPolicyApi().listTypes();
  }
  public void testGetWhenResponseIs2xx() throws Exception {

    HttpResponse getResponse =
        HttpResponse.builder()
            .statusCode(200)
            .payload(payloadFromResourceWithContentType("/describe_policy.xml", "text/xml"))
            .build();

    ELBApi apiWhenExist = requestSendsResponse(get, getResponse);

    assertEquals(
        apiWhenExist.getPolicyApi().get("name").toString(),
        new GetPolicyResponseTest().expected().toString());
  }
  public void testListTypeWhenResponseIs2xx() throws Exception {

    HttpResponse listResponse =
        HttpResponse.builder()
            .statusCode(200)
            .payload(payloadFromResourceWithContentType("/describe_policy_types.xml", "text/xml"))
            .build();

    ELBApi apiWhenExist = requestSendsResponse(listTypes, listResponse);

    assertEquals(
        apiWhenExist.getPolicyApi().listTypes().toString(),
        new DescribeLoadBalancerPolicyTypesResponseTest().expected().toString());
  }