public static class

InteractionRequest.Builder

extends Object
java.lang.Object
   ↳ androidx.test.espresso.remote.InteractionRequest.Builder

Class Overview

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)
InteractionRequest.Builder setViewMatcher(Matcher<View> viewMatcher)
Sets the view matcher for this InteractionRequest
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public InteractionRequest.Builder ()

Creates a new InteractionRequest.Builder instance.

Public Methods

public 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 ERROR(/InteractionRequestProto)

public InteractionRequest.Builder setRequestProto (byte[] protoByteArray)

Set the result proto as a byte array. This byte array will be parsed into an ERROR(/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

public 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:

public 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.

public 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.

public 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