2.9.3 (latest) 2.9.2 2.8.1 2.7.2 2.6.0 2.5.1 2.4.1 2.1.2 2.0.1 1.35.2 1.34.1 1.33.4

```java
public final class GoogleJsonResponseExceptionFactoryTesting
```
Beta   

Factory class that builds [GoogleJsonResponseException](https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.json.GoogleJsonResponseException.md.txt) instances for testing.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> GoogleJsonResponseExceptionFactoryTesting

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Static Methods

### newMock(JsonFactory jsonFactory, int httpCode, String reasonPhrase)

```java
public static GoogleJsonResponseException newMock(JsonFactory jsonFactory, int httpCode, String reasonPhrase)
```
Convenience factory method that builds a [GoogleJsonResponseException](https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.json.GoogleJsonResponseException.md.txt) 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](https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.json.GoogleJsonResponseException.md.txt), which the method retrieves and returns to the invoker.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `jsonFactory` | `com.google.api.client.json.JsonFactory` the JSON factory that will create all JSON required by the underlying framework |
| `httpCode` | `int` the desired HTTP error code. Note: do nut specify any codes that indicate successful completion, e.g. 2XX. |
| `reasonPhrase` | `String` the HTTP reason code that explains the error. For example, if ` httpCode` is `404`, the reason phrase should be `NOT FOUND`. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `GoogleJsonResponseException` | the generated [GoogleJsonResponseException](https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.json.GoogleJsonResponseException.md.txt), as specified. |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `IOException` | if request transport fails. |

## Constructors

### GoogleJsonResponseExceptionFactoryTesting()

```java
public GoogleJsonResponseExceptionFactoryTesting()
```