This tutorial lets you test a Kotlin application and use Koin inject and retrieve your components.
Get the code
First, add the Koin dependency like below:
We reuse the
koin-core getting-started project, to use the koin module:
Writing our first Test
To make our first test, let's write a simple Junit test file and extend it with
KoinTest. We will be able then, to use
by inject() operators.
We use the Koin KoinTestRule rule to start/stop our Koin context
You can even make Mocks directly into MyPresenter, or test MyRepository. Those components doesn't have any link with Koin API.