AppComponentFactoryRule
Artifact: androidx.test.ext:junit
public final class AppComponentFactoryRule extends ExternalResource
| java.lang.Object | ||
| ↳ | org.junit.rules.ExternalResource | |
| ↳ | androidx.test.ext.junit.rules.AppComponentFactoryRule |
JUnit Rule that let you define a AppComponentFactory before the tests starts and clean-up the factory after the test.
This rule is designed to be used with ActivityScenarioRule.
Example:
// We use `order` to to ensure the `AppComponentFactoryRule` will always run BEFORE the
// `ActivityScenarioRule` so that your custom `AppComponentFactory` is available when the
// activity is launched.
@get:Rule(order = 1)
val factoryRule = AppComponentFactoryRule(MyAppComponentFactory())
@get:Rule(order = 2)
val activityRule = ActivityScenarioRule<MyActivity>()
Summary
Public constructors |
|---|