# ResettingStubber

Artifact: [androidx.test.espresso:espresso-intents](https://developer.android.com/jetpack/androidx/releases/test-espresso) [View Source](https://cs.android.com/search?q=file:androidx/test/espresso/intent/ResettingStubber.java+class:androidx.test.espresso.intent.ResettingStubber)

*** ** * ** ***


```
public interface ResettingStubber extends IntentStubber
```

<br />

Known direct subclasses [ResettingStubberImpl](https://developer.android.com/reference/androidx/test/espresso/intent/ResettingStubberImpl)

|---|---|
| `https://developer.android.com/reference/androidx/test/espresso/intent/ResettingStubberImpl` | Implementation of `https://developer.android.com/reference/androidx/test/espresso/intent/ResettingStubber` |

*** ** * ** ***

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

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/test/espresso/intent/ResettingStubber#initialize()()` Marks this spy as initialized. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/test/espresso/intent/ResettingStubber#isInitialized()()` |
| `abstract void` | `https://developer.android.com/reference/androidx/test/espresso/intent/ResettingStubber#reset()()` Clears state (initialization, expected responses). |
| `abstract void` | `https://developer.android.com/reference/androidx/test/espresso/intent/ResettingStubber#setActivityResultForIntent(org.hamcrest.Matcher<android.content.Intent>,android.app.Instrumentation.ActivityResult)( https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://developer.android.com/reference/android/content/Intent.html> matcher, 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` | `https://developer.android.com/reference/androidx/test/espresso/intent/ResettingStubber#setActivityResultFunctionForIntent(org.hamcrest.Matcher<android.content.Intent>,androidx.test.espresso.intent.ActivityResultFunction)( https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://developer.android.com/reference/android/content/Intent.html> matcher, https://developer.android.com/reference/androidx/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 |
|---|
| From [androidx.test.runner.intent.IntentStubber](https://developer.android.com/reference/androidx/test/runner/intent/IntentStubber) |---|---| | `abstract https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html` | `https://developer.android.com/reference/androidx/test/runner/intent/IntentStubber#getActivityResultForIntent(android.content.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

```
abstract void initialize()
```

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

### isInitialized

```
abstract boolean isInitialized()
```

| Returns |
|---|---|
| `boolean` | `true` if this spy is initialized |

### reset

```
abstract void reset()
```

Clears state (initialization, expected responses).

Must be called on main thread.

### setActivityResultForIntent

```
abstract 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.

### setActivityResultFunctionForIntent

```
abstract 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.