You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, this does not work because of different types:
org.opentest4j.AssertionFailedError:
Expecting:
<"0.16666666666666666 (BigDecimal@1c52552f)">
to be equal to:
<"0.16666666666666666 (Double@5dc769f9)">
but was not.
Expected :0.16666666666666666
Actual :0.16666666666666666
What is the recommended way to do this? Should there be other methods like extractingJsonPathDoubleValue or extractingJsonPathFloatValue that could return DoubleAssert or FloatAssert so that methods like isCloseTo can be used?
The text was updated successfully, but these errors were encountered:
We can consider adding some more methods, but I'm not sure that we need to increase the surface area of the API. You can use AssertJ's satisfies and your knowledge of the type of the Number to then use isCloseTo:
mbhave
changed the title
Best way to test double values with extractingJsonPathNumberValue?
Document using AssertJ's satisfies together with extractingJsonPathNumberValue
Mar 16, 2019
I am using
extractingJsonPathNumberValue
to test a double value in my JSON:However, this does not work because of different types:
What is the recommended way to do this? Should there be other methods like
extractingJsonPathDoubleValue
orextractingJsonPathFloatValue
that could returnDoubleAssert
orFloatAssert
so that methods likeisCloseTo
can be used?The text was updated successfully, but these errors were encountered: