-
Notifications
You must be signed in to change notification settings - Fork 95
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
Potential fail of LngLatAlt#equals(Object) since lon/lat values are rounded during serialization #23
Comments
I'm posting a possible solution using a bi-function to compare coordinate values with a tolerance for nearly-equal values:
|
Hi, you can take a look to AssertJ (http://joel-costigliola.github.io/assertj/) who is a better remplacement of Hamcrest.
|
Hi, many thanks for your response and, definitely, many thanks for the tip. I didn't know about this test library. Anyway, I think that decimal places should not be trimmed during serialization, or at least a larger precision should be allowed. BTW, in my previous message I propose a replacement for the equals method that can be used to check two points that are supposed to be nearly-equal, which is a more general solution and can be used beyond basic unit testing. |
Is this issue fixed? |
Double to String conversion in LngLatAlt serializer breaks LngLatAlt#equals(Object) method due to rounded values. Please, take into account the following test where a new point is created from real longitude and latitude values, converted into JSON and read again into a Point object:
The error message:
The text was updated successfully, but these errors were encountered: