# PreferenceMatchers

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

# PreferenceMatchers

| 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

final

class
PreferenceMatchers
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object.html)`


``


`

|---|----------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||
| ↳ | android.support.test.espresso.matcher.PreferenceMatchers |

<br />

*** ** * ** ***

A collection of hamcrest matchers that match[Preference](https://developer.android.com/reference/android/preference/Preference.html)s.

## Summary

|                                                                                                                                                                                         ### Public methods                                                                                                                                                                                          ||
|---------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static Matcher<`[Preference](https://developer.android.com/reference/android/preference/Preference.html)`>` | ` `[isEnabled](https://developer.android.com/reference/android/support/test/espresso/matcher/PreferenceMatchers#isEnabled())`() `                                                                                                                                                    |
| ` static Matcher<`[Preference](https://developer.android.com/reference/android/preference/Preference.html)`>` | ` `[withKey](https://developer.android.com/reference/android/support/test/espresso/matcher/PreferenceMatchers#withKey(org.hamcrest.Matcher<java.lang.String>))`(Matcher<`[String](https://developer.android.com/reference/java/lang/String.html)`> keyMatcher) `                     |
| ` static Matcher<`[Preference](https://developer.android.com/reference/android/preference/Preference.html)`>` | ` `[withKey](https://developer.android.com/reference/android/support/test/espresso/matcher/PreferenceMatchers#withKey(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String.html)` key) `                                                           |
| ` static Matcher<`[Preference](https://developer.android.com/reference/android/preference/Preference.html)`>` | ` `[withSummary](https://developer.android.com/reference/android/support/test/espresso/matcher/PreferenceMatchers#withSummary(int))`(int resourceId) `                                                                                                                               |
| ` static Matcher<`[Preference](https://developer.android.com/reference/android/preference/Preference.html)`>` | ` `[withSummaryText](https://developer.android.com/reference/android/support/test/espresso/matcher/PreferenceMatchers#withSummaryText(org.hamcrest.Matcher<java.lang.String>))`(Matcher<`[String](https://developer.android.com/reference/java/lang/String.html)`> summaryMatcher) ` |
| ` static Matcher<`[Preference](https://developer.android.com/reference/android/preference/Preference.html)`>` | ` `[withSummaryText](https://developer.android.com/reference/android/support/test/espresso/matcher/PreferenceMatchers#withSummaryText(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String.html)` summary) `                                       |
| ` static Matcher<`[Preference](https://developer.android.com/reference/android/preference/Preference.html)`>` | ` `[withTitle](https://developer.android.com/reference/android/support/test/espresso/matcher/PreferenceMatchers#withTitle(int))`(int resourceId) `                                                                                                                                   |
| ` static Matcher<`[Preference](https://developer.android.com/reference/android/preference/Preference.html)`>` | ` `[withTitleText](https://developer.android.com/reference/android/support/test/espresso/matcher/PreferenceMatchers#withTitleText(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String.html)` title) `                                             |
| ` static Matcher<`[Preference](https://developer.android.com/reference/android/preference/Preference.html)`>` | ` `[withTitleText](https://developer.android.com/reference/android/support/test/espresso/matcher/PreferenceMatchers#withTitleText(org.hamcrest.Matcher<java.lang.String>))`(Matcher<`[String](https://developer.android.com/reference/java/lang/String.html)`> titleMatcher) `       |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/espresso/matcher/PreferenceMatchers#)From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object.html)` ` |-------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object.html)          | ` clone() `                                                                                | | ` boolean`                                                                          | ` equals(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0) ` | | ` void`                                                                             | ` finalize() `                                                                             | | ` final `[Class](https://developer.android.com/reference/java/lang/Class.html)`<?>` | ` getClass() `                                                                             | | ` int`                                                                              | ` hashCode() `                                                                             | | ` final void`                                                                       | ` notify() `                                                                               | | ` final void`                                                                       | ` notifyAll() `                                                                            | | ` `[String](https://developer.android.com/reference/java/lang/String.html)          | ` toString() `                                                                             | | ` final void`                                                                       | ` wait(long arg0, int arg1) `                                                              | | ` final void`                                                                       | ` wait(long arg0) `                                                                        | | ` final void`                                                                       | ` wait() `                                                                                 | ||

## Public methods

### isEnabled

```
Matcher<Preference> isEnabled ()
```

<br />

<br />

|                                                    Returns                                                    ||
|-------------------------------------------------------------------------------------------------------|--------|
| `Matcher<`[Preference](https://developer.android.com/reference/android/preference/Preference.html)`>` | <br /> |

### withKey

```
Matcher<Preference> withKey (Matcher<String> keyMatcher)
```

<br />

<br />

|           Parameters           ||
|--------------|------------------|
| `keyMatcher` | `Matcher` <br /> |

|                                                    Returns                                                    ||
|-------------------------------------------------------------------------------------------------------|--------|
| `Matcher<`[Preference](https://developer.android.com/reference/android/preference/Preference.html)`>` | <br /> |

### withKey

```
Matcher<Preference> withKey (String key)
```

<br />

<br />

|       Parameters       ||
|-------|-----------------|
| `key` | `String` <br /> |

|                                                    Returns                                                    ||
|-------------------------------------------------------------------------------------------------------|--------|
| `Matcher<`[Preference](https://developer.android.com/reference/android/preference/Preference.html)`>` | <br /> |

### withSummary

```
Matcher<Preference> withSummary (int resourceId)
```

<br />

<br />

|         Parameters         ||
|--------------|--------------|
| `resourceId` | `int` <br /> |

|                                                    Returns                                                    ||
|-------------------------------------------------------------------------------------------------------|--------|
| `Matcher<`[Preference](https://developer.android.com/reference/android/preference/Preference.html)`>` | <br /> |

### withSummaryText

```
Matcher<Preference> withSummaryText (Matcher<String> summaryMatcher)
```

<br />

<br />

|             Parameters             ||
|------------------|------------------|
| `summaryMatcher` | `Matcher` <br /> |

|                                                    Returns                                                    ||
|-------------------------------------------------------------------------------------------------------|--------|
| `Matcher<`[Preference](https://developer.android.com/reference/android/preference/Preference.html)`>` | <br /> |

### withSummaryText

```
Matcher<Preference> withSummaryText (String summary)
```

<br />

<br />

|         Parameters         ||
|-----------|-----------------|
| `summary` | `String` <br /> |

|                                                    Returns                                                    ||
|-------------------------------------------------------------------------------------------------------|--------|
| `Matcher<`[Preference](https://developer.android.com/reference/android/preference/Preference.html)`>` | <br /> |

### withTitle

```
Matcher<Preference> withTitle (int resourceId)
```

<br />

<br />

|         Parameters         ||
|--------------|--------------|
| `resourceId` | `int` <br /> |

|                                                    Returns                                                    ||
|-------------------------------------------------------------------------------------------------------|--------|
| `Matcher<`[Preference](https://developer.android.com/reference/android/preference/Preference.html)`>` | <br /> |

### withTitleText

```
Matcher<Preference> withTitleText (String title)
```

<br />

<br />

|        Parameters        ||
|---------|-----------------|
| `title` | `String` <br /> |

|                                                    Returns                                                    ||
|-------------------------------------------------------------------------------------------------------|--------|
| `Matcher<`[Preference](https://developer.android.com/reference/android/preference/Preference.html)`>` | <br /> |

### withTitleText

```
Matcher<Preference> withTitleText (Matcher<String> titleMatcher)
```

<br />

<br />

|            Parameters            ||
|----------------|------------------|
| `titleMatcher` | `Matcher` <br /> |

|                                                    Returns                                                    ||
|-------------------------------------------------------------------------------------------------------|--------|
| `Matcher<`[Preference](https://developer.android.com/reference/android/preference/Preference.html)`>` | <br /> |

-

  ## Classes

  - [BoundedMatcher](https://developer.android.com/reference/android/support/test/espresso/matcher/BoundedMatcher)
  - [CursorMatchers](https://developer.android.com/reference/android/support/test/espresso/matcher/CursorMatchers)
  - [CursorMatchers.CursorMatcher](https://developer.android.com/reference/android/support/test/espresso/matcher/CursorMatchers.CursorMatcher)
  - [HasBackgroundMatcher](https://developer.android.com/reference/android/support/test/espresso/matcher/HasBackgroundMatcher)
  - [LayoutMatchers](https://developer.android.com/reference/android/support/test/espresso/matcher/LayoutMatchers)
  - [PreferenceMatchers](https://developer.android.com/reference/android/support/test/espresso/matcher/PreferenceMatchers)
  - [RootMatchers](https://developer.android.com/reference/android/support/test/espresso/matcher/RootMatchers)
  - [ViewMatchers](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers)
-

  ## Enums

  - [ViewMatchers.Visibility](https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers.Visibility)