-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support arguments capture for verify blocks #65
Comments
Hi! Just like in MockK, using What’s your specific use case? Could simply using capture within an |
Thanks for looking at this! The use-case is to just extract the argument for the more further assertion. Like speaking about the example above, it could be:
Of course it is possible to use
But coming with the Mockito Kotlin usage background, where captors can be used in the
It was a bit confusing to see here that captor can be technically invoked in the |
How does it work with the Mockito?? Does it push all the arguments that were recorded for matching call all at once?? fooBar.call(1)
fooBar.call(2)
verify {
val list = mutableListOf<Int>()
fooBar.call(capture(list))
println(list) // prints [1, 2]
} |
Yes. This would be the following snippet:
|
At first glance, it seems possible to implement. I'll investigate further. If possible, I'll include it in version |
It seems that
capture
is not supported forverify
blocks.Suppose we have the following:
And then we mock/verify it in the test:
This assertion will fail, because nothing was actually captured and container is empty.
Am I missing some additional setup or mock arguments capture is indeed not yet supported in
verify
blocks?The text was updated successfully, but these errors were encountered: