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

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

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines