cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ifesdjeen <...@git.apache.org>
Subject [GitHub] cassandra pull request #271: 14726
Date Thu, 27 Sep 2018 10:45:04 GMT
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: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Mime
View raw message