IntentStubber
interface IntentStubber
Interface to intercept activity launch for a given android.content.Intent and stub ActivityResult its response.
Retrieve instances of the stubber through IntentStubberRegistry
Stubbing intents requires support from Instrumentation, therefore do not expect an instance to be present under any arbitrary instrumentation.
Summary
Public methods |
|
---|---|
abstract @NonNull ActivityResult |
getActivityResultForIntent(@NonNull Intent intent) Returns the first matching stubbed result for the given activity if stubbed result was set by test author. |
Public methods
getActivityResultForIntent
@NonNull
public abstract ActivityResult getActivityResultForIntent(@NonNull Intent intent)
Returns the first matching stubbed result for the given activity if stubbed result was set by test author. The method searches the list of existing matcher/response pairs in reverse order of which they were entered; i.e. the last stubbing has the highest priority. If no stubbed result matching the given intent is found, null
is returned.
Must be called on main thread.