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; |
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 |
|
} |
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); |
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 |
|
|
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 |
|
} |