Examples of parseAsString()


Examples of com.google.api.client.http.HttpResponse.parseAsString()

      assertThat(HttpStatus.CREATED_201).isEqualTo(secondSequenceResponse.getStatusCode());
      assertThat(secondResponseContent).isEqualTo("Still going strong!");

      final HttpResponse thirdSequenceResponse = request.execute();
      final String thirdResponseContent = thirdSequenceResponse.parseAsString().trim();

      assertThat(HttpStatus.INTERNAL_SERVER_ERROR_500).isEqualTo(thirdSequenceResponse.getStatusCode());
      assertThat(thirdResponseContent).isEmpty();

      firstSequenceResponse = request.execute();
View Full Code Here

Examples of com.google.api.client.http.HttpResponse.parseAsString()

      final HttpRequest request = HttpUtils.constructHttpRequest(HttpMethods.POST, requestUrl, content);

      final HttpResponse response = request.execute();

      assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK_200);
      assertThat(response.parseAsString().trim()).isEqualTo("OK");
   }

   @SuppressWarnings("unchecked")
   @Test
   public void should_ReturnExpectedResourceIdHeader_WhenSuccessfulRequestMade() throws Exception {
View Full Code Here

Examples of com.google.api.client.http.HttpResponse.parseAsString()

   @Test
   public void should_ReturnReplacedTokenizedResponse_WhenCapturingGroupsEqualToNumberOfTokens() throws Exception {
      String requestUrl = String.format("%s%s", STUBS_URL, "/resources/invoices/12345/category/milk");
      HttpRequest request = HttpUtils.constructHttpRequest(HttpMethods.GET, requestUrl);
      HttpResponse response = request.execute();
      String responseContent = response.parseAsString().trim();

      assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK_200);
      assertThat(responseContent).isEqualTo("Returned invoice number# 12345 in category 'milk'");

View Full Code Here

Examples of com.google.api.client.http.HttpResponse.parseAsString()


      requestUrl = String.format("%s%s", STUBS_URL, "/resources/invoices/88888/category/army");
      request = HttpUtils.constructHttpRequest(HttpMethods.GET, requestUrl);
      response = request.execute();
      responseContent = response.parseAsString().trim();

      assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK_200);
      assertThat(responseContent).isEqualTo("Returned invoice number# 88888 in category 'army'");
   }
View Full Code Here

Examples of com.google.api.client.http.HttpResponse.parseAsString()

   @Test
   public void should_ReturnReplacedTokenizedResponse_WhenUsingExternalFile() throws Exception {
      String requestUrl = String.format("%s%s", STUBS_URL, "/account/12345/category/milk?date=Saturday");
      HttpRequest request = HttpUtils.constructHttpRequest(HttpMethods.GET, requestUrl);
      HttpResponse response = request.execute();
      String responseContent = response.parseAsString().trim();

      assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK_200);
      assertThat(responseContent).isEqualTo("Returned invoice number# 12345 in category 'milk' on the date 'Saturday'");

View Full Code Here

Examples of com.google.api.client.http.HttpResponse.parseAsString()


      requestUrl = String.format("%s%s", STUBS_URL, "/account/88888/category/army?date=NOW");
      request = HttpUtils.constructHttpRequest(HttpMethods.GET, requestUrl);
      response = request.execute();
      responseContent = response.parseAsString().trim();

      assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK_200);
      assertThat(responseContent).isEqualTo("Returned invoice number# 88888 in category 'army' on the date 'NOW'");
   }
View Full Code Here

Examples of com.google.api.client.http.HttpResponse.parseAsString()

      final String requestUrl = String.format("%s%s", STUBS_URL, "/resources/invoices/22222");
      final HttpRequest request = HttpUtils.constructHttpRequest(HttpMethods.GET, requestUrl);

      final HttpResponse response = request.execute();

      String responseContent = response.parseAsString().trim();
      assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK_200);
      assertThat(responseContent).isEqualTo("Returned invoice number# 22222 in category '<%url.2%>'");
   }

   @Test
View Full Code Here

Examples of com.google.api.client.http.HttpResponse.parseAsString()

      httpHeaders.set("custom-header", "XYZ");
      request.setHeaders(httpHeaders);

      final HttpResponse response = request.execute();

      String responseContent = response.parseAsString().trim();
      assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK_200);
      assertThat(responseContent).isEqualTo("Returned content with URL /no/explicit/groups/22222, query param ABC and custom-header XYZ");
   }

   @Test
View Full Code Here

Examples of com.google.api.client.http.HttpResponse.parseAsString()

   public void should_ReturnReplacedTokenizedResponse_WhenCapturingGroupHasSubgroups() throws Exception {
      final String requestUrl = String.format("%s%s", STUBS_URL, "/groups/with/sub/groups/abc-123");
      final HttpRequest request = HttpUtils.constructHttpRequest(HttpMethods.GET, requestUrl);
      final HttpResponse response = request.execute();

      String responseContent = response.parseAsString().trim();
      assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK_200);
      assertThat(responseContent).isEqualTo("Returned content with URL /groups/with/sub/groups/abc-123, parent group abc-123 and two sub-groups abc & 123");
   }

   @Test
View Full Code Here

Examples of com.google.api.client.http.HttpResponse.parseAsString()

   @Test
   public void should_MakeSuccessfulRequest_WhenGetRequestMadeWithNoEqualSignInQueryStringParam() throws Exception {

      final String requestUrl = String.format("%s%s", STUBS_URL, "/empty.param?type_name&client_secret=secret");
      final HttpResponse response = HttpUtils.constructHttpRequest(HttpMethods.GET, requestUrl).execute();
      final String responseContentAsString = response.parseAsString().trim();

      assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK_200);
      assertThat(responseContentAsString).contains("EMPTY WORKS");
   }
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.