--- jsr166/src/test/tck/AbstractQueueTest.java 2018/01/10 16:47:12 1.18 +++ jsr166/src/test/tck/AbstractQueueTest.java 2021/01/26 13:33:05 1.19 @@ -22,26 +22,26 @@ public class AbstractQueueTest extends J return new TestSuite(AbstractQueueTest.class); } - static class Succeed extends AbstractQueue { - public boolean offer(Integer x) { + static class Succeed extends AbstractQueue { + public boolean offer(Item x) { if (x == null) throw new NullPointerException(); return true; } - public Integer peek() { return one; } - public Integer poll() { return one; } + public Item peek() { return one; } + public Item poll() { return one; } public int size() { return 0; } - public Iterator iterator() { return null; } // not needed + public Iterator iterator() { return null; } // not needed } - static class Fail extends AbstractQueue { - public boolean offer(Integer x) { + static class Fail extends AbstractQueue { + public boolean offer(Item x) { if (x == null) throw new NullPointerException(); return false; } - public Integer peek() { return null; } - public Integer poll() { return null; } + public Item peek() { return null; } + public Item poll() { return null; } public int size() { return 0; } - public Iterator iterator() { return null; } // not needed + public Iterator iterator() { return null; } // not needed } /** @@ -139,9 +139,9 @@ public class AbstractQueueTest extends J */ public void testAddAll2() { Succeed q = new Succeed(); - Integer[] ints = new Integer[SIZE]; + Item[] items = new Item[SIZE]; try { - q.addAll(Arrays.asList(ints)); + q.addAll(Arrays.asList(items)); shouldThrow(); } catch (NullPointerException success) {} } @@ -152,11 +152,11 @@ public class AbstractQueueTest extends J */ public void testAddAll3() { Succeed q = new Succeed(); - Integer[] ints = new Integer[SIZE]; + Item[] items = new Item[SIZE]; for (int i = 0; i < SIZE - 1; ++i) - ints[i] = new Integer(i); + items[i] = itemFor(i); try { - q.addAll(Arrays.asList(ints)); + q.addAll(Arrays.asList(items)); shouldThrow(); } catch (NullPointerException success) {} } @@ -166,11 +166,9 @@ public class AbstractQueueTest extends J */ public void testAddAll4() { Fail q = new Fail(); - Integer[] ints = new Integer[SIZE]; - for (int i = 0; i < SIZE; ++i) - ints[i] = new Integer(i); + Item[] items = seqItems(SIZE); try { - q.addAll(Arrays.asList(ints)); + q.addAll(Arrays.asList(items)); shouldThrow(); } catch (IllegalStateException success) {} }