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

Comparing jsr166/src/test/tck/LinkedBlockingQueueTest.java (file contents):
Revision 1.35 by jsr166, Wed Nov 3 16:46:34 2010 UTC vs.
Revision 1.37 by jsr166, Fri Nov 5 00:17:22 2010 UTC

# Line 41 | Line 41 | public class LinkedBlockingQueueTest ext
41       * Create a queue of given size containing consecutive
42       * Integers 0 ... n.
43       */
44 <    private LinkedBlockingQueue populatedQueue(int n) {
45 <        LinkedBlockingQueue q = new LinkedBlockingQueue(n);
44 >    private LinkedBlockingQueue<Integer> populatedQueue(int n) {
45 >        LinkedBlockingQueue<Integer> q =
46 >            new LinkedBlockingQueue<Integer>(n);
47          assertTrue(q.isEmpty());
48          for (int i = 0; i < n; i++)
49              assertTrue(q.offer(new Integer(i)));
# Line 607 | Line 608 | public class LinkedBlockingQueueTest ext
608      }
609  
610      /**
611 <     * toArray contains all elements
611 >     * toArray contains all elements in FIFO order
612       */
613 <    public void testToArray() throws InterruptedException {
613 >    public void testToArray() {
614          LinkedBlockingQueue q = populatedQueue(SIZE);
615          Object[] o = q.toArray();
616          for (int i = 0; i < o.length; i++)
617 <            assertEquals(o[i], q.take());
617 >            assertSame(o[i], q.poll());
618      }
619  
620      /**
621 <     * toArray(a) contains all elements
621 >     * toArray(a) contains all elements in FIFO order
622       */
623      public void testToArray2() throws InterruptedException {
624 <        LinkedBlockingQueue q = populatedQueue(SIZE);
624 >        LinkedBlockingQueue<Integer> q = populatedQueue(SIZE);
625          Integer[] ints = new Integer[SIZE];
626 <        ints = (Integer[])q.toArray(ints);
626 >        Integer[] array = q.toArray(ints);
627 >        assertSame(ints, array);
628          for (int i = 0; i < ints.length; i++)
629 <            assertEquals(ints[i], q.take());
629 >            assertSame(ints[i], q.poll());
630      }
631  
632      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines