Skip to content

Commit 3b71013

Browse files
yonghanlinyhlinyhlin
authored
Fix nondeterministic list comparison in doAssertEquals for PriorityQueue tests (#1220)
* Fix list comparison in doAssertEquals * add import List --------- Co-authored-by: yhlin <yhlin@wirelessprv-10-194-20-3.near.illinois.edu> Co-authored-by: yhlin <yhlin@vpnduopool-10-251-162-181.near.illinois.edu>
1 parent e447d7c commit 3b71013

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

test/com/esotericsoftware/kryo/KryoTestCase.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import java.nio.Buffer;
4141
import java.nio.ByteBuffer;
4242
import java.util.ArrayList;
43+
import java.util.List;
4344

4445
import org.junit.jupiter.api.BeforeEach;
4546

@@ -282,7 +283,18 @@ public <T> T roundTripWithBufferFactory (int length, T object1, BufferFactory sf
282283
}
283284

284285
protected void doAssertEquals (Object object1, Object object2) {
285-
assertEquals(arrayToList(object1), arrayToList(object2));
286+
Object val1 = arrayToList(object1);
287+
Object val2 = arrayToList(object2);
288+
289+
if (val1 instanceof List && val2 instanceof List) {
290+
List<?> list1 = (List<?>) val1;
291+
List<?> list2 = (List<?>) val2;
292+
assertEquals(list1.size(), list2.size());
293+
assertTrue(list1.containsAll(list2));
294+
assertTrue(list2.containsAll(list1));
295+
} else {
296+
assertEquals(val1, val2);
297+
}
286298
}
287299

288300
public static Object arrayToList (Object array) {

0 commit comments

Comments
 (0)