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
Bug: capture Slots in multiple verifications capture only last value #352
Comments
@tmarsteel Maybe not ideal, but have you tried
|
Did you try using a list instead of a slot and then capture it?
|
@tunovic @only-fabione both work. I don't know how i solved it back then, probably with the list. |
Sent out #533 to fix this. The fix is actually suggesting what @only-fabione said earlier, to use a mutableList when capturing the same function arguments more than once. It should be clearer now why MockK is not behaving as expected when using slots in this case. |
Thanks This works |
Neat trick, thank you |
Expected Behavior & Current Behaviour
Capturing slots work like you'd expect them to, coming from mockito. See this test-case:
This fails because
dataSlotId1.captured
is"data2"
Steps to Reproduce
I've put all code necessary to reproduce here: https://github.com/tmarsteel/mockk-verify-capture-test
Just run
mvn clean test
or run the test in your IDE.Context
See the pom.xml in the repository.
Failure Logs
Stack trace
from the screenshot:
The text was updated successfully, but these errors were encountered: