-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Deep Stubs Incompatible With Mocking Enum #3167
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #3167 +/- ##
============================================
- Coverage 85.34% 85.33% -0.01%
Complexity 2911 2911
============================================
Files 334 334
Lines 8866 8867 +1
Branches 1099 1101 +2
============================================
Hits 7567 7567
- Misses 1007 1008 +1
Partials 292 292 ☔ View full report in Codecov by Sentry. |
a02acef
to
10f8b9d
Compare
src/main/java/org/mockito/internal/stubbing/defaultanswers/ReturnsDeepStubs.java
Outdated
Show resolved
Hide resolved
@TimvdLippe I have fixed your remarks. And I have also moved the spotless code into |
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.
Couple of nits in the test and let's do the spotless work in a different PR and apply to all subprojects. Most likely that will cause a bit more reformatting.
...ava21/src/test/java/org/mockito/internal/stubbing/answers/DeepStubReturnsEnumJava21Test.java
Outdated
Show resolved
Hide resolved
...ava21/src/test/java/org/mockito/internal/stubbing/answers/DeepStubReturnsEnumJava21Test.java
Outdated
Show resolved
Hide resolved
Mockito can't mock abstract enums in Java 15 or later because they are now marked as sealed. So Mockito reports that now with a better error message. If a deep stub returns an abstract enum, it uses in the error case now the first enum literal of the real enum. Fixes mockito#2984
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!
Mockito can't mock abstract enums in Java 15 or later because they are now marked as sealed.
So Mockito reports that now with a better error message.
If a deep stub returns an abstract enum, it uses in the error case now the first enum literal of the real enum.
Fixes #2984