# ComponentNameMatchers

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

*** ** * ** ***


```
@CheckReturnValue
class ComponentNameMatchers
```

<br />

*** ** * ** ***

A collection of hamcrest matchers to match `https://developer.android.com/reference/android/content/ComponentName.html` objects.

## Summary

| ### Public functions |
|---|---|
| `java-static https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://developer.android.com/reference/android/content/ComponentName.html!>!` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/intent/matcher/ComponentNameMatchers#hasClassName(org.hamcrest.Matcher<java.lang.String>)(classNameMatcher: https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!)` |
| `java-static https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://developer.android.com/reference/android/content/ComponentName.html!>!` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/intent/matcher/ComponentNameMatchers#hasClassName(java.lang.String)(className: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` |
| `java-static https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://developer.android.com/reference/android/content/ComponentName.html!>!` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/intent/matcher/ComponentNameMatchers#hasMyPackageName()()` Matches a component based on the target package name found through the Instrumentation Registry for the test. |
| `java-static https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://developer.android.com/reference/android/content/ComponentName.html!>!` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/intent/matcher/ComponentNameMatchers#hasPackageName(org.hamcrest.Matcher<java.lang.String>)(packageNameMatcher: https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!)` |
| `java-static https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://developer.android.com/reference/android/content/ComponentName.html!>!` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/intent/matcher/ComponentNameMatchers#hasPackageName(java.lang.String)(packageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` |
| `java-static https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://developer.android.com/reference/android/content/ComponentName.html!>!` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/intent/matcher/ComponentNameMatchers#hasShortClassName(org.hamcrest.Matcher<java.lang.String>)(shortClassNameMatcher: https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!)` |
| `java-static https://junit.org/junit4/javadoc/latest/org/hamcrest/Matcher.html<https://developer.android.com/reference/android/content/ComponentName.html!>!` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/intent/matcher/ComponentNameMatchers#hasShortClassName(java.lang.String)(shortClassName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` |

## Public functions

### hasClassName

```
java-static fun hasClassName(classNameMatcher: Matcher<String!>!): Matcher<ComponentName!>!
```

### hasClassName

```
java-static fun hasClassName(className: String!): Matcher<ComponentName!>!
```

### hasMyPackageName

```
java-static fun hasMyPackageName(): Matcher<ComponentName!>!
```

Matches a component based on the target package name found through the Instrumentation Registry for the test.

### hasPackageName

```
java-static fun hasPackageName(packageNameMatcher: Matcher<String!>!): Matcher<ComponentName!>!
```

### hasPackageName

```
java-static fun hasPackageName(packageName: String!): Matcher<ComponentName!>!
```

### hasShortClassName

```
java-static fun hasShortClassName(shortClassNameMatcher: Matcher<String!>!): Matcher<ComponentName!>!
```

### hasShortClassName

```
java-static fun hasShortClassName(shortClassName: String!): Matcher<ComponentName!>!
```