Fix AugmentationIdentifier.compareTo() 38/64038/6
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 7 Oct 2017 12:16:36 +0000 (14:16 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 9 Oct 2017 20:04:47 +0000 (22:04 +0200)
commit77b8e16d3a2abfb368d2974a473154fe255f903e
tree84ef11a7bda298effe0a96871678bed3f8181d3d
parentbd89923b9192de66c583b33d6f4f1fb696a23ede
Fix AugmentationIdentifier.compareTo()

The implementation assumed stable Set iteration order, which was
not internally guaranteed, hence two AugmentationIdentifiers could
report as being equal via equals(), but still compare as having
different total ordering -- which could lead to strange results.

Fix this by doing some more work and compare them based on QName's
total ordering. The test suite is fixed up to use explicit iteration
order retained by ImmutableSet rather than relying on HashSet's
hashCode()-based iteration order non-determinism.

Also remove implicit boolean boxing by using assertTrue/assertFalse
in tests.

Change-Id: Iafd4ac8d7d54f0918b0579c6e6f8e76b35b56dd8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/YangInstanceIdentifier.java
yang/yang-data-api/src/test/java/org/opendaylight/yangtools/yang/data/api/PathArgumentListTest.java
yang/yang-data-api/src/test/java/org/opendaylight/yangtools/yang/data/api/YangInstanceIdentifierTest.java
yang/yang-data-api/src/test/java/org/opendaylight/yangtools/yang/data/api/schema/tree/DataTreeCandidatesTest.java