Hello,
I'm trying to integrate Kotest with SpringBoot and SpringMockK for veryfing bean calls via
@SpykBean
, but cannot get it working.
my setup looks roughly like this:
@SpringBootTest
class SomeTestClass(
[...]
) : FunSpec() {
@SpykBean
private lateinit var someService: SomeService
init {
test("some test") {
[...]
verify { someService.someMethod(someArg) } // ERROR here
}
}
}
Test breaks when hitting
verify
block with beginning of the stack trace looking as follows:
java.lang.NoClassDefFoundError: io/mockk/ValueClassSupportKt
at io.mockk.impl.instantiation.JvmMockFactoryHelper.toDescription$mockk(JvmMockFactoryHelper.kt:150)
at io.mockk.impl.instantiation.JvmMockFactoryHelper$mockHandler$1.invocation(JvmMockFactoryHelper.kt:25)
at io.mockk.proxy.jvm.advice.Interceptor.call(Interceptor.kt:21)
I tried using
MockKAnnotations.init()
,
@ExtendWith(MockKExtension::class)
, moving
@SpykBean
to companion object, but nothing helped.
Have anyone had such issue or could think of a solution?
Thanks in advance