https://kotlinlang.org logo
#kodein
Title
c

carlbenson

09/16/2016, 8:18 AM
hello. I’m trying to extend my Android kodein instance by another one to allow injection of a mock object for testing (in Instrumentation Testing). My
Application
is
KodeinAware
and has a
Copy code
override val kodein by Kodein.lazy {
    import(someModule)
}
and then in my tests I want to inject another object. I’ve tried
Copy code
val mockSomeModule = Kodein.Module {
    bind<Module>(overrides = true) with provider { mockModule() }
}
val subKodein = Kodein.lazy {
    extend(appKodein())
    import(mockSomeModule, allowOverride = true)
}
but it still runs with the non-mocked module