# InteractionResponse.Builder

Artifact: [androidx.test.espresso:espresso-remote](https://developer.android.com/jetpack/androidx/releases/test-espresso) [View Source](https://cs.android.com/search?q=file:androidx/test/espresso/remote/InteractionResponse.java+class:androidx.test.espresso.remote.InteractionResponse.Builder)

*** ** * ** ***


```
public class InteractionResponse.Builder
```

<br />

*** ** * ** ***

Builder for `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse`

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse.Builder#Builder()()` |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse` | `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse.Builder#build()()` Builds an `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse` object. |
| `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse.Builder` | `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse.Builder#setRemoteError(androidx.test.espresso.remote.InteractionResponse.RemoteError)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse.RemoteError remoteError)` Set the `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse.RemoteError` for this `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse` |
| `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse.Builder` | `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse.Builder#setResultProto(byte[])(@https://developer.android.com/reference/androidx/annotation/NonNull byte[] protoByteArray)` Set the result proto as a byte array. |
| `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse.Builder` | `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse.Builder#setStatus(androidx.test.espresso.remote.InteractionResponse.Status)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse.Status status)` |

## Public constructors

### Builder

```
public Builder()
```

## Public methods

### build

```
public InteractionResponse build()
```

Builds an `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse` object.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse` | an `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse` object. |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/test/espresso/remote/RemoteProtocolException` | when conflicting properties are set. You can either set an `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse.Status` with an optional `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse.RemoteError` error in case that the status is `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse.Status#Error` or set the proto byte array not both. Setting both values would result in an override, therefore setting both properties will result in an exception. |
| `https://developer.android.com/reference/androidx/test/espresso/remote/RemoteProtocolException` | when the provided proto byte array cannot be parsed into a protocol buffer of type |

### setRemoteError

```
public InteractionResponse.Builder setRemoteError(@Nullable InteractionResponse.RemoteError remoteError)
```

Set the `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse.RemoteError` for this `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse`

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse.RemoteError remoteError` | the remote error to set |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse.Builder` | fluent interface `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse.Builder` |

### setResultProto

```
public InteractionResponse.Builder setResultProto(@NonNull byte[] protoByteArray)
```

Set the result proto as a byte array. This byte array will be parsed into an . Providing an invalid byte byte array will result in a `https://developer.android.com/reference/androidx/test/espresso/remote/RemoteProtocolException` when the `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse.Builder#build()` method is called!

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull byte[] protoByteArray` | the proto byte array to set |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse.Builder` | fluent interface `https://developer.android.com/reference/androidx/test/espresso/remote/InteractionResponse.Builder` |

### setStatus

```
public InteractionResponse.Builder setStatus(@NonNull InteractionResponse.Status status)
```