Stay organized with collections
Save and categorize content based on your preferences.
added in
version 1.1.0
belongs to Maven artifact android.arch.core:core-testing:1.1.1
InstantTaskExecutorRule
public
class
InstantTaskExecutorRule
extends TestWatcher
java.lang.Object
|
↳ |
org.junit.rules.TestWatcher
|
|
↳ |
android.arch.core.executor.testing.InstantTaskExecutorRule
|
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
Protected methods |
void
|
finished(Description description)
|
void
|
starting(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
InstantTaskExecutorRule ()
Protected methods
finished
void finished (Description description)
Parameters |
description |
Description |
starting
void starting (Description description)
Parameters |
description |
Description |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# InstantTaskExecutorRule\n\nadded in [version 1.1.0](/topic/libraries/support-library/revisions) \nbelongs to Maven artifact android.arch.core:core-testing:1.1.1 \nSummary: [Ctors](#pubctors) \\| [Protected Methods](#promethods) \\| [Inherited Methods](#inhmethods) \n\nInstantTaskExecutorRule\n=======================\n\n| The `android.arch` Architecture Components packages are no longer maintained. They have been superseded by the corresponding [androidx.\\*](/jetpack/androidx/migrate) packages. See [androidx.arch.core.executor.testing.InstantTaskExecutorRule](/reference/androidx/arch/core/executor/testing/InstantTaskExecutorRule) instead.\n\n\n`\npublic\n\n\nclass\nInstantTaskExecutorRule\n`\n\n\n`\n\n\n`\n\n`\n\nextends TestWatcher\n\n\n`\n\n`\n\n\n`\n\n|---|---|------------------------------------------------------------|\n| java.lang.Object |||\n| ↳ | org.junit.rules.TestWatcher ||\n| | ↳ | android.arch.core.executor.testing.InstantTaskExecutorRule |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nA JUnit Test Rule that swaps the background executor used by the Architecture Components with a\ndifferent one which executes each task synchronously.\n\n\nYou can use this rule for your host side tests that use Architecture Components.\n\nSummary\n-------\n\n| ### Public constructors ||\n|------------------------------------------------------------------------------------------------------------------------------------|---|\n| ` `[InstantTaskExecutorRule](/reference/android/arch/core/executor/testing/InstantTaskExecutorRule#InstantTaskExecutorRule())`() ` |\n\n| ### Protected methods ||\n|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` void` | ` `[finished](/reference/android/arch/core/executor/testing/InstantTaskExecutorRule#finished(org.junit.runner.Description))`(Description description) ` |\n| ` void` | ` `[starting](/reference/android/arch/core/executor/testing/InstantTaskExecutorRule#starting(org.junit.runner.Description))`(Description description) ` |\n\n| ### Inherited methods |\n|-----------------------|---|\n| 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) ` | ||\n| From class ` java.lang.Object ` |-------------------|-------------------------------| | ` Object` | ` clone() ` | | ` boolean` | ` equals(Object arg0) ` | | ` void` | ` finalize() ` | | ` final Class\u003c?\u003e` | ` 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() ` | ||\n| From interface ` org.junit.rules.TestRule ` |-----------------------|---------------------------------------------| | ` abstract Statement` | ` apply(Statement arg0, Description arg1) ` | ||\n\nPublic constructors\n-------------------\n\n### InstantTaskExecutorRule\n\nadded in [version 1.1.0](/topic/libraries/support-library/revisions) \n\n```\nInstantTaskExecutorRule ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nProtected methods\n-----------------\n\n### finished\n\n```\nvoid finished (Description description)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------------|----------------------|\n| `description` | `Description` \u003cbr /\u003e |\n\n### starting\n\n```\nvoid starting (Description description)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------------|----------------------|\n| `description` | `Description` \u003cbr /\u003e |\n\n-\n\n Classes\n -------\n\n - [CountingTaskExecutorRule](/reference/android/arch/core/executor/testing/CountingTaskExecutorRule)\n - [InstantTaskExecutorRule](/reference/android/arch/core/executor/testing/InstantTaskExecutorRule)"]]