I've noticed that sometimes verify
fails with "... call to ... happened, but arguments are not matching"
Here is a sample test that shows verify failing:
class TestStuff {
val stuff = "1"
@RelaxedMockK
lateinit var testService: TestService
@RelaxedMockK
lateinit var testInterface: TestInterface
@Before
fun setup() {
MockKAnnotations.init(this)
every { testInterface.testStuff } returns stuff
}
@Test
fun testStuffCalled() {
testService.testStuff(testInterface.testStuff)
verify { testService.testStuff(testInterface.testStuff) }
}
}
interface TestInterface {
val testStuff: String
}
class TestService {
fun testStuff(stuff: String) {
}
}
If I change the line with the verify call to the following 2 lines, then it works:
let testStuffCopy = testInterface.testStuff
verify { testService.testStuff(testStuffCopy) }