--- jsr166/src/test/tck/AbstractQueueTest.java 2011/05/31 16:16:23 1.9 +++ jsr166/src/test/tck/AbstractQueueTest.java 2015/02/28 18:06:38 1.11 @@ -6,12 +6,14 @@ * Pat Fisher, Mike Judd. */ -import junit.framework.*; import java.util.AbstractQueue; import java.util.Arrays; import java.util.Iterator; import java.util.NoSuchElementException; +import junit.framework.Test; +import junit.framework.TestSuite; + public class AbstractQueueTest extends JSR166TestCase { public static void main(String[] args) { junit.textui.TestRunner.run(suite()); @@ -114,8 +116,8 @@ public class AbstractQueueTest extends J * addAll(null) throws NPE */ public void testAddAll1() { + Succeed q = new Succeed(); try { - Succeed q = new Succeed(); q.addAll(null); shouldThrow(); } catch (NullPointerException success) {} @@ -125,8 +127,8 @@ public class AbstractQueueTest extends J * addAll(this) throws IAE */ public void testAddAllSelf() { + Succeed q = new Succeed(); try { - Succeed q = new Succeed(); q.addAll(q); shouldThrow(); } catch (IllegalArgumentException success) {} @@ -136,9 +138,9 @@ public class AbstractQueueTest extends J * addAll of a collection with null elements throws NPE */ public void testAddAll2() { + Succeed q = new Succeed(); + Integer[] ints = new Integer[SIZE]; try { - Succeed q = new Succeed(); - Integer[] ints = new Integer[SIZE]; q.addAll(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} @@ -149,11 +151,11 @@ public class AbstractQueueTest extends J * possibly adding some elements */ public void testAddAll3() { + Succeed q = new Succeed(); + Integer[] ints = new Integer[SIZE]; + for (int i = 0; i < SIZE-1; ++i) + ints[i] = new Integer(i); try { - Succeed q = new Succeed(); - 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) {}