ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/AbstractQueueTest.java
(Generate patch)

Comparing jsr166/src/test/tck/AbstractQueueTest.java (file contents):
Revision 1.18 by jsr166, Wed Jan 10 16:47:12 2018 UTC vs.
Revision 1.19 by dl, Tue Jan 26 13:33:05 2021 UTC

# Line 22 | Line 22 | public class AbstractQueueTest extends J
22          return new TestSuite(AbstractQueueTest.class);
23      }
24  
25 <    static class Succeed extends AbstractQueue<Integer> {
26 <        public boolean offer(Integer x) {
25 >    static class Succeed extends AbstractQueue<Item> {
26 >        public boolean offer(Item x) {
27              if (x == null) throw new NullPointerException();
28              return true;
29          }
30 <        public Integer peek() { return one; }
31 <        public Integer poll() { return one; }
30 >        public Item peek() { return one; }
31 >        public Item poll() { return one; }
32          public int size() { return 0; }
33 <        public Iterator iterator() { return null; } // not needed
33 >        public Iterator<Item> iterator() { return null; } // not needed
34      }
35  
36 <    static class Fail extends AbstractQueue<Integer> {
37 <        public boolean offer(Integer x) {
36 >    static class Fail extends AbstractQueue<Item> {
37 >        public boolean offer(Item x) {
38              if (x == null) throw new NullPointerException();
39              return false;
40          }
41 <        public Integer peek() { return null; }
42 <        public Integer poll() { return null; }
41 >        public Item peek() { return null; }
42 >        public Item poll() { return null; }
43          public int size() { return 0; }
44 <        public Iterator iterator() { return null; } // not needed
44 >        public Iterator<Item> iterator() { return null; } // not needed
45      }
46  
47      /**
# Line 139 | Line 139 | public class AbstractQueueTest extends J
139       */
140      public void testAddAll2() {
141          Succeed q = new Succeed();
142 <        Integer[] ints = new Integer[SIZE];
142 >        Item[] items = new Item[SIZE];
143          try {
144 <            q.addAll(Arrays.asList(ints));
144 >            q.addAll(Arrays.asList(items));
145              shouldThrow();
146          } catch (NullPointerException success) {}
147      }
# Line 152 | Line 152 | public class AbstractQueueTest extends J
152       */
153      public void testAddAll3() {
154          Succeed q = new Succeed();
155 <        Integer[] ints = new Integer[SIZE];
155 >        Item[] items = new Item[SIZE];
156          for (int i = 0; i < SIZE - 1; ++i)
157 <            ints[i] = new Integer(i);
157 >            items[i] = itemFor(i);
158          try {
159 <            q.addAll(Arrays.asList(ints));
159 >            q.addAll(Arrays.asList(items));
160              shouldThrow();
161          } catch (NullPointerException success) {}
162      }
# Line 166 | Line 166 | public class AbstractQueueTest extends J
166       */
167      public void testAddAll4() {
168          Fail q = new Fail();
169 <        Integer[] ints = new Integer[SIZE];
170 <        for (int i = 0; i < SIZE; ++i)
171 <            ints[i] = new Integer(i);
169 >        Item[] items = seqItems(SIZE);
170          try {
171 <            q.addAll(Arrays.asList(ints));
171 >            q.addAll(Arrays.asList(items));
172              shouldThrow();
173          } catch (IllegalStateException success) {}
174      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines