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

Comparing jsr166/src/test/tck/DelayQueueTest.java (file contents):
Revision 1.55 by jsr166, Mon Jun 27 20:37:32 2011 UTC vs.
Revision 1.58 by jsr166, Sat Nov 26 05:42:14 2011 UTC

# Line 482 | Line 482 | public class DelayQueueTest extends JSR1
482      }
483  
484      /**
485     * remove(x) removes x and returns true if present
486     */
487    public void testRemoveElement() {
488        DelayQueue q = populatedQueue(SIZE);
489        for (int i = 1; i < SIZE; i+=2) {
490            assertTrue(q.remove(new PDelay(i)));
491        }
492        for (int i = 0; i < SIZE; i+=2) {
493            assertTrue(q.remove(new PDelay(i)));
494            assertFalse(q.remove(new PDelay(i+1)));
495        }
496        assertTrue(q.isEmpty());
497    }
498
499    /**
485       * contains(x) reports true when elements added but not yet removed
486       */
487      public void testContains() {
# Line 635 | Line 620 | public class DelayQueueTest extends JSR1
620          it.next();
621          it.remove();
622          it = q.iterator();
623 <        assertEquals(it.next(), new PDelay(2));
624 <        assertEquals(it.next(), new PDelay(3));
623 >        assertEquals(new PDelay(2), it.next());
624 >        assertEquals(new PDelay(3), it.next());
625          assertFalse(it.hasNext());
626      }
627  
# Line 733 | Line 718 | public class DelayQueueTest extends JSR1
718          }
719          ArrayList l = new ArrayList();
720          q.drainTo(l);
721 <        assertEquals(q.size(), 0);
721 >        assertEquals(0, q.size());
722          for (int i = 0; i < SIZE; ++i)
723 <            assertEquals(l.get(i), elems[i]);
723 >            assertEquals(elems[i], l.get(i));
724          q.add(elems[0]);
725          q.add(elems[1]);
726          assertFalse(q.isEmpty());
# Line 743 | Line 728 | public class DelayQueueTest extends JSR1
728          assertTrue(q.contains(elems[1]));
729          l.clear();
730          q.drainTo(l);
731 <        assertEquals(q.size(), 0);
732 <        assertEquals(l.size(), 2);
731 >        assertEquals(0, q.size());
732 >        assertEquals(2, l.size());
733          for (int i = 0; i < 2; ++i)
734 <            assertEquals(l.get(i), elems[i]);
734 >            assertEquals(elems[i], l.get(i));
735      }
736  
737      /**
# Line 776 | Line 761 | public class DelayQueueTest extends JSR1
761              ArrayList l = new ArrayList();
762              q.drainTo(l, i);
763              int k = (i < SIZE) ? i : SIZE;
764 <            assertEquals(q.size(), SIZE-k);
765 <            assertEquals(l.size(), k);
764 >            assertEquals(SIZE-k, q.size());
765 >            assertEquals(k, l.size());
766          }
767      }
768  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines