-
-
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 #2201 : Fixed checking of declared exceptions. #2547
Conversation
…hen parent contains throws keyword on its method and child overrides this method removing throws, it should be possible to mock throwing exception from child
Codecov Report
@@ Coverage Diff @@
## main #2547 +/- ##
============================================
- Coverage 86.69% 86.54% -0.16%
- Complexity 2782 2790 +8
============================================
Files 320 320
Lines 8344 8359 +15
Branches 1022 1023 +1
============================================
Hits 7234 7234
- Misses 840 857 +17
+ Partials 270 268 -2
Continue to review full report at Codecov.
|
WOW Amazing!! |
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! I think we are nearly there, but there are some more edge cases we need to handle.
src/main/java/org/mockito/internal/stubbing/answers/InvocationInfo.java
Outdated
Show resolved
Hide resolved
0e0e577
to
77f7dbd
Compare
Thank you for the comment. I've extended checking for exceptions and added tests for all the cases you've mentioned |
77f7dbd
to
66146e6
Compare
66146e6
to
792da83
Compare
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.
Nice work and regression tests, thanks! 🎉
Fixed checking of declared exceptions. In case when parent contains throws keyword on its method and child overrides this method removing throws, it should be possible to mock throwing exception from child
Description.
Lets assume that we have the following interface
And we have class that extends the interface, removing
throws
exceptionWhen we trying to mock exception throw, it wasn't possible
Now this behavior fixed
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