Package com.google.api.client.http

Examples of com.google.api.client.http.HttpHeaders.containsKey()


      final HttpResponse response = request.execute();

      final HttpHeaders headers = response.getHeaders();
      assertThat(headers.getContentType().contains("application/json")).isTrue();
      assertThat(headers.containsKey(StubResponse.STUBBY_RESOURCE_ID_HEADER)).isTrue();
      final List<String> headerValues = (List<String>) headers.get(StubResponse.STUBBY_RESOURCE_ID_HEADER);
      assertThat(headerValues.get(0)).isEqualTo("1");
   }

   @Test
View Full Code Here


      final String stubsRequestUrl = String.format("%s%s", STUBS_URL, "/this/stub/should/always/be/second/in/this/file");
      final HttpRequest stubsGetRequest = HttpUtils.constructHttpRequest(HttpMethods.GET, stubsRequestUrl);
      final HttpResponse preDeletionStubGetResponse = stubsGetRequest.execute();
      final HttpHeaders preDeletionResponseHeaders = preDeletionStubGetResponse.getHeaders();
      assertThat(preDeletionResponseHeaders.containsKey(StubResponse.STUBBY_RESOURCE_ID_HEADER)).isTrue();
      assertThat(preDeletionResponseHeaders.getFirstHeaderStringValue(StubResponse.STUBBY_RESOURCE_ID_HEADER)).isEqualTo("1");

      final HttpRequest httpDeleteRequest = HttpUtils.constructHttpRequest(HttpMethods.DELETE, String.format("%s%s", ADMIN_URL, "/0"));
      final HttpResponse httpDeleteResponse = httpDeleteRequest.execute();
      final String deleteResponseContent = httpDeleteResponse.parseAsString().trim();
View Full Code Here

      assertThat(deleteResponseContent).isEqualTo("Stub request index#0 deleted successfully");

      final HttpRequest postDeletionStubGetRequest = HttpUtils.constructHttpRequest(HttpMethods.GET, stubsRequestUrl);
      final HttpResponse postDeletionStubGetResponse = postDeletionStubGetRequest.execute();
      final HttpHeaders postDeletionResponseHeaders = postDeletionStubGetResponse.getHeaders();
      assertThat(postDeletionResponseHeaders.containsKey(StubResponse.STUBBY_RESOURCE_ID_HEADER)).isTrue();
      assertThat(postDeletionResponseHeaders.getFirstHeaderStringValue(StubResponse.STUBBY_RESOURCE_ID_HEADER)).isEqualTo("0");
   }

   @Test
   public void should_ReturnAjaxRequestContent_WhenSuccessfulRequestMade() throws Exception {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.