-
Notifications
You must be signed in to change notification settings - Fork 0
net.natura.testcommons.extensions.KoinExtension
Lucas de Souza da Conceição edited this page Jul 9, 2020
·
3 revisions
class KoinExtension : BeforeEachCallback, AfterEachCallback
A JUnit5 extension that starts and stops Koin instance between tests.
Example usage:
Static call
class MyTest {
companion object {
@JvmField
@RegisterExtension
val koinExtension = KoinExtension(yourKoinModule)
}
}
Dynamic call:
class MyTest {
@JvmField
@RegisterExtension
val koinExtension = KoinExtension(listOf(koinModule1, koinModule2))
}
When no parameters are needed:
@ExtendWith(KoinExtension::class)
class MyTest {
}
injectedModuleList
- List of modules that can be injected at start (optional);
injectedModule
- Module that can be injected at start (optional).
Name | Summary |
---|---|
<init> |
KoinExtension(injectedModule: Module) KoinExtension(injectedModuleList: List <Module> = listOf())
|