Closed bartkummel closed 2 years ago
Since you are using coVerify
, i'm assuming your test involves coroutines.
Just wondering, does it work if you use the timeout
parameter for coVerify
rather then eventually
?
Thanks for your suggestion, @Raibaz !
I've tried your approach, but it doesn't work either. In the process of trying, I discovered that the issue is actually only in version 1.12.3
, and not in versions 1.11.0
to 1.12.2
, as I claimed before. (I don't know how that happened, I probably didn't do me initial reproduction efforts totally right.) I'll correct the initial issue report.
But, to summarize: your approach does work in versions where the eventually
approach also does work. And where the eventually
approach fails (version 1.12.3
), the approach using timeout
also fails.
Right, I just noticed that you are using multiple withArg
calls in the same coVerify
block, so this behavior was probably introduced by #776.
I just merged #792 that reverts it, so the regression should likely be removed in the next release.
Excellent. I'll update when the release is out.
Just released v1.12.4, closing this.
Prerequisites
Expected Behavior
Test succeeds
Current Behavior
Test fails
Failure Information (for bugs)
My test fails because the mocked function is never called:
Steps to Reproduce
I have the following test:
It succeeds when running with Mockk
1.10.6
up and including1.12.2
. But it fails when running with Mockk1.12.3
. I can't figure out what change might have caused this.Context
I suppose it's not needed to know the rest of my implementation.
resourceService
is a service that does some database updates and is mocked in this test.publishKafkaMessage
is a helper function that publishes a message to Kafka. This is an integration test and we use testContainers to spin up a "real" Kafka cluster. The code under test here is listening for events from Kafka, and will be triggered by the messages that are published by this helper function.1.12.3
. (I've verified that this occurs in1.12.3
and NOT in1.10.6
,1.11.0
,1.12.0
,1.12.1
and1.12.2
.)1.5.31
openjdk 14.0.2 2020-07-14
4.6.4
Failure Logs
Stack trace
N/A, the test fails as if the mocked function was not called.
Minimal reproducible code (the gist of this issue)