Class MockHttpTransportHelper

java.lang.Object
com.google.cloud.hadoop.util.testing.MockHttpTransportHelper

public final class MockHttpTransportHelper extends Object
Utility methods for testing with MockHttpTransport
  • Method Details

    • mockTransport

      public static com.google.api.client.testing.http.MockHttpTransport mockTransport(Object... responsesIn)
    • mockBatchTransport

      public static com.google.api.client.testing.http.MockHttpTransport mockBatchTransport(int requestsPerBatch, com.google.api.client.http.LowLevelHttpResponse... responses)
    • emptyResponse

      public static com.google.api.client.testing.http.MockLowLevelHttpResponse emptyResponse(int statusCode)
    • dataRangeResponse

      public static com.google.api.client.testing.http.MockLowLevelHttpResponse dataRangeResponse(byte[] content, long rangeStart, long totalSize)
    • jsonDataResponse

      public static com.google.api.client.testing.http.MockLowLevelHttpResponse jsonDataResponse(Object object) throws IOException
      Throws:
      IOException
    • dataResponse

      public static com.google.api.client.testing.http.MockLowLevelHttpResponse dataResponse(byte[] content)
    • dataResponse

      public static com.google.api.client.testing.http.MockLowLevelHttpResponse dataResponse(Map<String,Object> headers, byte[] content)
    • jsonErrorResponse

      public static com.google.api.client.testing.http.MockLowLevelHttpResponse jsonErrorResponse(MockHttpTransportHelper.ErrorResponses errorResponse) throws IOException
      Throws:
      IOException
    • inputStreamResponse

      public static com.google.api.client.testing.http.MockLowLevelHttpResponse inputStreamResponse(String header, Object headerValue, InputStream content)
    • inputStreamResponse

      public static com.google.api.client.testing.http.MockLowLevelHttpResponse inputStreamResponse(InputStream content)
    • inputStreamResponse

      public static com.google.api.client.testing.http.MockLowLevelHttpResponse inputStreamResponse(Map<String,Object> headers, InputStream content)
    • arbitraryInputStreamSupplier

      public static com.google.api.client.testing.http.MockLowLevelHttpResponse arbitraryInputStreamSupplier(Supplier<InputStream> supplier)
      Return an arbitrary InputStream supplier. This function should only be used to simulate arbitrary runtime behavior when calling execute and executeMedia.