894 |
|
assert(q.peek() != null); |
895 |
|
} |
896 |
|
|
897 |
+ |
|
898 |
|
/** |
899 |
|
* poll of a non-empty queue returns null if no expired elements. |
900 |
|
*/ |
905 |
|
} |
906 |
|
|
907 |
|
/** |
908 |
+ |
* timed poll of a non-empty queue returns null if no expired elements. |
909 |
+ |
*/ |
910 |
+ |
public void testTimedPollDelayed() { |
911 |
+ |
DelayQueue q = new DelayQueue(); |
912 |
+ |
q.add(new NanoDelay(LONG_DELAY_MS * 1000000L)); |
913 |
+ |
try { |
914 |
+ |
assertNull(q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS)); |
915 |
+ |
} catch (Exception ex) { |
916 |
+ |
unexpectedException(); |
917 |
+ |
} |
918 |
+ |
} |
919 |
+ |
|
920 |
+ |
/** |
921 |
|
* drainTo(null) throws NPE |
922 |
|
*/ |
923 |
|
public void testDrainToNull() { |