Skip to content
Permalink
Browse files
fix: add details to GoogleJsonResponseExceptions created with GoogleJ…
…sonResponseExceptionFactoryTesting (#1395)

* Add details to GoogleJsonResponseExceptions created with GoogleJsonResponseExceptionFactoryTesting

* Add import
  • Loading branch information
SUPERCILEX authored and chingor13 committed Oct 21, 2019
1 parent 420d9da commit 1ffdba6071d716d9843fada802c3cb4d2dcaedf7
Showing with 5 additions and 1 deletion.
  1. +5 −1 ...java/com/google/api/client/googleapis/testing/json/GoogleJsonResponseExceptionFactoryTesting.java
@@ -17,6 +17,7 @@
import com.google.api.client.googleapis.json.GoogleJsonResponseException;
import com.google.api.client.http.HttpRequest;
import com.google.api.client.http.HttpResponse;
import com.google.api.client.json.Json;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.testing.http.HttpTesting;
import com.google.api.client.testing.http.MockHttpTransport;
@@ -59,7 +60,10 @@ public static GoogleJsonResponseException newMock(JsonFactory jsonFactory,
MockLowLevelHttpResponse otherServiceUnavaiableLowLevelResponse =
new MockLowLevelHttpResponse()
.setStatusCode(httpCode)
.setReasonPhrase(reasonPhrase);
.setReasonPhrase(reasonPhrase)
.setContentType(Json.MEDIA_TYPE)
.setContent("{ \"error\": { \"errors\": [ { \"reason\": \"" + reasonPhrase + "\" } ], " +
"\"code\": " + httpCode + " } }");
MockHttpTransport otherTransport = new MockHttpTransport.Builder()
.setLowLevelHttpResponse(otherServiceUnavaiableLowLevelResponse)
.build();

0 comments on commit 1ffdba6

Please sign in to comment.