--- jsr166/src/test/tck/PriorityBlockingQueueTest.java 2015/02/28 19:59:23 1.59 +++ jsr166/src/test/tck/PriorityBlockingQueueTest.java 2015/05/15 18:21:19 1.62 @@ -38,7 +38,7 @@ public class PriorityBlockingQueueTest e } public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); + main(suite(), args); } public static Test suite() { @@ -197,9 +197,8 @@ public class PriorityBlockingQueueTest e * Offer of non-Comparable throws CCE */ public void testOfferNonComparable() { + PriorityBlockingQueue q = new PriorityBlockingQueue(1); try { - PriorityBlockingQueue q = new PriorityBlockingQueue(1); - q.offer(new Object()); q.offer(new Object()); q.offer(new Object()); shouldThrow(); @@ -221,8 +220,8 @@ public class PriorityBlockingQueueTest e * addAll(this) throws IAE */ public void testAddAllSelf() { + PriorityBlockingQueue q = populatedQueue(SIZE); try { - PriorityBlockingQueue q = populatedQueue(SIZE); q.addAll(q); shouldThrow(); } catch (IllegalArgumentException success) {} @@ -233,11 +232,11 @@ public class PriorityBlockingQueueTest e * possibly adding some elements */ public void testAddAll3() { + PriorityBlockingQueue q = new PriorityBlockingQueue(SIZE); + Integer[] ints = new Integer[SIZE]; + for (int i = 0; i < SIZE-1; ++i) + ints[i] = new Integer(i); try { - PriorityBlockingQueue q = new PriorityBlockingQueue(SIZE); - Integer[] ints = new Integer[SIZE]; - for (int i = 0; i < SIZE-1; ++i) - ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {}