# InstantTaskExecutorRule

added in[version 1.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact android.arch.core:core-testing:1.1.1  
Summary:[Ctors](https://developer.android.com/reference/android/arch/core/executor/testing/InstantTaskExecutorRule#pubctors)\|[Protected Methods](https://developer.android.com/reference/android/arch/core/executor/testing/InstantTaskExecutorRule#promethods)\|[Inherited Methods](https://developer.android.com/reference/android/arch/core/executor/testing/InstantTaskExecutorRule#inhmethods)  

# InstantTaskExecutorRule

| The`android.arch`Architecture Components packages are no longer maintained. They have been superseded by the corresponding[androidx.\*](https://developer.android.com/jetpack/androidx/migrate)packages. See[androidx.arch.core.executor.testing.InstantTaskExecutorRule](https://developer.android.com/reference/androidx/arch/core/executor/testing/InstantTaskExecutorRule)instead.

`
public


class
InstantTaskExecutorRule
`  
`


``

extends TestWatcher


``


`

|---|---|------------------------------------------------------------|
| java.lang.Object                                                 |||
| ↳ | org.junit.rules.TestWatcher                                   ||
|   | ↳ | android.arch.core.executor.testing.InstantTaskExecutorRule |

<br />

*** ** * ** ***

A JUnit Test Rule that swaps the background executor used by the Architecture Components with a different one which executes each task synchronously.

You can use this rule for your host side tests that use Architecture Components.

## Summary

|                                                                      ### Public constructors                                                                       ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[InstantTaskExecutorRule](https://developer.android.com/reference/android/arch/core/executor/testing/InstantTaskExecutorRule#InstantTaskExecutorRule())`() ` |

|                                                                                     ### Protected methods                                                                                     ||
|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void` | ` `[finished](https://developer.android.com/reference/android/arch/core/executor/testing/InstantTaskExecutorRule#finished(org.junit.runner.Description))`(Description description) ` |
| ` void` | ` `[starting](https://developer.android.com/reference/android/arch/core/executor/testing/InstantTaskExecutorRule#starting(org.junit.runner.Description))`(Description description) ` |

| ### Inherited methods |
|-----------------------|---|
| From class` org.junit.rules.TestWatcher ` |--------------|-----------------------------------------------------------------| | ` Statement` | ` apply(Statement arg0, Description arg1) `                     | | ` void`      | ` failed(Throwable arg0, Description arg1) `                    | | ` void`      | ` finished(Description arg0) `                                  | | ` void`      | ` skipped(AssumptionViolatedException arg0, Description arg1) ` | | ` void`      | ` skipped(AssumptionViolatedException arg0, Description arg1) ` | | ` void`      | ` starting(Description arg0) `                                  | | ` void`      | ` succeeded(Description arg0) `                                 | ||
| From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||
| From interface` org.junit.rules.TestRule ` |-----------------------|---------------------------------------------| | ` abstract Statement` | ` apply(Statement arg0, Description arg1) ` | ||

## Public constructors

### InstantTaskExecutorRule

added in[version 1.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
InstantTaskExecutorRule ()
```

<br />

<br />

## Protected methods

### finished

```
void finished (Description description)
```

<br />

<br />

|             Parameters              ||
|---------------|----------------------|
| `description` | `Description` <br /> |

### starting

```
void starting (Description description)
```

<br />

<br />

|             Parameters              ||
|---------------|----------------------|
| `description` | `Description` <br /> |

-

  ## Classes

  - [CountingTaskExecutorRule](https://developer.android.com/reference/android/arch/core/executor/testing/CountingTaskExecutorRule)
  - [InstantTaskExecutorRule](https://developer.android.com/reference/android/arch/core/executor/testing/InstantTaskExecutorRule)