AppComponentFactoryRule


public final class AppComponentFactoryRule extends ExternalResource


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

Protected methods

void
void

Public constructors

AppComponentFactoryRule

public AppComponentFactoryRule(@NonNull AppComponentFactory factory)

Protected methods

after

protected void after()

before

protected void before()