Skip to content

docs: clarify RETURNS_MOCKS behavior with sealed abstract enums (Java 15+)#3773

Merged
TimvdLippe merged 1 commit intomockito:mainfrom
NiMv1:fix/returns-mocks-documentation
Dec 16, 2025
Merged

docs: clarify RETURNS_MOCKS behavior with sealed abstract enums (Java 15+)#3773
TimvdLippe merged 1 commit intomockito:mainfrom
NiMv1:fix/returns-mocks-documentation

Conversation

@NiMv1
Copy link
Copy Markdown
Contributor

@NiMv1 NiMv1 commented Dec 15, 2025

Fixes #3285 - Added documentation note explaining that since Java 15, abstract enums are declared sealed and cannot be mocked, throwing MockitoException instead of returning null.

… 15+)

Fixes mockito#3285

Added documentation note explaining that since Java 15, abstract enums
are declared sealed and cannot be mocked. Attempting to return a mock
for such types will throw MockitoException instead of returning null.
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Dec 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.45%. Comparing base (09d2230) to head (79ef6ac).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3773      +/-   ##
============================================
- Coverage     86.46%   86.45%   -0.02%     
  Complexity     2988     2988              
============================================
  Files           341      341              
  Lines          9041     9041              
  Branches       1113     1113              
============================================
- Hits           7817     7816       -1     
- Misses          942      943       +1     
  Partials        282      282              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

@TimvdLippe TimvdLippe merged commit 27eb8a3 into mockito:main Dec 16, 2025
19 checks passed
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.

Incorrect documentation for RETURNS_MOCKS

3 participants