commonMain.org.koin.test.mock.Declare.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of koin-test-jvm Show documentation
Show all versions of koin-test-jvm Show documentation
KOIN - Kotlin simple Dependency Injection Framework
The newest version!
package org.koin.test.mock
import org.koin.core.qualifier.Qualifier
import org.koin.mp.KoinPlatformTools
import org.koin.test.KoinTest
import org.koin.test.get
inline fun KoinTest.declare(
qualifier: Qualifier? = null,
noinline instance: () -> T,
): T {
val koin = KoinPlatformTools.defaultContext().get()
koin.declare(instance(), qualifier, allowOverride = true)
return get(qualifier)
}