class ExtendGraphTestRule : GraphLifecycleTestRule
Test rule that takes a component qualifier and a ComponentBuilderBlock and extends the Graph with componentQualifier by applying the ComponentBuilderBlock.
It also provides a reflection based inject method that injects into all property annotated with javax.inject.Inject by using the Graph with given componentQualifier.
Example:
@get:Rule
val rule = WinterJUnit4.rule("presentation") {
singleton<ListPresenter>(override = true) { MockListPresenter() }
}
@Inject
lateinit var presenter: ListPresenter
@Before
fun beforeEach() {
rule.inject(this)
}
var graph: Graph? |
fun graphDispose(graph: Graph): Unit |
|
fun graphInitialized(graph: Graph): Unit |
|
fun graphInitializing(parentGraph: Graph?, builder: ComponentBuilder): Unit |
|
fun inject(target: Any): Unit |
fun apply(base: Statement, description: Description): Statement |