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

Include cause when FieldReader fails to access field #2267

Merged

Conversation

A248
Copy link
Contributor

@A248 A248 commented Apr 14, 2021

Fixes #2266

Simply passes the exception cause to the thrown MockitoException

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.

Thanks for the PR! Could you add a regression test to our test suite as well? You can use the snippet that you posted in the issue and put it in the moduleTest subproject.

* Fixes mockito#2266
* Add regression test in module-test
@A248 A248 force-pushed the include-cause-fieldreader-exceptions branch from 37e96c7 to 51c6ea9 Compare April 14, 2021 14:23
@codecov-io
Copy link

Codecov Report

Merging #2267 (37e96c7) into release/3.x (2fa2a63) will increase coverage by 0.02%.
The diff coverage is n/a.

❗ Current head 37e96c7 differs from pull request most recent head 51c6ea9. Consider uploading reports for the commit 51c6ea9 to get more accurate results
Impacted file tree graph

@@                Coverage Diff                @@
##             release/3.x    #2267      +/-   ##
=================================================
+ Coverage          84.82%   84.84%   +0.02%     
  Complexity          2734     2734              
=================================================
  Files                326      326              
  Lines               8342     8342              
  Branches             997      997              
=================================================
+ Hits                7076     7078       +2     
  Misses               990      990              
+ Partials             276      274       -2     
Impacted Files Coverage Δ Complexity Δ
.../mockito/internal/util/reflection/FieldReader.java 77.77% <ø> (ø) 4.00 <0.00> (ø)
...to/internal/util/concurrent/WeakConcurrentMap.java 41.48% <0.00%> (+2.12%) 11.00% <0.00%> (ø%)

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 2fa2a63...51c6ea9. Read the comment docs.

@A248
Copy link
Contributor Author

A248 commented Apr 14, 2021

I can confirm that the regression test fails when the change to FieldReader is reverted.

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.

Great unit test, thank you so much for your contribution!

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.

Swallowed illegal access exceptions make it harder to debug modularity-related issues
3 participants