# IdlingResourceRegistry

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

*** ** * ** ***


```
@Singleton
class IdlingResourceRegistry
```

<br />

*** ** * ** ***

Keeps track of user-registered `https://developer.android.com/reference/kotlin/androidx/test/espresso/IdlingResource`. Consider using `https://developer.android.com/reference/kotlin/androidx/test/espresso/IdlingRegistry` instead of this class.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/test/espresso/base/IdlingResourceRegistry#IdlingResourceRegistry(android.os.Looper)(looper: https://developer.android.com/reference/android/os/Looper.html!)` |

| ### Public functions |
|---|---|
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/test/espresso/IdlingResource!>!` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/base/IdlingResourceRegistry#getResources()()` Returns a list of all currently registered `https://developer.android.com/reference/kotlin/androidx/test/espresso/IdlingResource`s. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/base/IdlingResourceRegistry#registerLooper(android.os.Looper,boolean)(looper: https://developer.android.com/reference/android/os/Looper.html!, considerWaitIdle: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/base/IdlingResourceRegistry#registerResources(java.util.List<? extends androidx.test.espresso.IdlingResource>)(resourceList: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/test/espresso/IdlingResource!>!)` Registers the given resources. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/base/IdlingResourceRegistry#sync(java.lang.Iterable<androidx.test.espresso.IdlingResource>,java.lang.Iterable<android.os.Looper>)( resources: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-iterable/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-iterable/index.html<https://developer.android.com/reference/kotlin/androidx/test/espresso/IdlingResource!>!, loopers: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-iterable/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-iterable/index.html<https://developer.android.com/reference/android/os/Looper.html!>! )` Ensures that this idling resource registry is in sync with given resources by registering/un-registering idling resources as needed. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/base/IdlingResourceRegistry#unregisterResources(java.util.List<? extends androidx.test.espresso.IdlingResource>)(resourceList: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/test/espresso/IdlingResource!>!)` Unregisters the given resources. |

## Public constructors

### IdlingResourceRegistry

```
IdlingResourceRegistry(looper: Looper!)
```

## Public functions

### getResources

```
fun getResources(): (Mutable)List<IdlingResource!>!
```

Returns a list of all currently registered `https://developer.android.com/reference/kotlin/androidx/test/espresso/IdlingResource`s. This method is safe to call from any thread.

| Returns |
|---|---|
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/test/espresso/IdlingResource!>!` | an immutable List of `https://developer.android.com/reference/kotlin/androidx/test/espresso/IdlingResource`s. |

### registerLooper

```
fun registerLooper(looper: Looper!, considerWaitIdle: Boolean): Unit
```

### registerResources

```
fun registerResources(resourceList: (Mutable)List<IdlingResource!>!): Boolean
```

Registers the given resources. If any of the given resources are already registered, a warning is logged.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if all resources were successfully registered |

### sync

```
fun sync(
    resources: (Mutable)Iterable<IdlingResource!>!,
    loopers: (Mutable)Iterable<Looper!>!
): Unit
```

Ensures that this idling resource registry is in sync with given resources by registering/un-registering idling resources as needed.

### unregisterResources

```
fun unregisterResources(resourceList: (Mutable)List<IdlingResource!>!): Boolean
```

Unregisters the given resources. If any of the given resources are not already registered, a warning is logged.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if all resources were successfully unregistered |