Fix AugmentationIdentifier.compareTo() 11/64111/1
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 7 Oct 2017 12:16:36 +0000 (14:16 +0200)
committerRobert Varga <nite@hq.sk>
Tue, 10 Oct 2017 09:50:00 +0000 (09:50 +0000)
commita29074a22e3f306fbce9d35e7ab9348adaf455aa
treef91def4e074373c1e3af1392003b5fe54c03a77e
parentda7d07bbbc98f8dd2893e3d2eaf43af818ff0b40
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>
(cherry picked from commit 77b8e16d3a2abfb368d2974a473154fe255f903e)
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