82 |
|
assertEquals(0, q.remainingCapacity()); |
83 |
|
q.add(one); |
84 |
|
shouldThrow(); |
85 |
< |
} catch (IllegalStateException success){ |
85 |
> |
} catch (IllegalStateException success) { |
86 |
|
} |
87 |
|
} |
88 |
|
|
146 |
|
q.put(null); |
147 |
|
shouldThrow(); |
148 |
|
} |
149 |
< |
catch (NullPointerException success){ |
149 |
> |
catch (NullPointerException success) { |
150 |
|
} |
151 |
|
catch (InterruptedException ie) { |
152 |
|
unexpectedException(); |
163 |
|
SynchronousQueue q = new SynchronousQueue(); |
164 |
|
q.put(zero); |
165 |
|
threadShouldThrow(); |
166 |
< |
} catch (InterruptedException ie){ |
166 |
> |
} catch (InterruptedException ie) { |
167 |
|
} |
168 |
|
}}); |
169 |
|
t.start(); |
195 |
|
q.put(new Object()); |
196 |
|
++added; |
197 |
|
threadShouldThrow(); |
198 |
< |
} catch (InterruptedException e){ |
198 |
> |
} catch (InterruptedException e) { |
199 |
|
assertTrue(added >= 1); |
200 |
|
} |
201 |
|
} |
207 |
|
Thread.sleep(SHORT_DELAY_MS); |
208 |
|
t.interrupt(); |
209 |
|
t.join(); |
210 |
< |
} catch (Exception e){ |
210 |
> |
} catch (Exception e) { |
211 |
|
unexpectedException(); |
212 |
|
} |
213 |
|
} |
224 |
|
threadAssertFalse(q.offer(new Object(), SHORT_DELAY_MS, TimeUnit.MILLISECONDS)); |
225 |
|
q.offer(new Object(), LONG_DELAY_MS, TimeUnit.MILLISECONDS); |
226 |
|
threadShouldThrow(); |
227 |
< |
} catch (InterruptedException success){} |
227 |
> |
} catch (InterruptedException success) {} |
228 |
|
} |
229 |
|
}); |
230 |
|
|
233 |
|
Thread.sleep(SMALL_DELAY_MS); |
234 |
|
t.interrupt(); |
235 |
|
t.join(); |
236 |
< |
} catch (Exception e){ |
236 |
> |
} catch (Exception e) { |
237 |
|
unexpectedException(); |
238 |
|
} |
239 |
|
} |
249 |
|
try { |
250 |
|
q.take(); |
251 |
|
threadShouldThrow(); |
252 |
< |
} catch (InterruptedException success){ } |
252 |
> |
} catch (InterruptedException success) { } |
253 |
|
} |
254 |
|
}); |
255 |
|
try { |
257 |
|
Thread.sleep(SHORT_DELAY_MS); |
258 |
|
t.interrupt(); |
259 |
|
t.join(); |
260 |
< |
} catch (Exception e){ |
260 |
> |
} catch (Exception e) { |
261 |
|
unexpectedException(); |
262 |
|
} |
263 |
|
} |
273 |
|
SynchronousQueue q = new SynchronousQueue(true); |
274 |
|
q.put(zero); |
275 |
|
threadShouldThrow(); |
276 |
< |
} catch (InterruptedException ie){ |
276 |
> |
} catch (InterruptedException ie) { |
277 |
|
} |
278 |
|
}}); |
279 |
|
t.start(); |
305 |
|
q.put(new Object()); |
306 |
|
++added; |
307 |
|
threadShouldThrow(); |
308 |
< |
} catch (InterruptedException e){ |
308 |
> |
} catch (InterruptedException e) { |
309 |
|
assertTrue(added >= 1); |
310 |
|
} |
311 |
|
} |
317 |
|
Thread.sleep(SHORT_DELAY_MS); |
318 |
|
t.interrupt(); |
319 |
|
t.join(); |
320 |
< |
} catch (Exception e){ |
320 |
> |
} catch (Exception e) { |
321 |
|
unexpectedException(); |
322 |
|
} |
323 |
|
} |
334 |
|
threadAssertFalse(q.offer(new Object(), SHORT_DELAY_MS, TimeUnit.MILLISECONDS)); |
335 |
|
q.offer(new Object(), LONG_DELAY_MS, TimeUnit.MILLISECONDS); |
336 |
|
threadShouldThrow(); |
337 |
< |
} catch (InterruptedException success){} |
337 |
> |
} catch (InterruptedException success) {} |
338 |
|
} |
339 |
|
}); |
340 |
|
|
343 |
|
Thread.sleep(SMALL_DELAY_MS); |
344 |
|
t.interrupt(); |
345 |
|
t.join(); |
346 |
< |
} catch (Exception e){ |
346 |
> |
} catch (Exception e) { |
347 |
|
unexpectedException(); |
348 |
|
} |
349 |
|
} |
359 |
|
try { |
360 |
|
q.take(); |
361 |
|
threadShouldThrow(); |
362 |
< |
} catch (InterruptedException success){ } |
362 |
> |
} catch (InterruptedException success) { } |
363 |
|
} |
364 |
|
}); |
365 |
|
try { |
367 |
|
Thread.sleep(SHORT_DELAY_MS); |
368 |
|
t.interrupt(); |
369 |
|
t.join(); |
370 |
< |
} catch (Exception e){ |
370 |
> |
} catch (Exception e) { |
371 |
|
unexpectedException(); |
372 |
|
} |
373 |
|
} |
387 |
|
try { |
388 |
|
SynchronousQueue q = new SynchronousQueue(); |
389 |
|
assertNull(q.poll(0, TimeUnit.MILLISECONDS)); |
390 |
< |
} catch (InterruptedException e){ |
390 |
> |
} catch (InterruptedException e) { |
391 |
|
unexpectedException(); |
392 |
|
} |
393 |
|
} |
399 |
|
try { |
400 |
|
SynchronousQueue q = new SynchronousQueue(); |
401 |
|
assertNull(q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS)); |
402 |
< |
} catch (InterruptedException e){ |
402 |
> |
} catch (InterruptedException e) { |
403 |
|
unexpectedException(); |
404 |
|
} |
405 |
|
} |
414 |
|
try { |
415 |
|
SynchronousQueue q = new SynchronousQueue(); |
416 |
|
assertNull(q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS)); |
417 |
< |
} catch (InterruptedException success){ |
417 |
> |
} catch (InterruptedException success) { |
418 |
|
} |
419 |
|
}}); |
420 |
|
t.start(); |
450 |
|
assertTrue(q.offer(zero, SHORT_DELAY_MS, TimeUnit.MILLISECONDS)); |
451 |
|
t.interrupt(); |
452 |
|
t.join(); |
453 |
< |
} catch (Exception e){ |
453 |
> |
} catch (Exception e) { |
454 |
|
unexpectedException(); |
455 |
|
} |
456 |
|
} |
465 |
|
try { |
466 |
|
SynchronousQueue q = new SynchronousQueue(true); |
467 |
|
assertNull(q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS)); |
468 |
< |
} catch (InterruptedException success){ |
468 |
> |
} catch (InterruptedException success) { |
469 |
|
} |
470 |
|
}}); |
471 |
|
t.start(); |
501 |
|
assertTrue(q.offer(zero, SHORT_DELAY_MS, TimeUnit.MILLISECONDS)); |
502 |
|
t.interrupt(); |
503 |
|
t.join(); |
504 |
< |
} catch (Exception e){ |
504 |
> |
} catch (Exception e) { |
505 |
|
unexpectedException(); |
506 |
|
} |
507 |
|
} |
535 |
|
try { |
536 |
|
q.remove(); |
537 |
|
shouldThrow(); |
538 |
< |
} catch (NoSuchElementException success){ |
538 |
> |
} catch (NoSuchElementException success) { |
539 |
|
} |
540 |
|
} |
541 |
|
|
625 |
|
SynchronousQueue q = new SynchronousQueue(); |
626 |
|
Object o[] = q.toArray(null); |
627 |
|
shouldThrow(); |
628 |
< |
} catch (NullPointerException success){} |
628 |
> |
} catch (NullPointerException success) {} |
629 |
|
} |
630 |
|
|
631 |
|
|
754 |
|
assertEquals(q.size(), r.size()); |
755 |
|
while (!q.isEmpty()) |
756 |
|
assertEquals(q.remove(), r.remove()); |
757 |
< |
} catch (Exception e){ |
757 |
> |
} catch (Exception e) { |
758 |
|
e.printStackTrace(); |
759 |
|
unexpectedException(); |
760 |
|
} |
804 |
|
public void run() { |
805 |
|
try { |
806 |
|
q.put(new Integer(1)); |
807 |
< |
} catch (InterruptedException ie){ |
807 |
> |
} catch (InterruptedException ie) { |
808 |
|
threadUnexpectedException(); |
809 |
|
} |
810 |
|
} |
819 |
|
assertEquals(l.get(0), new Integer(1)); |
820 |
|
t.join(); |
821 |
|
assertTrue(l.size() <= 1); |
822 |
< |
} catch (Exception e){ |
822 |
> |
} catch (Exception e) { |
823 |
|
unexpectedException(); |
824 |
|
} |
825 |
|
} |
857 |
|
public void run() { |
858 |
|
try { |
859 |
|
q.put(one); |
860 |
< |
} catch (InterruptedException ie){ |
860 |
> |
} catch (InterruptedException ie) { |
861 |
|
threadUnexpectedException(); |
862 |
|
} |
863 |
|
} |
866 |
|
public void run() { |
867 |
|
try { |
868 |
|
q.put(two); |
869 |
< |
} catch (InterruptedException ie){ |
869 |
> |
} catch (InterruptedException ie) { |
870 |
|
threadUnexpectedException(); |
871 |
|
} |
872 |
|
} |
885 |
|
assertTrue(l.contains(two)); |
886 |
|
t1.join(); |
887 |
|
t2.join(); |
888 |
< |
} catch (Exception e){ |
888 |
> |
} catch (Exception e) { |
889 |
|
unexpectedException(); |
890 |
|
} |
891 |
|
} |