Skip to content

Commit

Permalink
fix: add details to GoogleJsonResponseExceptions created with GoogleJ…
Browse files Browse the repository at this point in the history
…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 1ffdba6
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 1ffdba6

Please sign in to comment.