InteractionRequest.Builder

public static class InteractionRequest.Builder
extends Object

java.lang.Object
   ↳ android.support.test.espresso.remote.InteractionRequest.Builder


Creates an instance of InteractionRequest from a View matcher and action.

Summary

Public constructors

InteractionRequest.Builder()

Creates a new InteractionRequest.Builder instance.

Public methods

InteractionRequest build()

Builds an InteractionRequest object.

InteractionRequest.Builder setRequestProto(byte[] protoByteArray)

Set the result proto as a byte array.

InteractionRequest.Builder setRootMatcher(Matcher<Root> rootMatcher)

Sets the root matcher for this InteractionRequest

InteractionRequest.Builder setViewAction(ViewAction viewAction)

Sets the ViewAction for this InteractionRequest

InteractionRequest.Builder setViewAssertion(ViewAssertion viewAssertion)

Sets the ViewAssertion for this InteractionRequest

InteractionRequest.Builder setViewMatcher(Matcher<View> viewMatcher)

Sets the view matcher for this InteractionRequest

Inherited methods

From class java.lang.Object

Public constructors

InteractionRequest.Builder

InteractionRequest.Builder ()

Creates a new InteractionRequest.Builder instance.

Public methods

build

InteractionRequest build ()

Builds an InteractionRequest object.

Returns
InteractionRequest an InteractionRequest object.

Throws
IllegalStateException when conflicting properties are set. You can either set a ERROR(/Matcher) and a ViewAction or set the proto byte array but not both. Setting all values would result in an override, therefore setting both properties will result in an exception.
RemoteProtocolException when the provided proto byte array cannot be parsed into a protocol buffer of type UiInteraction.InteractionRequestProto

setRequestProto

InteractionRequest.Builder setRequestProto (byte[] protoByteArray)

Set the result proto as a byte array. This byte array will be parsed into an UiInteraction.InteractionRequestProto. Providing an invalid byte array will result in a RemoteProtocolException when the build() method is called!

Parameters
protoByteArray byte: the proto byte array to set

Returns
InteractionRequest.Builder fluent interface InteractionRequest.Builder

setRootMatcher

InteractionRequest.Builder setRootMatcher (Matcher<Root> rootMatcher)

Sets the root matcher for this InteractionRequest

Parameters
rootMatcher Matcher: the root matcher to set

Returns
InteractionRequest.Builder fluent interface

See also:

setViewAction

InteractionRequest.Builder setViewAction (ViewAction viewAction)

Sets the ViewAction for this InteractionRequest

Parameters
viewAction ViewAction: the view action to set

Returns
InteractionRequest.Builder fluent interface

Throws
IllegalStateException if a ViewAssertion was already set through setViewAssertion(ViewAssertion) before. InteractionRequest supports only one of ViewAction or ViewAssertion, but not both.

setViewAssertion

InteractionRequest.Builder setViewAssertion (ViewAssertion viewAssertion)

Sets the ViewAssertion for this InteractionRequest

Parameters
viewAssertion ViewAssertion: the view action to set

Returns
InteractionRequest.Builder fluent interface

Throws
IllegalStateException if a ViewAction was already set through setViewAction(ViewAction) before. InteractionRequest supports only one of ViewAction or ViewAssertion, but not both.

setViewMatcher

InteractionRequest.Builder setViewMatcher (Matcher<View> viewMatcher)

Sets the view matcher for this InteractionRequest

Parameters
viewMatcher Matcher: the view matcher to set

Returns
InteractionRequest.Builder fluent interface