# ResettingStubberImpl

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/ResettingStubberImpl.java+class:androidx.test.espresso.intent.ResettingStubberImpl)

*** ** * ** ***


```
class ResettingStubberImpl : ResettingStubber
```

<br />

*** ** * ** ***

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

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/test/espresso/intent/ResettingStubberImpl#ResettingStubberImpl()()` |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html!` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/intent/ResettingStubberImpl#getActivityResultForIntent(android.content.Intent)(intent: https://developer.android.com/reference/android/content/Intent.html!)` Returns the first matching stubbed result for the given activity if stubbed result was set by test author. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/intent/ResettingStubberImpl#initialize()()` Marks this spy as initialized. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/intent/ResettingStubberImpl#reset()()` Clears state (initialization, expected responses). |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/intent/ResettingStubberImpl#setActivityResultForIntent(org.hamcrest.Matcher<android.content.Intent>,android.app.Instrumentation.ActivityResult)( matcher: https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://developer.android.com/reference/android/content/Intent.html!>!, result: https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html! )` 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. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/intent/ResettingStubberImpl#setActivityResultFunctionForIntent(org.hamcrest.Matcher<android.content.Intent>,androidx.test.espresso.intent.ActivityResultFunction)( matcher: https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://developer.android.com/reference/android/content/Intent.html!>!, result: https://developer.android.com/reference/kotlin/androidx/test/espresso/intent/ActivityResultFunction! )` 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. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/intent/ResettingStubberImpl#isInitialized()` |

## Public constructors

### ResettingStubberImpl

```
ResettingStubberImpl()
```

## Public functions

### getActivityResultForIntent

```
fun getActivityResultForIntent(intent: Intent!): Instrumentation.ActivityResult!
```

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.

### initialize

```
fun initialize(): Unit
```

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

### reset

```
fun reset(): Unit
```

Clears state (initialization, expected responses).

Must be called on main thread.

### setActivityResultForIntent

```
fun setActivityResultForIntent(
    matcher: Matcher<Intent!>!,
    result: Instrumentation.ActivityResult!
): Unit
```

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

```
fun setActivityResultFunctionForIntent(
    matcher: Matcher<Intent!>!,
    result: ActivityResultFunction!
): Unit
```

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.

## Public properties

### isInitialized

```
val isInitialized: Boolean
```