{"action":"created","issue":{"url":"https://api.github.com/repos/alexvoronov/geonetworking/issues/48","repository_url":"https://api.github.com/repos/alexvoronov/geonetworking","labels_url":"https://api.github.com/repos/alexvoronov/geonetworking/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/alexvoronov/geonetworking/issues/48/comments","events_url":"https://api.github.com/repos/alexvoronov/geonetworking/issues/48/events","html_url":"https://github.com/alexvoronov/geonetworking/issues/48","id":356043920,"node_id":"MDU6SXNzdWUzNTYwNDM5MjA=","number":48,"title":"Failing Test - AreaAndPositionTest#test2","user":{"login":"snodnipper","id":576719,"node_id":"MDQ6VXNlcjU3NjcxOQ==","avatar_url":"https://avatars3.githubusercontent.com/u/576719?v=4","gravatar_id":"","url":"https://api.github.com/users/snodnipper","html_url":"https://github.com/snodnipper","followers_url":"https://api.github.com/users/snodnipper/followers","following_url":"https://api.github.com/users/snodnipper/following{/other_user}","gists_url":"https://api.github.com/users/snodnipper/gists{/gist_id}","starred_url":"https://api.github.com/users/snodnipper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snodnipper/subscriptions","organizations_url":"https://api.github.com/users/snodnipper/orgs","repos_url":"https://api.github.com/users/snodnipper/repos","events_url":"https://api.github.com/users/snodnipper/events{/privacy}","received_events_url":"https://api.github.com/users/snodnipper/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-08-31T16:19:02Z","updated_at":"2018-09-01T12:08:45Z","closed_at":null,"author_association":"NONE","body":"I am getting inconsistent results with the following code between the JVM and Android.\r\n\r\n```java\r\n@Test\r\npublic void test2() {\r\n   EqualsVerifier.forClass(Area.class).verify();\r\n}\r\n```\r\n\r\nI believe the root cause of the problem is because the Area equality check casts a double to a short and the EqualsVerifier test library has no knowledge of such behaviour.\r\n\r\nWith the JVM, I appear to get test values such as \r\n\r\n```\r\nreference: Area [center=Pos(0.5, 0.5), distanceAmeters=0.5, distanceBmeters=0.5, angleDegreesFromNorth=0.5, type=CIRCLE]\r\n```\r\n\r\n```\r\nchanged: Area [center=Pos(0.5, 0.5), distanceAmeters=1.0, distanceBmeters=0.5, angleDegreesFromNorth=0.5, type=CIRCLE]\r\n```\r\nwhich I have been debugging at line 167 in the 1.7.2 library.  For a quick glance, a link to the [current code](https://github.com/jqno/equalsverifier/blob/7543316fc54e11361e599c57b284a0f9beed5fd4/src/main/java/nl/jqno/equalsverifier/internal/checkers/FieldsChecker.java#L173).\r\n\r\nYou will note that the [short cast](https://github.com/alexvoronov/geonetworking/blob/57a43113aeabc25f005ea17f76409aed148e67b5/geonetworking/src/main/java/net/gcdc/geonetworking/Area.java#L59) make the distanceAmeters different (0 vs 1) _but_ in the Android implementation I get test values:\r\n\r\n```\r\nreference: Area [center=null, distanceAmeters=0.0, distanceBmeters=0.0, angleDegreesFromNorth=0.0, type=null]\r\n```\r\n\r\n```\r\nchanged: Area [center=null, distanceAmeters=0.5, distanceBmeters=0.0, angleDegreesFromNorth=0.0, type=null]\r\n```\r\n\r\nwhere clearly 0 and 0.5 round down to 0 vs 0, which is a different result the JVM values of 0 vs 1.\r\n\r\nPerhaps we can adjust the test or make the equality more robust given the input - e.g. int param at mm resolution....although I am not aware of any specification specifics.\r\n\r\nAny thoughts / suggestions would be appreciated - thanks!"},"comment":{"url":"https://api.github.com/repos/alexvoronov/geonetworking/issues/comments/417855332","html_url":"https://github.com/alexvoronov/geonetworking/issues/48#issuecomment-417855332","issue_url":"https://api.github.com/repos/alexvoronov/geonetworking/issues/48","id":417855332,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNzg1NTMzMg==","user":{"login":"snodnipper","id":576719,"node_id":"MDQ6VXNlcjU3NjcxOQ==","avatar_url":"https://avatars3.githubusercontent.com/u/576719?v=4","gravatar_id":"","url":"https://api.github.com/users/snodnipper","html_url":"https://github.com/snodnipper","followers_url":"https://api.github.com/users/snodnipper/followers","following_url":"https://api.github.com/users/snodnipper/following{/other_user}","gists_url":"https://api.github.com/users/snodnipper/gists{/gist_id}","starred_url":"https://api.github.com/users/snodnipper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snodnipper/subscriptions","organizations_url":"https://api.github.com/users/snodnipper/orgs","repos_url":"https://api.github.com/users/snodnipper/repos","events_url":"https://api.github.com/users/snodnipper/events{/privacy}","received_events_url":"https://api.github.com/users/snodnipper/received_events","type":"User","site_admin":false},"created_at":"2018-09-01T12:08:45Z","updated_at":"2018-09-01T12:08:45Z","author_association":"NONE","body":"Sorry, there is no issue with rounding.  It is just that Android and the JVM pick different random values (assuming somewhere in equality lib they are using random for the test values).\r\n\r\nIt is simply that picking random values 0 and 0.5...and then 0.5 and 1 yields different results when casting (rounding down).  0 and 0.5 round down to 0.  0.5 and 1 round down to 0 and 1.  Test4 is therefore unpredictable.  The android tools picked the first random values and the JVM picked the second random values.\r\n\r\nHappy to help as necessary but perhaps the constructor can just use a short (as per spec)...and we have a convenience method (maybe constructor) to convert from double to short.  The builder pattern is common.  We'd therefore change the test to work with short values - and not test the double behaviour in test4.\r\n\r\n"}}
{"actor":{"display_login":"snodnipper"}}