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

chore(deps): update project.http.version to v1.36.0 #1505

Closed
wants to merge 10 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ public void testFrom_noDetails() throws Exception {
transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
request.setThrowExceptionOnExecuteError(false);
HttpResponse response = request.execute();
GoogleJsonResponseException ge =
GoogleJsonResponseException responseException =
GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response);
assertNull(ge.getDetails());
assertTrue(ge.getMessage().startsWith("200"));
assertNull(responseException.getDetails());
String expectedMessage = "200\nGET " + HttpTesting.SIMPLE_GENERIC_URL;
assertEquals(expectedMessage, responseException.getMessage());
}

public void testFrom_withDetails() throws Exception {
Expand All @@ -51,10 +52,15 @@ public void testFrom_withDetails() throws Exception {
transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
request.setThrowExceptionOnExecuteError(false);
HttpResponse response = request.execute();
GoogleJsonResponseException ge =
GoogleJsonResponseException responseException =
GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response);
assertEquals(GoogleJsonErrorTest.ERROR, GoogleJsonErrorTest.FACTORY.toString(ge.getDetails()));
assertTrue(ge.getMessage().startsWith("403"));
assertEquals(
GoogleJsonErrorTest.ERROR,
GoogleJsonErrorTest.FACTORY.toString(responseException.getDetails()));
String expectedMessage =
"403\nGET " + HttpTesting.SIMPLE_GENERIC_URL + StringUtils.LINE_SEPARATOR + "{";
assertTrue(
responseException.getMessage(), responseException.getMessage().startsWith(expectedMessage));
}

public void testFrom_detailsMissingContent() throws Exception {
Expand All @@ -63,10 +69,11 @@ public void testFrom_detailsMissingContent() throws Exception {
transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
request.setThrowExceptionOnExecuteError(false);
HttpResponse response = request.execute();
GoogleJsonResponseException ge =
GoogleJsonResponseException responseException =
GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response);
assertNull(ge.getDetails());
assertTrue(ge.getMessage().startsWith("403"));
assertNull(responseException.getDetails());
String expectedMessage = "403\nGET " + HttpTesting.SIMPLE_GENERIC_URL;
assertEquals(expectedMessage, responseException.getMessage());
}

public void testFrom_detailsArbitraryJsonContent() throws Exception {
Expand All @@ -75,10 +82,11 @@ public void testFrom_detailsArbitraryJsonContent() throws Exception {
transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
request.setThrowExceptionOnExecuteError(false);
HttpResponse response = request.execute();
GoogleJsonResponseException ge =
GoogleJsonResponseException responseException =
GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response);
assertNull(ge.getDetails());
assertTrue(ge.getMessage().startsWith("403"));
assertNull(responseException.getDetails());
String expectedMessage = "403\nGET " + HttpTesting.SIMPLE_GENERIC_URL;
assertEquals(expectedMessage, responseException.getMessage());
}

public void testFrom_detailsArbitraryXmlContent() throws Exception {
Expand All @@ -87,11 +95,13 @@ public void testFrom_detailsArbitraryXmlContent() throws Exception {
transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
request.setThrowExceptionOnExecuteError(false);
HttpResponse response = request.execute();
GoogleJsonResponseException ge =
GoogleJsonResponseException responseException =
GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response);
assertNull(ge.getDetails());
assertTrue(ge.getMessage().startsWith("403"));
assertTrue(ge.getMessage().contains("<foo>"));
assertNull(responseException.getDetails());
String expectedMessage =
"403\nGET " + HttpTesting.SIMPLE_GENERIC_URL + StringUtils.LINE_SEPARATOR + "<";
assertTrue(
responseException.getMessage(), responseException.getMessage().startsWith(expectedMessage));
}

public void testFrom_errorNoContentButWithJsonContentType() throws Exception {
Expand All @@ -100,10 +110,11 @@ public void testFrom_errorNoContentButWithJsonContentType() throws Exception {
transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
request.setThrowExceptionOnExecuteError(false);
HttpResponse response = request.execute();
GoogleJsonResponseException ge =
GoogleJsonResponseException responseException =
GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response);
assertNull(ge.getDetails());
assertTrue(ge.getMessage().startsWith("403"));
assertNull(responseException.getDetails());
String expectedMessage = "403\nGET " + HttpTesting.SIMPLE_GENERIC_URL;
assertEquals(expectedMessage, responseException.getMessage());
}

public void testFrom_errorEmptyContentButWithJsonContentType() throws Exception {
Expand All @@ -112,10 +123,11 @@ public void testFrom_errorEmptyContentButWithJsonContentType() throws Exception
transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
request.setThrowExceptionOnExecuteError(false);
HttpResponse response = request.execute();
GoogleJsonResponseException ge =
GoogleJsonResponseException responseException =
GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response);
assertNull(ge.getDetails());
assertTrue(ge.getMessage().startsWith("403"));
assertNull(responseException.getDetails());
String expectedMessage = "403\nGET " + HttpTesting.SIMPLE_GENERIC_URL;
assertEquals(expectedMessage, responseException.getMessage());
}

public void testFrom_detailsErrorObject() throws Exception {
Expand All @@ -124,11 +136,11 @@ public void testFrom_detailsErrorObject() throws Exception {
transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
request.setThrowExceptionOnExecuteError(false);
HttpResponse response = request.execute();
GoogleJsonResponseException ge =
GoogleJsonResponseException responseException =
GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response);
assertNotNull(ge.getDetails());
assertEquals("invalid_token", ge.getDetails().getMessage());
assertTrue(ge.getMessage().contains("403"));
assertNotNull(responseException.getDetails());
assertEquals("invalid_token", responseException.getDetails().getMessage());
assertTrue(responseException.getMessage().contains("403"));
}

public void testFrom_detailsErrorString() throws Exception {
Expand All @@ -137,11 +149,11 @@ public void testFrom_detailsErrorString() throws Exception {
transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
request.setThrowExceptionOnExecuteError(false);
HttpResponse response = request.execute();
GoogleJsonResponseException ge =
GoogleJsonResponseException responseException =
GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response);
assertNull(ge.getDetails());
assertTrue(ge.getMessage().contains("403"));
assertTrue(ge.getMessage().contains("invalid_token"));
assertNull(responseException.getDetails());
assertTrue(responseException.getMessage().contains("403"));
assertTrue(responseException.getMessage().contains("invalid_token"));
}

public void testFrom_detailsNoErrorField() throws Exception {
Expand All @@ -150,9 +162,11 @@ public void testFrom_detailsNoErrorField() throws Exception {
transport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL);
request.setThrowExceptionOnExecuteError(false);
HttpResponse response = request.execute();
GoogleJsonResponseException ge =
GoogleJsonResponseException responseException =
GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response);
assertNull(ge.getDetails());
assertTrue(ge.getMessage().startsWith("403"));
assertNull(responseException.getDetails());
String expectedMessage = "403\nGET " + HttpTesting.SIMPLE_GENERIC_URL;
assertEquals(expectedMessage, responseException.getMessage());
}

}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.http.version>1.35.0</project.http.version>
<project.http.version>1.36.0</project.http.version>
<project.oauth.version>1.31.0</project.oauth.version>
<project.jsr305.version>3.0.2</project.jsr305.version>
<project.gson.version>2.8.6</project.gson.version>
Expand Down