--- jsr166/src/test/tck/ConcurrentSkipListSetTest.java 2015/05/24 01:42:14 1.42 +++ jsr166/src/test/tck/ConcurrentSkipListSetTest.java 2017/03/11 18:20:46 1.46 @@ -35,9 +35,9 @@ public class ConcurrentSkipListSetTest e /** * Returns a new set of given size containing consecutive - * Integers 0 ... n. + * Integers 0 ... n - 1. */ - private ConcurrentSkipListSet populatedSet(int n) { + private static ConcurrentSkipListSet populatedSet(int n) { ConcurrentSkipListSet q = new ConcurrentSkipListSet(); assertTrue(q.isEmpty()); @@ -53,7 +53,7 @@ public class ConcurrentSkipListSetTest e /** * Returns a new set of first 5 ints. */ - private ConcurrentSkipListSet set5() { + private static ConcurrentSkipListSet set5() { ConcurrentSkipListSet q = new ConcurrentSkipListSet(); assertTrue(q.isEmpty()); q.add(one); @@ -199,7 +199,14 @@ public class ConcurrentSkipListSetTest e q.add(new Object()); q.add(new Object()); shouldThrow(); - } catch (ClassCastException success) {} + } catch (ClassCastException success) { + assertTrue(q.size() < 2); + for (int i = 0, size = q.size(); i < size; i++) + assertTrue(q.pollFirst().getClass() == Object.class); + assertNull(q.pollFirst()); + assertTrue(q.isEmpty()); + assertEquals(0, q.size()); + } } /** @@ -691,7 +698,8 @@ public class ConcurrentSkipListSetTest e } static NavigableSet newSet(Class cl) throws Exception { - NavigableSet result = (NavigableSet) cl.newInstance(); + NavigableSet result = + (NavigableSet) cl.getConstructor().newInstance(); assertEquals(0, result.size()); assertFalse(result.iterator().hasNext()); return result;