Closed elifarley closed 4 years ago
Hi @elifarley!
In your code (https://github.com/elifarley/kotlin-tests-with-koin-examples.git), val statsServer: StatsServer by inject()
calls getKoin()
internally, which not started yet.
(Koin will be started after listeners
method which contains the KoinListener
).
Try write your test case using get
instead by inject
:
"Happy path" {
get<StatsServer>().newError() shouldBe 1
}
Describe the bug I'm unable to use Koin 2.0.1 with Kotlin-test 3.4.2 and Maven. I get an InvocationTargetException like this:
To Reproduce I've created a small example on GitHub that reproduces this error: https://github.com/elifarley/kotlin-tests-with-koin-examples Just execute these commands to clone the repo and run tests:
Expected behavior The test should either pass or fail, but no InvocationTargetException should be thrown.
Koin project used and used version (please complete the following information):
koin-core version 2.0.1