I’ve just started using Kodein on an Android proje...
# kodein
e
I’ve just started using Kodein on an Android project and I really like it. However I am not sure what the best practises are when it comes to testing. I have a KodeinAware Application where I set my bindings as such:
Copy code
class MyApplication : Application(), KodeinAware {

    companion object {
        lateinit var context: Context

        fun getAppContext(): Context {
            return context
        }
    }

    override fun onCreate() {
        super.onCreate()
        context = applicationContext
    }

    override val kodein by Kodein.lazy {
        bind<SettingsRepository>() with singleton { SettingsRepository(kodein) }
        bind<Authenticator>() with singleton { AuthenticatorImpl(kodein) }
        bind<SharedPrefsHelper>() with singleton { SharedPrefsHelper() }
        bind<UserEventDataSource>() with singleton { UserEventRepository() }
    }
}
So for JUnit and Intrumentation tests respectively, what are the correct or preferred ways to use Kodein? Especially in JUnit where I want to test KodeinAware classes that access other objects through the use of Kodein
👍 2