5 |
|
* http://creativecommons.org/publicdomain/zero/1.0/ |
6 |
|
*/ |
7 |
|
|
8 |
+ |
import static java.util.concurrent.TimeUnit.HOURS; |
9 |
|
import static java.util.concurrent.TimeUnit.MILLISECONDS; |
10 |
|
|
11 |
|
import java.util.ArrayList; |
170 |
|
() -> d.push(null), |
171 |
|
() -> d.descendingIterator().forEachRemaining(null)); |
172 |
|
} |
173 |
< |
if (!impl.permitsNulls() && c instanceof BlockingQueue) { |
173 |
> |
if (c instanceof BlockingQueue) { |
174 |
|
BlockingQueue q = (BlockingQueue) c; |
175 |
|
assertThrows( |
176 |
|
NullPointerException.class, |
177 |
|
() -> { |
178 |
< |
try { q.offer(null, 1L, MILLISECONDS); } |
178 |
> |
try { q.offer(null, 1L, HOURS); } |
179 |
> |
catch (InterruptedException ex) { |
180 |
> |
throw new AssertionError(ex); |
181 |
> |
}}, |
182 |
> |
() -> { |
183 |
> |
try { q.put(null); } |
184 |
|
catch (InterruptedException ex) { |
185 |
|
throw new AssertionError(ex); |
186 |
|
}}); |
187 |
|
} |
188 |
< |
if (!impl.permitsNulls() && c instanceof BlockingDeque) { |
188 |
> |
if (c instanceof BlockingDeque) { |
189 |
|
BlockingDeque q = (BlockingDeque) c; |
190 |
|
assertThrows( |
191 |
|
NullPointerException.class, |
192 |
|
() -> { |
193 |
< |
try { q.offerFirst(null, 1L, MILLISECONDS); } |
193 |
> |
try { q.offerFirst(null, 1L, HOURS); } |
194 |
> |
catch (InterruptedException ex) { |
195 |
> |
throw new AssertionError(ex); |
196 |
> |
}}, |
197 |
> |
() -> { |
198 |
> |
try { q.offerLast(null, 1L, HOURS); } |
199 |
> |
catch (InterruptedException ex) { |
200 |
> |
throw new AssertionError(ex); |
201 |
> |
}}, |
202 |
> |
() -> { |
203 |
> |
try { q.putFirst(null); } |
204 |
|
catch (InterruptedException ex) { |
205 |
|
throw new AssertionError(ex); |
206 |
|
}}, |
207 |
|
() -> { |
208 |
< |
try { q.offerLast(null, 1L, MILLISECONDS); } |
208 |
> |
try { q.putLast(null); } |
209 |
|
catch (InterruptedException ex) { |
210 |
|
throw new AssertionError(ex); |
211 |
|
}}); |
257 |
|
} |
258 |
|
}; |
259 |
|
try { |
244 |
– |
assertFalse(survivors.contains(null)); |
260 |
|
try { |
261 |
|
boolean modified = c.removeIf(randomPredicate); |
262 |
|
if (!modified) { |