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

voben

10/22/2019, 3:04 PM
Yeah, Koin kindda does that when you have android dependencies, and its pretty annoying. Mostly things related to
context
. You can try creating a robolectric environment by annotating your test class with
@RunWith(RobolectricTestRunner::class)
Copy code
@RunWith(RobolectricTestRunner::class)
class MyTestClass : AutoCloseKoinTest() {}
Or you could also try mocking the application class in your tests. Maybe something like
Copy code
@Before
    fun before() {
        val application = mockk<Application>(relaxed = true)
        startKoin {
            androidContext(application)
            modules(myModules)
        }
    }