# ActivityResultMatchers

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

*** ** * ** ***


```
public final class ActivityResultMatchers
```

<br />

*** ** * ** ***

Hamcrest matchers for a `https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html`.

## Summary

| ### Public methods |
|---|---|
| `static https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html>` | `https://developer.android.com/reference/androidx/test/espresso/contrib/ActivityResultMatchers#hasResultCode(int)(int resultCode)` Returns a matcher that verifies that the `resultCode` of a given `https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html` matches the given code |
| `static https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html>` | `https://developer.android.com/reference/androidx/test/espresso/contrib/ActivityResultMatchers#hasResultData(org.hamcrest.Matcher<android.content.Intent>)(https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://developer.android.com/reference/android/content/Intent.html> intentMatcher)` Returns a matcher that verifies that the resultData of a given `https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html` matches the given specification by the `intentMatcher` |

## Public methods

### hasResultCode

```
public static Matcher<Instrumentation.ActivityResult> hasResultCode(int resultCode)
```

Returns a matcher that verifies that the `resultCode` of a given `https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html` matches the given code

### hasResultData

```
public static Matcher<Instrumentation.ActivityResult> hasResultData(Matcher<Intent> intentMatcher)
```

Returns a matcher that verifies that the resultData of a given `https://developer.android.com/reference/android/app/Instrumentation.ActivityResult.html` matches the given specification by the `intentMatcher`