Package org.robolectric.junit.rules
Class BackgroundTestRule
java.lang.Object
org.robolectric.junit.rules.BackgroundTestRule
- All Implemented Interfaces:
org.junit.rules.TestRule
public final class BackgroundTestRule extends Object implements org.junit.rules.TestRule
Let tests to run on background thread, if it has annotation
BackgroundTestRule.BackgroundTest.
This is useful for testing logic that explicitly forbids being called on the main thread.
Example usage:
{@code-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceBackgroundTestRule.BackgroundTestAnnotation for test methods that need to be executed in a background thread. -
Constructor Summary
Constructors Constructor Description BackgroundTestRule() -
Method Summary
Modifier and Type Method Description org.junit.runners.model.Statementapply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
-
Constructor Details
-
BackgroundTestRule
public BackgroundTestRule()
-
-
Method Details
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)- Specified by:
applyin interfaceorg.junit.rules.TestRule
-