diff options
author | Ashlee Young <ashlee@wildernessvoice.com> | 2015-11-05 14:00:42 -0800 |
---|---|---|
committer | Ashlee Young <ashlee@wildernessvoice.com> | 2015-11-05 14:00:42 -0800 |
commit | b34f82bf11934fc6b938ef997d536a7ccea76c36 (patch) | |
tree | 10559ebf65962abb741883ca9d23aec241ced504 /framework/src/onos/utils/misc/src/test/java/org/onlab/graph/DisjointPathPairTest.java | |
parent | 2cdecb8c41956d7dd8ab5d59591ebc21f3c64a9e (diff) |
Updates ONOS tree to checkin id ca9cc8e28eba18da77f4fa021fb7c3a3f76e5d44
upstream.
Change-Id: I49f8e41733afea8101ec50c0102213c8d18949ae
Signed-off-by: Ashlee Young <ashlee@wildernessvoice.com>
Diffstat (limited to 'framework/src/onos/utils/misc/src/test/java/org/onlab/graph/DisjointPathPairTest.java')
-rw-r--r-- | framework/src/onos/utils/misc/src/test/java/org/onlab/graph/DisjointPathPairTest.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/framework/src/onos/utils/misc/src/test/java/org/onlab/graph/DisjointPathPairTest.java b/framework/src/onos/utils/misc/src/test/java/org/onlab/graph/DisjointPathPairTest.java new file mode 100644 index 00000000..ca6c56c4 --- /dev/null +++ b/framework/src/onos/utils/misc/src/test/java/org/onlab/graph/DisjointPathPairTest.java @@ -0,0 +1,43 @@ +package org.onlab.graph; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import com.google.common.collect.ImmutableList; +import com.google.common.testing.EqualsTester; + +/** + * Test of DisjointPathPair. + */ +public class DisjointPathPairTest { + + private static final TestVertex A = new TestVertex("A"); + private static final TestVertex B = new TestVertex("B"); + private static final TestVertex C = new TestVertex("C"); + private static final TestVertex D = new TestVertex("D"); + + private static final TestEdge AB = new TestEdge(A, B, 1.0); + private static final TestEdge BC = new TestEdge(B, C, 1.0); + private static final TestEdge AD = new TestEdge(A, D, 1.0); + private static final TestEdge DC = new TestEdge(D, C, 1.0); + + private static final Path<TestVertex, TestEdge> ABC + = new DefaultPath<>(ImmutableList.of(AB, BC), 1.0); + private static final Path<TestVertex, TestEdge> ADC + = new DefaultPath<>(ImmutableList.of(AD, DC), 1.0); + + @Test + public void testSwappingPrimarySecondaryDoesntImpactHashCode() { + assertEquals(new DisjointPathPair<>(ABC, ADC).hashCode(), + new DisjointPathPair<>(ADC, ABC).hashCode()); + } + + @Test + public void testSwappingPrimarySecondaryDoesntImpactEquality() { + new EqualsTester() + .addEqualityGroup(new DisjointPathPair<>(ABC, ADC), + new DisjointPathPair<>(ADC, ABC)); + } + +} |