-
-
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
Fixes #2548 : Makes InOrder able to verify static methods #2549
Fixes #2548 : Makes InOrder able to verify static methods #2549
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Overall, the implementation looks solid. I only have a couple of nits with regards to the tests.
My only concern is the difference in the class passed into inOrder
and the class we are actually interacting with. I guess this currently works, as we are passing in a Class
in the List<Object>
, but that feels a bit weird to me. Not sure WDYT?
I think to fix that, we would need a similar method to objectIsMockToBeVerified
, but in this case verify that the context is correct. However, we are only passing in the lambda, which doesn't necessarily match to the Class
we put in.
Therefore, we maybe have to look into passing the mockedStatic
in the inOrder
method instead and omit it as an argument from the inOrder.verify
call?
subprojects/inline/src/test/java/org/mockitoinline/InOrderVerificationTest.java
Outdated
Show resolved
Hide resolved
subprojects/inline/src/test/java/org/mockitoinline/InOrderVerificationTest.java
Outdated
Show resolved
Hide resolved
subprojects/inline/src/test/java/org/mockitoinline/InOrderVerificationTest.java
Outdated
Show resolved
Hide resolved
subprojects/inline/src/test/java/org/mockitoinline/InOrderVerificationTest.java
Show resolved
Hide resolved
Thanks for your feedback @TimvdLippe ! I have addressed the comments and pushed the changes related to the tests. I see your concern, and actually, passing the |
Codecov Report
@@ Coverage Diff @@
## main #2549 +/- ##
============================================
+ Coverage 86.71% 86.75% +0.04%
- Complexity 2784 2796 +12
============================================
Files 320 321 +1
Lines 8341 8368 +27
Branches 1021 1024 +3
============================================
+ Hits 7233 7260 +27
Misses 840 840
Partials 268 268
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks for the explanation (makes sense to me) and the nice PR + tests! Merging 🎉
This PR makes it possible to verify static methods calls in order. Fixes: #2548
Example of usage:
You can also pass a specific
VerificationMode
as third argument to theInOrder#verify
method.Checklist
including project members to get a better picture of the change
commit is meaningful and help the people that will explore a change in 2 years
Fixes #<issue number>
in the description if relevantFixes #<issue number>
if relevant