blob: ca6c56c4f09fe32c812ed229f22fee9354f5c0eb [file] [log] [blame]
HIGUCHI Yutaca9cc8e2015-10-29 23:26:51 -07001package org.onlab.graph;
2
3import static org.junit.Assert.*;
4
5import org.junit.Test;
6
7import com.google.common.collect.ImmutableList;
8import com.google.common.testing.EqualsTester;
9
10/**
11 * Test of DisjointPathPair.
12 */
13public class DisjointPathPairTest {
14
15 private static final TestVertex A = new TestVertex("A");
16 private static final TestVertex B = new TestVertex("B");
17 private static final TestVertex C = new TestVertex("C");
18 private static final TestVertex D = new TestVertex("D");
19
20 private static final TestEdge AB = new TestEdge(A, B, 1.0);
21 private static final TestEdge BC = new TestEdge(B, C, 1.0);
22 private static final TestEdge AD = new TestEdge(A, D, 1.0);
23 private static final TestEdge DC = new TestEdge(D, C, 1.0);
24
25 private static final Path<TestVertex, TestEdge> ABC
26 = new DefaultPath<>(ImmutableList.of(AB, BC), 1.0);
27 private static final Path<TestVertex, TestEdge> ADC
28 = new DefaultPath<>(ImmutableList.of(AD, DC), 1.0);
29
30 @Test
31 public void testSwappingPrimarySecondaryDoesntImpactHashCode() {
32 assertEquals(new DisjointPathPair<>(ABC, ADC).hashCode(),
33 new DisjointPathPair<>(ADC, ABC).hashCode());
34 }
35
36 @Test
37 public void testSwappingPrimarySecondaryDoesntImpactEquality() {
38 new EqualsTester()
39 .addEqualityGroup(new DisjointPathPair<>(ABC, ADC),
40 new DisjointPathPair<>(ADC, ABC));
41 }
42
43}