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

Comparing jsr166/src/test/tck/ConcurrentLinkedDequeTest.java (file contents):
Revision 1.17 by jsr166, Sat Jan 17 22:55:06 2015 UTC vs.
Revision 1.21 by jsr166, Sat May 23 00:53:08 2015 UTC

# Line 21 | Line 21 | import junit.framework.TestSuite;
21   public class ConcurrentLinkedDequeTest extends JSR166TestCase {
22  
23      public static void main(String[] args) {
24 <        junit.textui.TestRunner.run(suite());
24 >        main(suite(), args);
25      }
26  
27      public static Test suite() {
# Line 55 | Line 55 | public class ConcurrentLinkedDequeTest e
55       */
56      public void testConstructor3() {
57          try {
58 <            ConcurrentLinkedDeque q = new ConcurrentLinkedDeque((Collection)null);
58 >            new ConcurrentLinkedDeque((Collection)null);
59              shouldThrow();
60          } catch (NullPointerException success) {}
61      }
# Line 65 | Line 65 | public class ConcurrentLinkedDequeTest e
65       */
66      public void testConstructor4() {
67          try {
68 <            Integer[] ints = new Integer[SIZE];
69 <            ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(Arrays.asList(ints));
68 >            new ConcurrentLinkedDeque(Arrays.asList(new Integer[SIZE]));
69              shouldThrow();
70          } catch (NullPointerException success) {}
71      }
# Line 75 | Line 74 | public class ConcurrentLinkedDequeTest e
74       * Initializing from Collection with some null elements throws NPE
75       */
76      public void testConstructor5() {
77 +        Integer[] ints = new Integer[SIZE];
78 +        for (int i = 0; i < SIZE - 1; ++i)
79 +            ints[i] = new Integer(i);
80          try {
81 <            Integer[] ints = new Integer[SIZE];
80 <            for (int i = 0; i < SIZE-1; ++i)
81 <                ints[i] = new Integer(i);
82 <            ConcurrentLinkedDeque q = new ConcurrentLinkedDeque(Arrays.asList(ints));
81 >            new ConcurrentLinkedDeque(Arrays.asList(ints));
82              shouldThrow();
83          } catch (NullPointerException success) {}
84      }
# Line 116 | Line 115 | public class ConcurrentLinkedDequeTest e
115      public void testSize() {
116          ConcurrentLinkedDeque q = populatedDeque(SIZE);
117          for (int i = 0; i < SIZE; ++i) {
118 <            assertEquals(SIZE-i, q.size());
118 >            assertEquals(SIZE - i, q.size());
119              q.remove();
120          }
121          for (int i = 0; i < SIZE; ++i) {
# Line 129 | Line 128 | public class ConcurrentLinkedDequeTest e
128       * push(null) throws NPE
129       */
130      public void testPushNull() {
131 +        ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
132          try {
133            ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
133              q.push(null);
134              shouldThrow();
135          } catch (NullPointerException success) {}
# Line 164 | Line 163 | public class ConcurrentLinkedDequeTest e
163       * offer(null) throws NPE
164       */
165      public void testOfferNull() {
166 +        ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
167          try {
168            ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
168              q.offer(null);
169              shouldThrow();
170          } catch (NullPointerException success) {}
# Line 175 | Line 174 | public class ConcurrentLinkedDequeTest e
174       * offerFirst(null) throws NPE
175       */
176      public void testOfferFirstNull() {
177 +        ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
178          try {
179            ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
179              q.offerFirst(null);
180              shouldThrow();
181          } catch (NullPointerException success) {}
# Line 186 | Line 185 | public class ConcurrentLinkedDequeTest e
185       * offerLast(null) throws NPE
186       */
187      public void testOfferLastNull() {
188 +        ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
189          try {
190            ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
190              q.offerLast(null);
191              shouldThrow();
192          } catch (NullPointerException success) {}
# Line 230 | Line 229 | public class ConcurrentLinkedDequeTest e
229       * add(null) throws NPE
230       */
231      public void testAddNull() {
232 +        ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
233          try {
234            ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
234              q.add(null);
235              shouldThrow();
236          } catch (NullPointerException success) {}
# Line 241 | Line 240 | public class ConcurrentLinkedDequeTest e
240       * addFirst(null) throws NPE
241       */
242      public void testAddFirstNull() {
243 +        ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
244          try {
245            ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
245              q.addFirst(null);
246              shouldThrow();
247          } catch (NullPointerException success) {}
# Line 252 | Line 251 | public class ConcurrentLinkedDequeTest e
251       * addLast(null) throws NPE
252       */
253      public void testAddLastNull() {
254 +        ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
255          try {
256            ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
256              q.addLast(null);
257              shouldThrow();
258          } catch (NullPointerException success) {}
# Line 296 | Line 295 | public class ConcurrentLinkedDequeTest e
295       * addAll(null) throws NPE
296       */
297      public void testAddAll1() {
298 +        ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
299          try {
300            ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
300              q.addAll(null);
301              shouldThrow();
302          } catch (NullPointerException success) {}
# Line 307 | Line 306 | public class ConcurrentLinkedDequeTest e
306       * addAll(this) throws IAE
307       */
308      public void testAddAllSelf() {
309 +        ConcurrentLinkedDeque q = populatedDeque(SIZE);
310          try {
311            ConcurrentLinkedDeque q = populatedDeque(SIZE);
311              q.addAll(q);
312              shouldThrow();
313          } catch (IllegalArgumentException success) {}
# Line 318 | Line 317 | public class ConcurrentLinkedDequeTest e
317       * addAll of a collection with null elements throws NPE
318       */
319      public void testAddAll2() {
320 +        ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
321          try {
322 <            ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
323 <            Integer[] ints = new Integer[SIZE];
324 <            q.addAll(Arrays.asList(ints));
322 >            q.addAll(Arrays.asList(new Integer[SIZE]));
323              shouldThrow();
324          } catch (NullPointerException success) {}
325      }
# Line 331 | Line 329 | public class ConcurrentLinkedDequeTest e
329       * possibly adding some elements
330       */
331      public void testAddAll3() {
332 +        ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
333 +        Integer[] ints = new Integer[SIZE];
334 +        for (int i = 0; i < SIZE - 1; ++i)
335 +            ints[i] = new Integer(i);
336          try {
335            ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
336            Integer[] ints = new Integer[SIZE];
337            for (int i = 0; i < SIZE-1; ++i)
338                ints[i] = new Integer(i);
337              q.addAll(Arrays.asList(ints));
338              shouldThrow();
339          } catch (NullPointerException success) {}
# Line 372 | Line 370 | public class ConcurrentLinkedDequeTest e
370       */
371      public void testPollLast() {
372          ConcurrentLinkedDeque q = populatedDeque(SIZE);
373 <        for (int i = SIZE-1; i >= 0; --i) {
373 >        for (int i = SIZE - 1; i >= 0; --i) {
374              assertEquals(i, q.pollLast());
375          }
376          assertNull(q.pollLast());
# Line 472 | Line 470 | public class ConcurrentLinkedDequeTest e
470       */
471      public void testPeekLast() {
472          ConcurrentLinkedDeque q = populatedDeque(SIZE);
473 <        for (int i = SIZE-1; i >= 0; --i) {
473 >        for (int i = SIZE - 1; i >= 0; --i) {
474              assertEquals(i, q.peekLast());
475              assertEquals(i, q.pollLast());
476              assertTrue(q.peekLast() == null ||
# Line 501 | Line 499 | public class ConcurrentLinkedDequeTest e
499       */
500      public void testLastElement() {
501          ConcurrentLinkedDeque q = populatedDeque(SIZE);
502 <        for (int i = SIZE-1; i >= 0; --i) {
502 >        for (int i = SIZE - 1; i >= 0; --i) {
503              assertEquals(i, q.getLast());
504              assertEquals(i, q.pollLast());
505          }
# Line 626 | Line 624 | public class ConcurrentLinkedDequeTest e
624                  assertTrue(changed);
625  
626              assertTrue(q.containsAll(p));
627 <            assertEquals(SIZE-i, q.size());
627 >            assertEquals(SIZE - i, q.size());
628              p.remove();
629          }
630      }
# Line 639 | Line 637 | public class ConcurrentLinkedDequeTest e
637              ConcurrentLinkedDeque q = populatedDeque(SIZE);
638              ConcurrentLinkedDeque p = populatedDeque(i);
639              assertTrue(q.removeAll(p));
640 <            assertEquals(SIZE-i, q.size());
640 >            assertEquals(SIZE - i, q.size());
641              for (int j = 0; j < i; ++j) {
642                  Integer x = (Integer)(p.remove());
643                  assertFalse(q.contains(x));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines