I am using MockK for testing. Language: Kotlin.
I have a sealed class A
with a few subclasses, say B
, C
, and D
, which is used as a parameter for a function call. I need to make sure that a function is called with one of the subtypes of A
.
For that I tried to do this:
verify { instance.doSomething(any<B>())}
and it passes. However, I tried to do any<C>
and any<D>
and it still passes.
How do I verify that the function was called with a parameter of type B
and only B
?