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
Update to OpenJDK 15. #2051
Update to OpenJDK 15. #2051
Conversation
Seems like we got some test failures :( |
b6e0127
to
9dad024
Compare
Needed to update Jacoco. Works now. |
Strangely enough, it builds locally. Will investigate some more! |
It's weird, if I build locally with the same command and Java version (build and major), I cannot reproduce this error... |
I don't think I have Java 15 installed on any of my machines and not sure if I can get a hold of them. Looking at the test failures, many of them seem related to how we handle |
I ran the exact build version locally and it works, on a fresh clone even, also on Linux. |
I am seeing these failures for JDK 15 (build 15+36-1562) as well, but on Windows. The tests which are failing apparently make assumptions about how NullPointerExceptions look like, which are now not true anymore:
|
Thanks for the great investigation @Marcono1234 Do you mind creating a PR with the necessary fixes to make it work on JDK 15? |
I fear that I am not familiar enough with Mockito to perform these changes while still keeping the intended functionality for the tests. |
The requirement does not seem meaningful to me, at least. I just fixed the tests to not require an empty message. |
Codecov Report
@@ Coverage Diff @@
## release/3.x #2051 +/- ##
==============================================
Coverage 84.74% 84.74%
Complexity 2717 2717
==============================================
Files 325 325
Lines 8277 8277
Branches 989 989
==============================================
Hits 7014 7014
Misses 992 992
Partials 271 271 Continue to review full report at Codecov.
|
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.
I might not be familiar enough with Mockito, but wouldn't it be possible for StubbingWithDelegateTest
and DeepStubsSerializableTest
to not provoke the NullPointerException
at all (as outlined above), but instead test for a null
return value? That would probably make the tests more robust since they might otherwise catch unrelated NullPointerExceptions which are caused by bugs.
assertThatThrownBy( | ||
() -> | ||
when(deserialized_deep_stub.iterator().next().get(42)) | ||
.thenReturn("no")) | ||
.isInstanceOf(NullPointerException.class); |
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.
assertThatThrownBy( | |
() -> | |
when(deserialized_deep_stub.iterator().next().get(42)) | |
.thenReturn("no")) | |
.isInstanceOf(NullPointerException.class); | |
assertThat(deserialized_deep_stub.iterator().next()).isNull(); |
Due to Java expression evaluation order the enclosing when(...)
and the following thenReturn(...)
are not executed at all.
assertThatThrownBy( | ||
() -> { | ||
@SuppressWarnings("unused") | ||
byte b = methods.byteObjectReturningMethod(); | ||
}) | ||
.isInstanceOf(NullPointerException.class); |
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.
assertThatThrownBy( | |
() -> { | |
@SuppressWarnings("unused") | |
byte b = methods.byteObjectReturningMethod(); | |
}) | |
.isInstanceOf(NullPointerException.class); | |
assertThat(methods.byteObjectReturningMethod()).isNull(); |
NullPointerException
here is not triggered by Mockito, but instead by unboxing Byte
→ byte
so this can probably simplified to checking for a null
return value.
Good point, I just adjusted the tests. |
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.
Test changes LGTM.
Use Java 15 in builds for most recent Java version.