Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void testFrom_noDetails() throws Exception {
GoogleJsonResponseException ge =
GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response);
assertNull(ge.getDetails());
assertEquals("200", ge.getMessage());
assertTrue(ge.getMessage().startsWith("200"));
}

public void testFrom_withDetails() throws Exception {
Expand All @@ -54,8 +54,7 @@ public void testFrom_withDetails() throws Exception {
GoogleJsonResponseException ge =
GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response);
assertEquals(GoogleJsonErrorTest.ERROR, GoogleJsonErrorTest.FACTORY.toString(ge.getDetails()));
assertTrue(
ge.getMessage(), ge.getMessage().startsWith("403" + StringUtils.LINE_SEPARATOR + "{"));
assertTrue(ge.getMessage().startsWith("403"));
}

public void testFrom_detailsMissingContent() throws Exception {
Expand All @@ -67,7 +66,7 @@ public void testFrom_detailsMissingContent() throws Exception {
GoogleJsonResponseException ge =
GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response);
assertNull(ge.getDetails());
assertEquals("403", ge.getMessage());
assertTrue(ge.getMessage().startsWith("403"));
}

public void testFrom_detailsArbitraryJsonContent() throws Exception {
Expand All @@ -79,7 +78,7 @@ public void testFrom_detailsArbitraryJsonContent() throws Exception {
GoogleJsonResponseException ge =
GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response);
assertNull(ge.getDetails());
assertEquals("403", ge.getMessage());
assertTrue(ge.getMessage().startsWith("403"));
}

public void testFrom_detailsArbitraryXmlContent() throws Exception {
Expand All @@ -91,8 +90,8 @@ public void testFrom_detailsArbitraryXmlContent() throws Exception {
GoogleJsonResponseException ge =
GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response);
assertNull(ge.getDetails());
assertTrue(
ge.getMessage(), ge.getMessage().startsWith("403" + StringUtils.LINE_SEPARATOR + "<"));
assertTrue(ge.getMessage().startsWith("403"));
assertTrue(ge.getMessage().contains("<foo>"));
}

public void testFrom_errorNoContentButWithJsonContentType() throws Exception {
Expand All @@ -104,7 +103,7 @@ public void testFrom_errorNoContentButWithJsonContentType() throws Exception {
GoogleJsonResponseException ge =
GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response);
assertNull(ge.getDetails());
assertEquals("403", ge.getMessage());
assertTrue(ge.getMessage().startsWith("403"));
}

public void testFrom_errorEmptyContentButWithJsonContentType() throws Exception {
Expand All @@ -116,7 +115,7 @@ public void testFrom_errorEmptyContentButWithJsonContentType() throws Exception
GoogleJsonResponseException ge =
GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response);
assertNull(ge.getDetails());
assertEquals("403", ge.getMessage());
assertTrue(ge.getMessage().startsWith("403"));
}

public void testFrom_detailsErrorObject() throws Exception {
Expand Down Expand Up @@ -154,6 +153,6 @@ public void testFrom_detailsNoErrorField() throws Exception {
GoogleJsonResponseException ge =
GoogleJsonResponseException.from(GoogleJsonErrorTest.FACTORY, response);
assertNull(ge.getDetails());
assertEquals("403", ge.getMessage());
assertTrue(ge.getMessage().startsWith("403"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@
import com.google.api.client.testing.http.MockHttpTransport;
import com.google.api.client.testing.http.MockLowLevelHttpRequest;
import com.google.api.client.testing.http.MockLowLevelHttpResponse;
import com.google.api.client.util.StringUtils;
import com.google.common.io.BaseEncoding;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.zip.GZIPInputStream;
import junit.framework.TestCase;

/**
Expand Down Expand Up @@ -106,7 +104,7 @@ public LowLevelHttpResponse execute() {
fail("expected " + HttpResponseException.class);
} catch (HttpResponseException e) {
// expected
assertEquals("401" + StringUtils.LINE_SEPARATOR + ERROR_CONTENT, e.getMessage());
assertTrue(e.getMessage().startsWith("401"));
}
}

Expand Down
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.34.2</project.http.version>
<project.http.version>1.35.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