# ResettingStubber

Summary:[Methods](https://developer.android.com/reference/android/support/test/espresso/intent/ResettingStubber#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/test/espresso/intent/ResettingStubber#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/test/espresso/intent/ResettingStubber#)  

# ResettingStubber

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public


interface
ResettingStubber
`  
`


implements

`[IntentStubber](https://developer.android.com/reference/android/support/test/runner/intent/IntentStubber)`


`

|-------------------------------------------------------|
| android.support.test.espresso.intent.ResettingStubber |

|---|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/espresso/intent/ResettingStubber#)Known Indirect Subclasses [ResettingStubberImpl](https://developer.android.com/reference/android/support/test/espresso/intent/ResettingStubberImpl) |---------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------| | [ResettingStubberImpl](https://developer.android.com/reference/android/support/test/espresso/intent/ResettingStubberImpl) | Implementation of[ResettingStubber](https://developer.android.com/reference/android/support/test/espresso/intent/ResettingStubber) | ||

<br />

*** ** * ** ***

A sneaky singleton object used to respond to intents with fake responses. This interface is not meant for public consumption. Test authors should use[Intents](https://developer.android.com/reference/android/support/test/espresso/intent/Intents)instead.

## Summary

|                                                                                                                                                                                                                                                                                                                                                    ### Public methods                                                                                                                                                                                                                                                                                                                                                    ||
|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` abstract void`    | ` `[initialize](https://developer.android.com/reference/android/support/test/espresso/intent/ResettingStubber#initialize())`() ` Marks this spy as initialized.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ` abstract boolean` | ` `[isInitialized](https://developer.android.com/reference/android/support/test/espresso/intent/ResettingStubber#isInitialized())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` abstract void`    | ` `[reset](https://developer.android.com/reference/android/support/test/espresso/intent/ResettingStubber#reset())`() ` Clears state (initialization, expected responses).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ` abstract void`    | ` `[setActivityResultForIntent](https://developer.android.com/reference/android/support/test/espresso/intent/ResettingStubber#setActivityResultForIntent(org.hamcrest.Matcher<android.content.Intent>, android.app.Instrumentation.ActivityResult))`(Matcher<`[Intent](https://developer.android.com/reference/android/content/Intent.html)`> matcher, `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html)` result) ` Sets the result that will be returned to the intent sender (if the sender expects the result), next time an intent matched by the given matcher is launched.                                           |
| ` abstract void`    | ` `[setActivityResultFunctionForIntent](https://developer.android.com/reference/android/support/test/espresso/intent/ResettingStubber#setActivityResultFunctionForIntent(org.hamcrest.Matcher<android.content.Intent>, android.support.test.espresso.intent.ActivityResultFunction))`(Matcher<`[Intent](https://developer.android.com/reference/android/content/Intent.html)`> matcher, `[ActivityResultFunction](https://developer.android.com/reference/android/support/test/espresso/intent/ActivityResultFunction)` result) ` Sets a result function that will be called by the intent sender (if the sender expects the result), next time an intent matched by the given matcher is launched. |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/espresso/intent/ResettingStubber#)From interface` `[android.support.test.runner.intent.IntentStubber](https://developer.android.com/reference/android/support/test/runner/intent/IntentStubber)` ` |---------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract `[Instrumentation.ActivityResult](https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html) | ` `[getActivityResultForIntent](https://developer.android.com/reference/android/support/test/runner/intent/IntentStubber#getActivityResultForIntent(android.content.Intent))`(`[Intent](https://developer.android.com/reference/android/content/Intent.html)` intent) ` Returns the first matching stubbed result for the given activity if stubbed result was set by test author. | ||

## Public methods

### initialize

```
void initialize ()
```

Marks this spy as initialized. Once initialized, ResettingStubber begins recording intents and provides intent stubbing.

<br />

### isInitialized

```
boolean isInitialized ()
```

<br />

<br />

|                      Returns                       ||
|-----------|-----------------------------------------|
| `boolean` | `true`if this spy is initialized <br /> |

### reset

```
void reset ()
```

Clears state (initialization, expected responses).

Must be called on main thread.

<br />

### setActivityResultForIntent

```
void setActivityResultForIntent (Matcher<Intent> matcher, 
                Instrumentation.ActivityResult result)
```

Sets the result that will be returned to the intent sender (if the sender expects the result), next time an intent matched by the given matcher is launched.

<br />

|                     Parameters                     ||
|-----------|-----------------------------------------|
| `matcher` | `Matcher` <br />                        |
| `result`  | `Instrumentation.ActivityResult` <br /> |

### setActivityResultFunctionForIntent

```
void setActivityResultFunctionForIntent (Matcher<Intent> matcher, 
                ActivityResultFunction result)
```

Sets a result function that will be called by the intent sender (if the sender expects the result), next time an intent matched by the given matcher is launched.

<br />

|                 Parameters                 ||
|-----------|---------------------------------|
| `matcher` | `Matcher` <br />                |
| `result`  | `ActivityResultFunction` <br /> |

-

  ## Interfaces

  - [ActivityResultFunction](https://developer.android.com/reference/android/support/test/espresso/intent/ActivityResultFunction)
  - [ResettingStubber](https://developer.android.com/reference/android/support/test/espresso/intent/ResettingStubber)
  - [ResolvedIntent](https://developer.android.com/reference/android/support/test/espresso/intent/ResolvedIntent)
  - [VerifiableIntent](https://developer.android.com/reference/android/support/test/espresso/intent/VerifiableIntent)
  - [VerificationMode](https://developer.android.com/reference/android/support/test/espresso/intent/VerificationMode)
-

  ## Classes

  - [Checks](https://developer.android.com/reference/android/support/test/espresso/intent/Checks)
  - [Intents](https://developer.android.com/reference/android/support/test/espresso/intent/Intents)
  - [OngoingStubbing](https://developer.android.com/reference/android/support/test/espresso/intent/OngoingStubbing)
  - [ResettingStubberImpl](https://developer.android.com/reference/android/support/test/espresso/intent/ResettingStubberImpl)
  - [VerificationModes](https://developer.android.com/reference/android/support/test/espresso/intent/VerificationModes)