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
This is because gson parser parses numbers lazily: when parsing, it internally stores a string. Then, when serializing, the same string is reused. See the LazilyParsedNumber class.
Switching to moshi helps.
The text was updated successfully, but these errors were encountered:
Number comparison is described here https://github.com/lukas-krecan/JsonUnit#numeric-comparison. By default numbers are compared as literals so 1.0 is different than 1.00. This changes if you set tolerance (even to 0). Moshi is broken so it behaves differently.
When using
gson
as the JSON parser dependency, the following test fails despite that it shouldn't:assertJsonEquals("{\"foo\": 1.0}", "{\"foo\": 1.00}")
This is because
gson
parser parses numbers lazily: when parsing, it internally stores a string. Then, when serializing, the same string is reused. See the LazilyParsedNumber class.Switching to
moshi
helps.The text was updated successfully, but these errors were encountered: