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
In 1.12.3 verify { mock.method( withArg {}) }
fails if second call matches. Works in 1.12.2
#796
Comments
I don't really understand why you are using Isn't it the same as saying
? And yes, by using simpler matchers you can match multiple calls of the same method. |
Well, this is simplest example that reproduces the issue, I prepared it specifically for this submission. In real code I have much more complex condition :D. And as for simpler matchers - in 1.12.2 this worked fine, and if this change is intentional please confirm it. But I doubt it, as |
Facing the same problem here. Tests which contain "withArg" running fine on 1.12.2 and fail on 1.12.3 |
@piotrplazienski as you guessed, this behavior was introduced with #776. If you read the discussion in #707, IMHO it is not correct to use I understand that the usage of assertions inside Perhaps I will just add better documentation to discourage this improper usage of |
Thank you for explanation. I think I get the intention now. I also don't have any strong opinion on this, but I also understand why So to conclude: I think this should be closed now, but I would appreciate some docs on |
As a side note, most of the code that I have seen doing
Can also be written as
Which is, IMHO, pretty concise for a few properties to be checked. In case someone needs to verify more than a few properties, I'd probably still go for a slot. |
Yes, I think using predicate is better practice and that is where I will go with rework of my tests. I will close the issue now. |
Hi @Raibaz, IMO it would greatly help to mention this in the documentation of Although I don't see any example about the recommended usage. I guess it would no show any usage of assertion in the |
Prerequisites
Expected Behavior
When calling verification using
withArg{}
, if there are multiple calls to mock method, and one of calls matcheswithArg
, the verification should pass.Current Behavior
If there are multiple calls to method verification will fail. It passed in 1.12.2
Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
Minimal reproducible code (the gist of this issue)
I would guess this is caused by #776, as #394 fixed #389 that seemed similar, and #776 reverted changes.
If this is intentional change, please provide intended way of asserting with many calls.
The text was updated successfully, but these errors were encountered: