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.4 by jsr166, Thu Nov 4 01:04:54 2010 UTC vs.
Revision 1.7 by jsr166, Tue Mar 15 19:47:06 2011 UTC

# Line 1 | Line 1
1   /*
2   * Written by Doug Lea with assistance from members of JCP JSR-166
3   * Expert Group and released to the public domain, as explained at
4 < * http://creativecommons.org/licenses/publicdomain
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   * Other contributors include Andrew Wright, Jeffrey Hayes,
6   * Pat Fisher, Mike Judd.
7   */
# Line 25 | Line 25 | public class ConcurrentLinkedDequeTest e
25       * Create a deque of given size containing consecutive
26       * Integers 0 ... n.
27       */
28 <    private ConcurrentLinkedDeque populatedDeque(int n) {
29 <        ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
28 >    private ConcurrentLinkedDeque<Integer> populatedDeque(int n) {
29 >        ConcurrentLinkedDeque<Integer> q = new ConcurrentLinkedDeque<Integer>();
30          assertTrue(q.isEmpty());
31          for (int i = 0; i < n; ++i)
32              assertTrue(q.offer(new Integer(i)));
# Line 431 | Line 431 | public class ConcurrentLinkedDequeTest e
431      public void testRemoveElement() {
432          ConcurrentLinkedDeque q = populatedDeque(SIZE);
433          for (int i = 1; i < SIZE; i+=2) {
434 <            assertTrue(q.remove(new Integer(i)));
434 >            assertTrue(q.contains(i));
435 >            assertTrue(q.remove(i));
436 >            assertFalse(q.contains(i));
437 >            assertTrue(q.contains(i-1));
438          }
439          for (int i = 0; i < SIZE; i+=2) {
440 <            assertTrue(q.remove(new Integer(i)));
441 <            assertFalse(q.remove(new Integer(i+1)));
440 >            assertTrue(q.contains(i));
441 >            assertTrue(q.remove(i));
442 >            assertFalse(q.contains(i));
443 >            assertFalse(q.remove(i+1));
444 >            assertFalse(q.contains(i+1));
445          }
446          assertTrue(q.isEmpty());
447      }
# Line 648 | Line 654 | public class ConcurrentLinkedDequeTest e
654       * toArray(a) contains all elements in FIFO order
655       */
656      public void testToArray2() {
657 <        ConcurrentLinkedDeque q = populatedDeque(SIZE);
657 >        ConcurrentLinkedDeque<Integer> q = populatedDeque(SIZE);
658          Integer[] ints = new Integer[SIZE];
659 <        assertSame(ints, q.toArray(ints));
659 >        Integer[] array = q.toArray(ints);
660 >        assertSame(ints, array);
661          for (int i = 0; i < ints.length; i++)
662              assertSame(ints[i], q.poll());
663      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines