-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Unified logic of argument matching and capturing #635
Conversation
Current coverage is 87.33% (diff: 97.72%)
|
on hold as we need to address the beta release thing |
Since these 2 bugfixes will not be included in the 2.1.0 RC phase, should I send a new PR against release/2.x ? |
@ChristianSchwarz, yes, but let's wait until 2.1.0 is out. This way, nobody gets confused :) |
@ChristianSchwarz I've changed the base branch to |
@mockito-team In the meantime on the
|
We wanted to freeze the release branch while waiting for the RC. #648 is a special case which originates from JavaOne, a major selling point for Mockito. We dont plan to add other changes in the RC. |
@ChristianSchwarz this thing will go in 2.2, I mean it ;) |
@ChristianSchwarz By the way could you rebase your commits on top of |
7636f27
to
968fea6
Compare
Great thanks. It may be delayed again due to some disagreement on the CI-CD... Otherwise yes the master is for mockito 3.x. I should probably update the contributing guide and the template as well |
Some adjustments can be made e.g. Other improvements can be made later. Thanks again @ChristianSchwarz ! |
@ChristianSchwarz, this is an impressive code change, improving not only the behavior but also code and test coverage!!! THANKS! Thanks @bric3 for reviewing and merging the PR! |
The mechanic remained unchanged in this RP, I introduced it with #463. At first I tried to retrieve the Type-Argument from the class but this turned out to be more complex. E.g. when the type-argument is bound in an upper class or interface or additional type-arguments were introduced on a matcher class.
Sounds good, can you open a new ticket, so I can take look. |
@mockito-core |
At the moment this works quite well! So no hurry, especially given your above remark. On mockito 3 (on master atm) we could change the interface to allow reporting the type handled by the matcher and maybe use default method for that. |
@ChristianSchwarz I have seen an interesting problem with This happened after a merge of release/2.x to master (52df10a). I noticed that One of the failing test can be fixed by adding the cast statement
Could it be that something went wrong with the merge regarding this PR ? |
@ChristianSchwarz Actually the investigation continue, see #717 (comment) |
The logic of argument matching and capturing is the same but can be found in ArgumentsComparator and InvocationMatcher. This PR unifies the decision logic how matchers are applied to argument+varargs by introducing a
MatcherApplicationStrategy
. This strategy can apply an action to an pair of ArgumentMatcher and Argument. One action is used to perform the ArgumentMatcher.matches(arg) call and an other is used to perfrom the capturing.