Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: future test breakage #1457

Merged
merged 2 commits into from Dec 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -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 {
Expand All @@ -291,12 +292,9 @@ public LowLevelHttpRequest buildRequest(final String method, final String url) {
return new MockLowLevelHttpRequest() {
@Override
public LowLevelHttpResponse execute() {
byte[] data = BaseEncoding.base64().decode(
"H4sIAAAAAAAAAPNIzcnJV3DPz0/PSVVwzskvTVEILskvSkxPVQQA/LySchsAAAA=");
ByteArrayInputStream content = new ByteArrayInputStream(data);
return new MockLowLevelHttpResponse()
.setContentEncoding("gzip")
.setContent(content);
return new MockLowLevelHttpResponse().setContentEncoding("gzip").setContent(new ByteArrayInputStream(
BaseEncoding.base64()
.decode("H4sIAAAAAAAAAPNIzcnJV3DPz0/PSVVwzskvTVEILskvSkxPVQQA/LySchsAAAA=")));
}
};
}
Expand All @@ -308,7 +306,8 @@ public LowLevelHttpResponse execute() {
client, HttpMethods.GET, URI_TEMPLATE, null, String.class);
request.setReturnRawInputStream(true);
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 {
Expand Down