@Beta public final class GoogleJsonResponseExceptionFactoryTesting extends Object
| Constructor and Description |
|---|
GoogleJsonResponseExceptionFactoryTesting() |
| Modifier and Type | Method and Description |
|---|---|
static GoogleJsonResponseException |
newMock(com.google.api.client.json.JsonFactory jsonFactory,
int httpCode,
String reasonPhrase)
Convenience factory method that builds a
GoogleJsonResponseException
from its arguments. |
public GoogleJsonResponseExceptionFactoryTesting()
public static GoogleJsonResponseException newMock(com.google.api.client.json.JsonFactory jsonFactory, int httpCode, String reasonPhrase) throws IOException
GoogleJsonResponseException
from its arguments. The method builds a dummy HttpRequest and
HttpResponse, sets the response's status to a user-specified HTTP
error code, suppresses exceptions, and executes the request. This forces
the underlying framework to create, but not throw, a
GoogleJsonResponseException, which the method retrieves and returns
to the invoker.jsonFactory - the JSON factory that will create all JSON required
by the underlying frameworkhttpCode - the desired HTTP error code. Note: do nut specify any codes
that indicate successful completion, e.g. 2XX.reasonPhrase - the HTTP reason code that explains the error. For example,
if httpCode is 404, the reason phrase should be
NOT FOUND.GoogleJsonResponseException, as specified.IOException - if request transport fails.Copyright © 2010–2019 Google. All rights reserved.