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.58 by jsr166, Sat Nov 26 05:42:14 2011 UTC vs.
Revision 1.63 by jsr166, Sun Nov 23 22:27:06 2014 UTC

# Line 9 | Line 9
9   import junit.framework.*;
10   import java.util.Arrays;
11   import java.util.ArrayList;
12 + import java.util.Collection;
13   import java.util.Iterator;
14   import java.util.NoSuchElementException;
15   import java.util.concurrent.BlockingQueue;
# Line 62 | Line 63 | public class DelayQueueTest extends JSR1
63              return (other instanceof PDelay) &&
64                  this.pseudodelay == ((PDelay)other).pseudodelay;
65          }
66 +        // suppress [overrides] javac warning
67 +        public int hashCode() { return pseudodelay; }
68          public long getDelay(TimeUnit ignore) {
69              return Integer.MIN_VALUE + pseudodelay;
70          }
# Line 97 | Line 100 | public class DelayQueueTest extends JSR1
100              return other.trigger == trigger;
101          }
102  
103 +        // suppress [overrides] javac warning
104 +        public int hashCode() { return (int) trigger; }
105 +
106          public long getDelay(TimeUnit unit) {
107              long n = trigger - System.nanoTime();
108              return unit.convert(n, TimeUnit.NANOSECONDS);
# Line 112 | Line 118 | public class DelayQueueTest extends JSR1
118      }
119  
120      /**
121 <     * Create a queue of given size containing consecutive
121 >     * Returns a new queue of given size containing consecutive
122       * PDelays 0 ... n.
123       */
124      private DelayQueue<PDelay> populatedQueue(int n) {
# Line 646 | Line 652 | public class DelayQueueTest extends JSR1
652              public void realRun() throws InterruptedException {
653                  assertNull(q.poll());
654                  threadsStarted.await();
655 <                assertTrue(null != q.poll(LONG_DELAY_MS, MILLISECONDS));
655 >                assertNotNull(q.poll(LONG_DELAY_MS, MILLISECONDS));
656                  checkEmpty(q);
657              }});
658  
# Line 766 | Line 772 | public class DelayQueueTest extends JSR1
772          }
773      }
774  
775 +    /**
776 +     * remove(null), contains(null) always return false
777 +     */
778 +    public void testNeverContainsNull() {
779 +        Collection<?> q = populatedQueue(SIZE);
780 +        assertFalse(q.contains(null));
781 +        assertFalse(q.remove(null));
782 +    }
783   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines