https://kotlinlang.org logo
#koin
Title
a

AntoineJojo

05/04/2018, 12:47 PM
Hi everyone! Trying to use Koin with espresso ... I got this error:
org.koin.error.AlreadyStartedException: Koin is already started. Run startKoin only once or use loadKoinModules
when I define my instrumented test like that:
@Before
fun setUp() {
val mockModule = applicationContext {
bean { mockRepository as Repository }
}
startKoin(modules + mockModule)
}
If I use
loadKoinModules
, the modules are not loaded, only the one defined in my Application class. Any idea? Do you have some example of instrumented test mocking some Koin modules?