Skip to content
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

Numerical comparison regression in 2.36.0 #564

Closed
adrogon opened this issue Oct 6, 2022 · 4 comments
Closed

Numerical comparison regression in 2.36.0 #564

adrogon opened this issue Oct 6, 2022 · 4 comments

Comments

@adrogon
Copy link

adrogon commented Oct 6, 2022

Hello, using json-unit-fluent, this was passing in 2.35.0:

assertThatJson("{\"a\": 1.0, \"b\": 1.00}")
    .node("a").isEqualTo(1.0)
    .node("b").isEqualTo(1.0);
}

but is failing in 2.36.0 with Different value found in node "b", expected: <1.0> but was: <1.00>.

It does not look documented, so probably an unintended change?

Thank you :)

@lukas-krecan
Copy link
Owner

lukas-krecan commented Oct 6, 2022

Hi, thanks for reporting. It's both. It was a fix of Jackson config I did back in May and I have forgotten to mention it in the release notes. But the new behavior is intended, see this. I will mention it in the release notes.

@adrogon
Copy link
Author

adrogon commented Oct 6, 2022

So how do you make the second test pass without using withTolerance(0.0)?
Do you need to use BigDecimal("1.00")? Because .node("b").isEqualTo(1.00) of course fails.

@lukas-krecan
Copy link
Owner

        assertThatJson("{\"a\": 1.0, \"b\": 1.00}")
            .node("b").isEqualTo("1.00");

should work

@adrogon
Copy link
Author

adrogon commented Oct 6, 2022

Thank you for your reply, I'll stick with the .withTolerance(0.0) idea instead, and thank you for maintaining the library :)

@adrogon adrogon closed this as not planned Won't fix, can't repro, duplicate, stale Oct 6, 2022
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

No branches or pull requests

2 participants