InteractionRequest.Builder
public
static
class
InteractionRequest.Builder
extends Object
java.lang.Object | |
↳ | androidx.test.espresso.remote.InteractionRequest.Builder |
Creates an instance of InteractionRequest
from a View matcher and action.
Summary
Public constructors | |
---|---|
Builder()
Creates a new |
Public methods | |
---|---|
InteractionRequest
|
build()
Builds an |
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.Builder
|
setViewAction(ViewAction viewAction)
Sets the |
InteractionRequest.Builder
|
setViewAssertion(ViewAssertion viewAssertion)
Sets the |
InteractionRequest.Builder
|
setViewMatcher(Matcher<View> viewMatcher)
Sets the view matcher for this |
Inherited methods | |
---|---|
Public constructors
Public methods
build
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 UiInteraction.InteractionRequestProto
|
setRequestProto
public 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
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:
setViewAction
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.
|
setViewAssertion
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.
|
setViewMatcher
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 |