Describe the bug
The AbstractOptionalDoubleAssert.hasValue(double) javadoc state that NaN values are supported (last line of):
|
* Assertion will pass : |
|
* <pre><code class='java'> assertThat(OptionalDouble.of(8.0)).hasValue(8.0); |
|
* assertThat(OptionalDouble.of(8.0)).hasValue(Double.valueOf(8.0)); |
|
* assertThat(OptionalDouble.of(Double.NaN)).hasValue(Double.NaN); </code></pre> |
The nature of NaN values prevents the == operator to works, but there is no hasNaNValue() method or equivalent, and the javadoc clearly state that it should works.
- assertj core version: 3.24.2
- java version: 21
- test framework version: junit 5.10.1
- os (if relevant): windows
Test case reproducing the bug
@Test
void testNaN() {
assertThat(OptionalDouble.of(Double.NaN)).hasValue(Double.NaN);
}
Result:
org.opentest4j.AssertionFailedError:
Expecting actual:
OptionalDouble[NaN]
to contain:
NaN
but did not.
Describe the bug
The
AbstractOptionalDoubleAssert.hasValue(double)javadoc state that NaN values are supported (last line of):assertj/assertj-core/src/main/java/org/assertj/core/api/AbstractOptionalDoubleAssert.java
Lines 120 to 123 in 35e54e0
The nature of NaN values prevents the
==operator to works, but there is nohasNaNValue()method or equivalent, and the javadoc clearly state that it should works.Test case reproducing the bug
Result: