Visitar URL original
Fixes #2497: Throw exception on invalid matchers for `mockStatic` by temp-droid · Pull Request #2506 · mockito/mockito · GitHub
Skip to content

Fixes #2497: Throw exception on invalid matchers for mockStatic - #2506

Merged
TimvdLippe merged 3 commits into
mockito:mainfrom
temp-droid:fix-2497
Dec 14, 2021
Merged

TimvdLippe merged 3 commits into
mockito:mainfrom
temp-droid:fix-2497

Conversation

@temp-droid

Copy link
Copy Markdown
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

codecov-commenter commented Dec 12, 2021 •

Copy link
Copy Markdown

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.

@TimvdLippe TimvdLippe left a comment

Copy link
Copy Markdown
Contributor

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.

3 participants