Github user ifesdjeen commented on a diff in the pull request:
https://github.com/apache/cassandra/pull/271#discussion_r220871785
--- Diff: test/unit/org/apache/cassandra/locator/ReplicaCollectionTest.java
---
@@ -141,28 +147,37 @@ public void testOrderOfIteration()
{
Assert.assertEquals(canonicalList, ImmutableList.copyOf(test));
Assert.assertEquals(canonicalList,
test.stream().collect(Collectors.toList()));
- Assert.assertEquals(new
LinkedHashSet<>(Lists.transform(canonicalList, Replica::endpoint)),
test.endpoints());
+ Assert.assertTrue(Iterables.elementsEqual(new
LinkedHashSet<>(Lists.transform(canonicalList, Replica::endpoint)),
test.endpoints()));
}
private void assertSubList(C subCollection, int from, int to)
{
- Assert.assertTrue(subCollection.isSnapshot);
if (from == to)
{
Assert.assertTrue(subCollection.isEmpty());
}
else
{
- List<Replica> subList = this.test.list.subList(from, to);
- if (test.isSnapshot)
- Assert.assertSame(subList.getClass(),
subCollection.list.getClass());
+ AbstractReplicaCollection.ReplicaList subList =
this.test.list.subList(from, to);
+ if (!(test instanceof ReplicaCollection.Builder<?>))
+ Assert.assertSame(subList.contents,
subCollection.list.contents);
Assert.assertEquals(subList, subCollection.list);
}
}
+ private void assertSubSequence(Iterable<Replica> subSequence, int
from, int to)
+ {
+ AbstractReplicaCollection.ReplicaList subList =
this.test.list.subList(from, to);
+ if (!elementsEqual(subList, subSequence))
+ {
+ elementsEqual(subList, subSequence);
--- End diff --
Did you mean something like `Assert.assertSame(subList.contents,
subSequence);` ?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]