Skip to content

Commit

Permalink
Fix IterableTestCase.checkNotSame to factor in empty sorted immutable…
Browse files Browse the repository at this point in the history
… collections having different instances due to construction with a comparator.
  • Loading branch information
motlin committed Mar 10, 2016
1 parent ce7fb8d commit f76d15d
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015 Goldman Sachs.
* Copyright (c) 2016 Goldman Sachs.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
Expand Down Expand Up @@ -147,7 +147,8 @@ static void checkNotSame(Object o1, Object o2)
if ((o1 instanceof Number && o2 instanceof Number)
|| (o1 instanceof Boolean && o2 instanceof Boolean)
|| o1 instanceof ImmutableCollection<?> && o2 instanceof ImmutableCollection<?>
&& ((ImmutableCollection<?>) o1).isEmpty() && ((ImmutableCollection<?>) o2).isEmpty())
&& ((ImmutableCollection<?>) o1).isEmpty() && ((ImmutableCollection<?>) o2).isEmpty()
&& !(o1 instanceof SortedIterable<?>) && !(o2 instanceof SortedIterable<?>))
{
assertSame(o1, o2);
return;
Expand All @@ -171,7 +172,7 @@ default void Object_PostSerializedEqualsAndHashCode()
{
Iterable<Integer> iterable = this.newWith(3, 3, 3, 2, 2, 1);
Object deserialized = SerializeTestHelper.serializeDeserialize(iterable);
Assert.assertNotSame(iterable, deserialized);
assertNotSame(iterable, deserialized);
}

@Test
Expand Down

0 comments on commit f76d15d

Please sign in to comment.