Showing
1 changed file
with
18 additions
and
4 deletions
| ... | @@ -47,14 +47,13 @@ public class TestHostToHostIntent { | ... | @@ -47,14 +47,13 @@ public class TestHostToHostIntent { |
| 47 | * to different Hosts. These should compare not equal. | 47 | * to different Hosts. These should compare not equal. |
| 48 | */ | 48 | */ |
| 49 | @Test | 49 | @Test |
| 50 | - public void testLinksDifferentEquals() { | 50 | + public void testSameEquals2() { |
| 51 | - | ||
| 52 | HostId one = hid("00:00:00:00:00:01/-1"); | 51 | HostId one = hid("00:00:00:00:00:01/-1"); |
| 53 | HostId two = hid("00:00:00:00:00:02/-1"); | 52 | HostId two = hid("00:00:00:00:00:02/-1"); |
| 54 | HostToHostIntent i1 = makeHostToHost(one, two); | 53 | HostToHostIntent i1 = makeHostToHost(one, two); |
| 55 | HostToHostIntent i2 = makeHostToHost(two, one); | 54 | HostToHostIntent i2 = makeHostToHost(two, one); |
| 56 | 55 | ||
| 57 | - assertThat(i1, is(not(equalTo(i2)))); | 56 | + assertThat(i1, is(equalTo(i2))); |
| 58 | } | 57 | } |
| 59 | 58 | ||
| 60 | /** | 59 | /** |
| ... | @@ -76,12 +75,27 @@ public class TestHostToHostIntent { | ... | @@ -76,12 +75,27 @@ public class TestHostToHostIntent { |
| 76 | * objects are different. | 75 | * objects are different. |
| 77 | */ | 76 | */ |
| 78 | @Test | 77 | @Test |
| 79 | - public void testHashCodeDifferent() { | 78 | + public void testHashCodeEquals2() { |
| 80 | HostId one = hid("00:00:00:00:00:01/-1"); | 79 | HostId one = hid("00:00:00:00:00:01/-1"); |
| 81 | HostId two = hid("00:00:00:00:00:02/-1"); | 80 | HostId two = hid("00:00:00:00:00:02/-1"); |
| 82 | HostToHostIntent i1 = makeHostToHost(one, two); | 81 | HostToHostIntent i1 = makeHostToHost(one, two); |
| 83 | HostToHostIntent i2 = makeHostToHost(two, one); | 82 | HostToHostIntent i2 = makeHostToHost(two, one); |
| 84 | 83 | ||
| 84 | + assertThat(i1.hashCode(), is(equalTo(i2.hashCode()))); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + /** | ||
| 88 | + * Tests that the hashCode() values for two distinct LinkCollectionIntent | ||
| 89 | + * objects are different. | ||
| 90 | + */ | ||
| 91 | + @Test | ||
| 92 | + public void testHashCodeDifferent() { | ||
| 93 | + HostId one = hid("00:00:00:00:00:01/-1"); | ||
| 94 | + HostId two = hid("00:00:00:00:00:02/-1"); | ||
| 95 | + HostId three = hid("00:00:00:00:00:32/-1"); | ||
| 96 | + HostToHostIntent i1 = makeHostToHost(one, two); | ||
| 97 | + HostToHostIntent i2 = makeHostToHost(one, three); | ||
| 98 | + | ||
| 85 | assertThat(i1.hashCode(), is(not(equalTo(i2.hashCode())))); | 99 | assertThat(i1.hashCode(), is(not(equalTo(i2.hashCode())))); |
| 86 | } | 100 | } |
| 87 | 101 | ... | ... |
-
Please register or login to post a comment