Skip to content
Browse files
fix: future test breakage (#1457)
In a a future commit the wrapping of these InputStreams will change.
This should ensure the tests will still pass while at the same time
validating the raw InputStream behavior still works.
  • Loading branch information
codyoss committed Dec 18, 2019
1 parent b79be2d commit e7d5c831a9d5c72206af6322142c338585698a78
Showing with 7 additions and 8 deletions.
  1. +7 −8 ...ient/src/test/java/com/google/api/client/googleapis/services/
@@ -281,7 +281,8 @@ public LowLevelHttpResponse execute() {
MockGoogleClientRequest<String> request = new MockGoogleClientRequest<String>(
client, HttpMethods.GET, URI_TEMPLATE, null, String.class);
InputStream inputStream = request.executeAsInputStream();
assertTrue(inputStream instanceof GZIPInputStream);
// The response will be wrapped because of gzip encoding
assertFalse(inputStream instanceof ByteArrayInputStream);

public void testReturnRawInputStream_True() throws Exception {
@@ -291,12 +292,9 @@ public LowLevelHttpRequest buildRequest(final String method, final String url) {
return new MockLowLevelHttpRequest() {
public LowLevelHttpResponse execute() {
byte[] data = BaseEncoding.base64().decode(
ByteArrayInputStream content = new ByteArrayInputStream(data);
return new MockLowLevelHttpResponse()
return new MockLowLevelHttpResponse().setContentEncoding("gzip").setContent(new ByteArrayInputStream(
@@ -308,7 +306,8 @@ public LowLevelHttpResponse execute() {
client, HttpMethods.GET, URI_TEMPLATE, null, String.class);
InputStream inputStream = request.executeAsInputStream();
assertFalse(inputStream instanceof GZIPInputStream);
// The response will not be wrapped due to setReturnRawInputStream(true)
assertTrue(inputStream instanceof ByteArrayInputStream);

private class AssertHeaderTransport extends MockHttpTransport {

0 comments on commit e7d5c83

Please sign in to comment.