Skip to content
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 #2497: Throw exception on invalid matchers for mockStatic #2506

Merged
merged 3 commits into from Dec 14, 2021

Conversation

temp-droid
Copy link
Contributor

I'm not sure if the Throwable catch block can be removed so I decided to keep it for now. Feel free to mention if it can be deleted.

I didn't follow the "snake case convention" for the test method to be consistent with the other test methods of the file, but I'm fine changing it.

Checklist

  • Read the contributing guide
  • PR should be motivated, i.e. what does it fix, why, and if relevant how
  • If possible / relevant include an example in the description, that could help all readers
    including project members to get a better picture of the change
  • Avoid other runtime dependencies
  • Meaningful commit history ; intention is important please rebase your commit history so that each
    commit is meaningful and help the people that will explore a change in 2 years
  • The pull request follows coding style
  • Mention Fixes #<issue number> in the description if relevant
  • At least one commit should mention Fixes #<issue number> if relevant

@codecov-commenter
Copy link

codecov-commenter commented Dec 12, 2021

Codecov Report

Merging #2506 (aa8028a) into main (dbcbb3f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##               main    #2506   +/-   ##
=========================================
  Coverage     86.53%   86.53%           
  Complexity     2779     2779           
=========================================
  Files           320      320           
  Lines          8341     8343    +2     
  Branches       1022     1022           
=========================================
+ Hits           7218     7220    +2     
  Misses          851      851           
  Partials        272      272           
Impacted Files Coverage Δ
...in/java/org/mockito/internal/MockedStaticImpl.java 79.22% <100.00%> (+0.55%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dbcbb3f...aa8028a. Read the comment docs.

Copy link
Contributor

@TimvdLippe TimvdLippe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and easy fix! I am not actually sure why we swallow exceptions here, but this is probably the safest change we can make. Only 1 nit with using assertj for more precise assertions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants