Skip to content

net.natura.testcommons.rules.KoinRule

Lucas de Souza da Conceição edited this page Jul 9, 2020 · 2 revisions

KoinRule

class KoinRule : TestRule

A JUnit4 rule that starts and stops Koin instance between tests.

Example usage:

class MyActivityTest {

    @get:Rule
    val koinRule = KoinRule()

    @get:Rule
    val koinRuleWithModule = KoinRule(yourKoinModule)

    @get:Rule
    val koinRuleWithModuleList = KoinRule(listOf(koinModule1, koinModule2)
}

Parameters

injectedModuleList - List of modules that can be injected at start (optional);

injectedModule - Module that can be injected at start (optional).

Constructors

Name Summary
<init> KoinRule(injectedModule: Module)
KoinRule(injectedModuleList: List<Module> = listOf())
Clone this wiki locally