50 |
|
return q; |
51 |
|
} |
52 |
|
|
53 |
< |
public void testConstructor1(){ |
53 |
> |
/** |
54 |
> |
* |
55 |
> |
*/ |
56 |
> |
public void testConstructor1() { |
57 |
|
assertEquals(NOCAP, new PriorityBlockingQueue(SIZE).remainingCapacity()); |
58 |
|
} |
59 |
|
|
60 |
< |
public void testConstructor2(){ |
60 |
> |
/** |
61 |
> |
* |
62 |
> |
*/ |
63 |
> |
public void testConstructor2() { |
64 |
|
try { |
65 |
|
PriorityBlockingQueue q = new PriorityBlockingQueue(0); |
66 |
< |
fail("Cannot make zero-sized"); |
66 |
> |
shouldThrow(); |
67 |
|
} |
68 |
|
catch (IllegalArgumentException success) {} |
69 |
|
} |
70 |
|
|
71 |
< |
public void testConstructor3(){ |
71 |
> |
/** |
72 |
> |
* |
73 |
> |
*/ |
74 |
> |
public void testConstructor3() { |
75 |
|
|
76 |
|
try { |
77 |
|
PriorityBlockingQueue q = new PriorityBlockingQueue(null); |
78 |
< |
fail("Cannot make from null collection"); |
78 |
> |
shouldThrow(); |
79 |
|
} |
80 |
|
catch (NullPointerException success) {} |
81 |
|
} |
82 |
|
|
83 |
< |
public void testConstructor4(){ |
83 |
> |
/** |
84 |
> |
* |
85 |
> |
*/ |
86 |
> |
public void testConstructor4() { |
87 |
|
try { |
88 |
|
Integer[] ints = new Integer[SIZE]; |
89 |
|
PriorityBlockingQueue q = new PriorityBlockingQueue(Arrays.asList(ints)); |
90 |
< |
fail("Cannot make with null elements"); |
90 |
> |
shouldThrow(); |
91 |
|
} |
92 |
|
catch (NullPointerException success) {} |
93 |
|
} |
94 |
|
|
95 |
< |
public void testConstructor5(){ |
95 |
> |
/** |
96 |
> |
* |
97 |
> |
*/ |
98 |
> |
public void testConstructor5() { |
99 |
|
try { |
100 |
|
Integer[] ints = new Integer[SIZE]; |
101 |
|
for (int i = 0; i < SIZE-1; ++i) |
102 |
|
ints[i] = new Integer(i); |
103 |
|
PriorityBlockingQueue q = new PriorityBlockingQueue(Arrays.asList(ints)); |
104 |
< |
fail("Cannot make with null elements"); |
104 |
> |
shouldThrow(); |
105 |
|
} |
106 |
|
catch (NullPointerException success) {} |
107 |
|
} |
108 |
|
|
109 |
< |
public void testConstructor6(){ |
109 |
> |
/** |
110 |
> |
* |
111 |
> |
*/ |
112 |
> |
public void testConstructor6() { |
113 |
|
try { |
114 |
|
Integer[] ints = new Integer[SIZE]; |
115 |
|
for (int i = 0; i < SIZE; ++i) |
121 |
|
finally {} |
122 |
|
} |
123 |
|
|
124 |
< |
public void testConstructor7(){ |
125 |
< |
try { |
126 |
< |
PriorityBlockingQueue q = new PriorityBlockingQueue(SIZE, new MyReverseComparator()); |
124 |
> |
/** |
125 |
> |
* |
126 |
> |
*/ |
127 |
> |
public void testConstructor7() { |
128 |
> |
try { |
129 |
> |
MyReverseComparator cmp = new MyReverseComparator(); |
130 |
> |
PriorityBlockingQueue q = new PriorityBlockingQueue(SIZE, cmp); |
131 |
> |
assertEquals(cmp, q.comparator()); |
132 |
|
Integer[] ints = new Integer[SIZE]; |
133 |
|
for (int i = 0; i < SIZE; ++i) |
134 |
|
ints[i] = new Integer(i); |
139 |
|
finally {} |
140 |
|
} |
141 |
|
|
142 |
+ |
/** |
143 |
+ |
* |
144 |
+ |
*/ |
145 |
|
public void testEmpty() { |
146 |
|
PriorityBlockingQueue q = new PriorityBlockingQueue(2); |
147 |
|
assertTrue(q.isEmpty()); |
154 |
|
assertTrue(q.isEmpty()); |
155 |
|
} |
156 |
|
|
157 |
< |
public void testRemainingCapacity(){ |
157 |
> |
/** |
158 |
> |
* |
159 |
> |
*/ |
160 |
> |
public void testRemainingCapacity() { |
161 |
|
PriorityBlockingQueue q = populatedQueue(SIZE); |
162 |
|
for (int i = 0; i < SIZE; ++i) { |
163 |
|
assertEquals(NOCAP, q.remainingCapacity()); |
171 |
|
} |
172 |
|
} |
173 |
|
|
174 |
< |
public void testOfferNull(){ |
174 |
> |
/** |
175 |
> |
* |
176 |
> |
*/ |
177 |
> |
public void testOfferNull() { |
178 |
|
try { |
179 |
|
PriorityBlockingQueue q = new PriorityBlockingQueue(1); |
180 |
|
q.offer(null); |
181 |
< |
fail("should throw NPE"); |
181 |
> |
shouldThrow(); |
182 |
|
} catch (NullPointerException success) { } |
183 |
|
} |
184 |
|
|
185 |
+ |
/** |
186 |
+ |
* |
187 |
+ |
*/ |
188 |
|
public void testOffer() { |
189 |
|
PriorityBlockingQueue q = new PriorityBlockingQueue(1); |
190 |
|
assertTrue(q.offer(new Integer(0))); |
191 |
|
assertTrue(q.offer(new Integer(1))); |
192 |
|
} |
193 |
|
|
194 |
+ |
/** |
195 |
+ |
* |
196 |
+ |
*/ |
197 |
|
public void testOfferNonComparable() { |
198 |
|
try { |
199 |
|
PriorityBlockingQueue q = new PriorityBlockingQueue(1); |
200 |
|
q.offer(new Object()); |
201 |
|
q.offer(new Object()); |
202 |
|
q.offer(new Object()); |
203 |
< |
fail("should throw CCE"); |
203 |
> |
shouldThrow(); |
204 |
|
} |
205 |
|
catch(ClassCastException success) {} |
206 |
|
} |
207 |
|
|
208 |
< |
public void testAdd(){ |
208 |
> |
/** |
209 |
> |
* |
210 |
> |
*/ |
211 |
> |
public void testAdd() { |
212 |
|
PriorityBlockingQueue q = new PriorityBlockingQueue(SIZE); |
213 |
|
for (int i = 0; i < SIZE; ++i) { |
214 |
|
assertEquals(i, q.size()); |
216 |
|
} |
217 |
|
} |
218 |
|
|
219 |
< |
public void testAddAll1(){ |
219 |
> |
/** |
220 |
> |
* |
221 |
> |
*/ |
222 |
> |
public void testAddAll1() { |
223 |
|
try { |
224 |
|
PriorityBlockingQueue q = new PriorityBlockingQueue(1); |
225 |
|
q.addAll(null); |
226 |
< |
fail("Cannot add null collection"); |
226 |
> |
shouldThrow(); |
227 |
|
} |
228 |
|
catch (NullPointerException success) {} |
229 |
|
} |
230 |
< |
public void testAddAll2(){ |
230 |
> |
/** |
231 |
> |
* |
232 |
> |
*/ |
233 |
> |
public void testAddAll2() { |
234 |
|
try { |
235 |
|
PriorityBlockingQueue q = new PriorityBlockingQueue(SIZE); |
236 |
|
Integer[] ints = new Integer[SIZE]; |
237 |
|
q.addAll(Arrays.asList(ints)); |
238 |
< |
fail("Cannot add null elements"); |
238 |
> |
shouldThrow(); |
239 |
|
} |
240 |
|
catch (NullPointerException success) {} |
241 |
|
} |
242 |
< |
public void testAddAll3(){ |
242 |
> |
/** |
243 |
> |
* |
244 |
> |
*/ |
245 |
> |
public void testAddAll3() { |
246 |
|
try { |
247 |
|
PriorityBlockingQueue q = new PriorityBlockingQueue(SIZE); |
248 |
|
Integer[] ints = new Integer[SIZE]; |
249 |
|
for (int i = 0; i < SIZE-1; ++i) |
250 |
|
ints[i] = new Integer(i); |
251 |
|
q.addAll(Arrays.asList(ints)); |
252 |
< |
fail("Cannot add null elements"); |
252 |
> |
shouldThrow(); |
253 |
|
} |
254 |
|
catch (NullPointerException success) {} |
255 |
|
} |
256 |
|
|
257 |
< |
public void testAddAll5(){ |
257 |
> |
/** |
258 |
> |
* |
259 |
> |
*/ |
260 |
> |
public void testAddAll5() { |
261 |
|
try { |
262 |
|
Integer[] empty = new Integer[0]; |
263 |
|
Integer[] ints = new Integer[SIZE]; |
272 |
|
finally {} |
273 |
|
} |
274 |
|
|
275 |
+ |
/** |
276 |
+ |
* |
277 |
+ |
*/ |
278 |
|
public void testPutNull() { |
279 |
|
try { |
280 |
|
PriorityBlockingQueue q = new PriorityBlockingQueue(SIZE); |
281 |
|
q.put(null); |
282 |
< |
fail("put should throw NPE"); |
282 |
> |
shouldThrow(); |
283 |
|
} |
284 |
|
catch (NullPointerException success){ |
285 |
|
} |
286 |
|
} |
287 |
|
|
288 |
+ |
/** |
289 |
+ |
* |
290 |
+ |
*/ |
291 |
|
public void testPut() { |
292 |
|
try { |
293 |
|
PriorityBlockingQueue q = new PriorityBlockingQueue(SIZE); |
302 |
|
} |
303 |
|
} |
304 |
|
|
305 |
+ |
/** |
306 |
+ |
* |
307 |
+ |
*/ |
308 |
|
public void testPutWithTake() { |
309 |
|
final PriorityBlockingQueue q = new PriorityBlockingQueue(2); |
310 |
|
Thread t = new Thread(new Runnable() { |
311 |
< |
public void run(){ |
311 |
> |
public void run() { |
312 |
|
int added = 0; |
313 |
|
try { |
314 |
|
q.put(new Integer(0)); |
331 |
|
t.interrupt(); |
332 |
|
t.join(); |
333 |
|
} catch (Exception e){ |
334 |
< |
fail("Unexpected exception"); |
334 |
> |
unexpectedException(); |
335 |
|
} |
336 |
|
} |
337 |
|
|
338 |
+ |
/** |
339 |
+ |
* |
340 |
+ |
*/ |
341 |
|
public void testTimedOffer() { |
342 |
|
final PriorityBlockingQueue q = new PriorityBlockingQueue(2); |
343 |
|
Thread t = new Thread(new Runnable() { |
344 |
< |
public void run(){ |
344 |
> |
public void run() { |
345 |
|
try { |
346 |
|
q.put(new Integer(0)); |
347 |
|
q.put(new Integer(0)); |
357 |
|
t.interrupt(); |
358 |
|
t.join(); |
359 |
|
} catch (Exception e){ |
360 |
< |
fail("Unexpected exception"); |
360 |
> |
unexpectedException(); |
361 |
|
} |
362 |
|
} |
363 |
|
|
364 |
< |
public void testTake(){ |
364 |
> |
/** |
365 |
> |
* |
366 |
> |
*/ |
367 |
> |
public void testTake() { |
368 |
|
try { |
369 |
|
PriorityBlockingQueue q = populatedQueue(SIZE); |
370 |
|
for (int i = 0; i < SIZE; ++i) { |
371 |
|
assertEquals(i, ((Integer)q.take()).intValue()); |
372 |
|
} |
373 |
|
} catch (InterruptedException e){ |
374 |
< |
fail("Unexpected exception"); |
374 |
> |
unexpectedException(); |
375 |
|
} |
376 |
|
} |
377 |
|
|
378 |
+ |
/** |
379 |
+ |
* |
380 |
+ |
*/ |
381 |
|
public void testTakeFromEmpty() { |
382 |
|
final PriorityBlockingQueue q = new PriorityBlockingQueue(2); |
383 |
|
Thread t = new Thread(new Runnable() { |
384 |
< |
public void run(){ |
384 |
> |
public void run() { |
385 |
|
try { |
386 |
|
q.take(); |
387 |
< |
threadFail("Should block"); |
387 |
> |
threadShouldThrow(); |
388 |
|
} catch (InterruptedException success){ } |
389 |
|
} |
390 |
|
}); |
394 |
|
t.interrupt(); |
395 |
|
t.join(); |
396 |
|
} catch (Exception e){ |
397 |
< |
fail("Unexpected exception"); |
397 |
> |
unexpectedException(); |
398 |
|
} |
399 |
|
} |
400 |
|
|
401 |
< |
public void testBlockingTake(){ |
401 |
> |
/** |
402 |
> |
* |
403 |
> |
*/ |
404 |
> |
public void testBlockingTake() { |
405 |
|
Thread t = new Thread(new Runnable() { |
406 |
|
public void run() { |
407 |
|
try { |
410 |
|
threadAssertEquals(i, ((Integer)q.take()).intValue()); |
411 |
|
} |
412 |
|
q.take(); |
413 |
< |
threadFail("take should block"); |
413 |
> |
threadShouldThrow(); |
414 |
|
} catch (InterruptedException success){ |
415 |
|
} |
416 |
|
}}); |
421 |
|
t.join(); |
422 |
|
} |
423 |
|
catch (InterruptedException ie) { |
424 |
< |
fail("Unexpected exception"); |
424 |
> |
unexpectedException(); |
425 |
|
} |
426 |
|
} |
427 |
|
|
428 |
|
|
429 |
< |
public void testPoll(){ |
429 |
> |
/** |
430 |
> |
* |
431 |
> |
*/ |
432 |
> |
public void testPoll() { |
433 |
|
PriorityBlockingQueue q = populatedQueue(SIZE); |
434 |
|
for (int i = 0; i < SIZE; ++i) { |
435 |
|
assertEquals(i, ((Integer)q.poll()).intValue()); |
437 |
|
assertNull(q.poll()); |
438 |
|
} |
439 |
|
|
440 |
+ |
/** |
441 |
+ |
* |
442 |
+ |
*/ |
443 |
|
public void testTimedPoll0() { |
444 |
|
try { |
445 |
|
PriorityBlockingQueue q = populatedQueue(SIZE); |
448 |
|
} |
449 |
|
assertNull(q.poll(0, TimeUnit.MILLISECONDS)); |
450 |
|
} catch (InterruptedException e){ |
451 |
< |
fail("Unexpected exception"); |
451 |
> |
unexpectedException(); |
452 |
|
} |
453 |
|
} |
454 |
|
|
455 |
+ |
/** |
456 |
+ |
* |
457 |
+ |
*/ |
458 |
|
public void testTimedPoll() { |
459 |
|
try { |
460 |
|
PriorityBlockingQueue q = populatedQueue(SIZE); |
463 |
|
} |
464 |
|
assertNull(q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS)); |
465 |
|
} catch (InterruptedException e){ |
466 |
< |
fail("Unexpected exception"); |
466 |
> |
unexpectedException(); |
467 |
|
} |
468 |
|
} |
469 |
|
|
470 |
< |
public void testInterruptedTimedPoll(){ |
470 |
> |
/** |
471 |
> |
* |
472 |
> |
*/ |
473 |
> |
public void testInterruptedTimedPoll() { |
474 |
|
Thread t = new Thread(new Runnable() { |
475 |
|
public void run() { |
476 |
|
try { |
489 |
|
t.join(); |
490 |
|
} |
491 |
|
catch (InterruptedException ie) { |
492 |
< |
fail("Unexpected exception"); |
492 |
> |
unexpectedException(); |
493 |
|
} |
494 |
|
} |
495 |
|
|
496 |
< |
public void testTimedPollWithOffer(){ |
496 |
> |
/** |
497 |
> |
* |
498 |
> |
*/ |
499 |
> |
public void testTimedPollWithOffer() { |
500 |
|
final PriorityBlockingQueue q = new PriorityBlockingQueue(2); |
501 |
|
Thread t = new Thread(new Runnable() { |
502 |
< |
public void run(){ |
502 |
> |
public void run() { |
503 |
|
try { |
504 |
|
threadAssertNull(q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS)); |
505 |
|
q.poll(LONG_DELAY_MS, TimeUnit.MILLISECONDS); |
506 |
|
q.poll(LONG_DELAY_MS, TimeUnit.MILLISECONDS); |
507 |
< |
threadFail("Should block"); |
507 |
> |
threadShouldThrow(); |
508 |
|
} catch (InterruptedException success) { } |
509 |
|
} |
510 |
|
}); |
515 |
|
t.interrupt(); |
516 |
|
t.join(); |
517 |
|
} catch (Exception e){ |
518 |
< |
fail("Unexpected exception"); |
518 |
> |
unexpectedException(); |
519 |
|
} |
520 |
|
} |
521 |
|
|
522 |
|
|
523 |
< |
public void testPeek(){ |
523 |
> |
/** |
524 |
> |
* |
525 |
> |
*/ |
526 |
> |
public void testPeek() { |
527 |
|
PriorityBlockingQueue q = populatedQueue(SIZE); |
528 |
|
for (int i = 0; i < SIZE; ++i) { |
529 |
|
assertEquals(i, ((Integer)q.peek()).intValue()); |
534 |
|
assertNull(q.peek()); |
535 |
|
} |
536 |
|
|
537 |
< |
public void testElement(){ |
537 |
> |
/** |
538 |
> |
* |
539 |
> |
*/ |
540 |
> |
public void testElement() { |
541 |
|
PriorityBlockingQueue q = populatedQueue(SIZE); |
542 |
|
for (int i = 0; i < SIZE; ++i) { |
543 |
|
assertEquals(i, ((Integer)q.element()).intValue()); |
545 |
|
} |
546 |
|
try { |
547 |
|
q.element(); |
548 |
< |
fail("no such element"); |
548 |
> |
shouldThrow(); |
549 |
|
} |
550 |
|
catch (NoSuchElementException success) {} |
551 |
|
} |
552 |
|
|
553 |
< |
public void testRemove(){ |
553 |
> |
/** |
554 |
> |
* |
555 |
> |
*/ |
556 |
> |
public void testRemove() { |
557 |
|
PriorityBlockingQueue q = populatedQueue(SIZE); |
558 |
|
for (int i = 0; i < SIZE; ++i) { |
559 |
|
assertEquals(i, ((Integer)q.remove()).intValue()); |
560 |
|
} |
561 |
|
try { |
562 |
|
q.remove(); |
563 |
< |
fail("remove should throw"); |
563 |
> |
shouldThrow(); |
564 |
|
} catch (NoSuchElementException success){ |
565 |
|
} |
566 |
|
} |
567 |
|
|
568 |
< |
public void testRemoveElement(){ |
568 |
> |
/** |
569 |
> |
* |
570 |
> |
*/ |
571 |
> |
public void testRemoveElement() { |
572 |
|
PriorityBlockingQueue q = populatedQueue(SIZE); |
573 |
|
for (int i = 1; i < SIZE; i+=2) { |
574 |
|
assertTrue(q.remove(new Integer(i))); |
580 |
|
assertTrue(q.isEmpty()); |
581 |
|
} |
582 |
|
|
583 |
< |
public void testContains(){ |
583 |
> |
/** |
584 |
> |
* |
585 |
> |
*/ |
586 |
> |
public void testContains() { |
587 |
|
PriorityBlockingQueue q = populatedQueue(SIZE); |
588 |
|
for (int i = 0; i < SIZE; ++i) { |
589 |
|
assertTrue(q.contains(new Integer(i))); |
592 |
|
} |
593 |
|
} |
594 |
|
|
595 |
< |
public void testClear(){ |
595 |
> |
/** |
596 |
> |
* |
597 |
> |
*/ |
598 |
> |
public void testClear() { |
599 |
|
PriorityBlockingQueue q = populatedQueue(SIZE); |
600 |
|
q.clear(); |
601 |
|
assertTrue(q.isEmpty()); |
607 |
|
assertTrue(q.isEmpty()); |
608 |
|
} |
609 |
|
|
610 |
< |
public void testContainsAll(){ |
610 |
> |
/** |
611 |
> |
* |
612 |
> |
*/ |
613 |
> |
public void testContainsAll() { |
614 |
|
PriorityBlockingQueue q = populatedQueue(SIZE); |
615 |
|
PriorityBlockingQueue p = new PriorityBlockingQueue(SIZE); |
616 |
|
for (int i = 0; i < SIZE; ++i) { |
621 |
|
assertTrue(p.containsAll(q)); |
622 |
|
} |
623 |
|
|
624 |
< |
public void testRetainAll(){ |
624 |
> |
/** |
625 |
> |
* |
626 |
> |
*/ |
627 |
> |
public void testRetainAll() { |
628 |
|
PriorityBlockingQueue q = populatedQueue(SIZE); |
629 |
|
PriorityBlockingQueue p = populatedQueue(SIZE); |
630 |
|
for (int i = 0; i < SIZE; ++i) { |
640 |
|
} |
641 |
|
} |
642 |
|
|
643 |
< |
public void testRemoveAll(){ |
643 |
> |
/** |
644 |
> |
* |
645 |
> |
*/ |
646 |
> |
public void testRemoveAll() { |
647 |
|
for (int i = 1; i < SIZE; ++i) { |
648 |
|
PriorityBlockingQueue q = populatedQueue(SIZE); |
649 |
|
PriorityBlockingQueue p = populatedQueue(i); |
656 |
|
} |
657 |
|
} |
658 |
|
|
659 |
< |
public void testToArray(){ |
659 |
> |
/** |
660 |
> |
* |
661 |
> |
*/ |
662 |
> |
public void testToArray() { |
663 |
|
PriorityBlockingQueue q = populatedQueue(SIZE); |
664 |
|
Object[] o = q.toArray(); |
665 |
|
Arrays.sort(o); |
667 |
|
for(int i = 0; i < o.length; i++) |
668 |
|
assertEquals(o[i], q.take()); |
669 |
|
} catch (InterruptedException e){ |
670 |
< |
fail("Unexpected exception"); |
670 |
> |
unexpectedException(); |
671 |
|
} |
672 |
|
} |
673 |
|
|
674 |
< |
public void testToArray2(){ |
674 |
> |
/** |
675 |
> |
* |
676 |
> |
*/ |
677 |
> |
public void testToArray2() { |
678 |
|
PriorityBlockingQueue q = populatedQueue(SIZE); |
679 |
|
Integer[] ints = new Integer[SIZE]; |
680 |
|
ints = (Integer[])q.toArray(ints); |
683 |
|
for(int i = 0; i < ints.length; i++) |
684 |
|
assertEquals(ints[i], q.take()); |
685 |
|
} catch (InterruptedException e){ |
686 |
< |
fail("Unexpected exception"); |
686 |
> |
unexpectedException(); |
687 |
|
} |
688 |
|
} |
689 |
|
|
690 |
< |
public void testIterator(){ |
690 |
> |
/** |
691 |
> |
* |
692 |
> |
*/ |
693 |
> |
public void testIterator() { |
694 |
|
PriorityBlockingQueue q = populatedQueue(SIZE); |
695 |
|
int i = 0; |
696 |
|
Iterator it = q.iterator(); |
701 |
|
assertEquals(i, SIZE); |
702 |
|
} |
703 |
|
|
704 |
+ |
/** |
705 |
+ |
* |
706 |
+ |
*/ |
707 |
|
public void testIteratorRemove () { |
580 |
– |
|
708 |
|
final PriorityBlockingQueue q = new PriorityBlockingQueue(3); |
582 |
– |
|
709 |
|
q.add(new Integer(2)); |
710 |
|
q.add(new Integer(1)); |
711 |
|
q.add(new Integer(3)); |
721 |
|
} |
722 |
|
|
723 |
|
|
724 |
< |
public void testToString(){ |
724 |
> |
/** |
725 |
> |
* |
726 |
> |
*/ |
727 |
> |
public void testToString() { |
728 |
|
PriorityBlockingQueue q = populatedQueue(SIZE); |
729 |
|
String s = q.toString(); |
730 |
|
for (int i = 0; i < SIZE; ++i) { |
732 |
|
} |
733 |
|
} |
734 |
|
|
735 |
+ |
/** |
736 |
+ |
* |
737 |
+ |
*/ |
738 |
|
public void testPollInExecutor() { |
739 |
|
|
740 |
|
final PriorityBlockingQueue q = new PriorityBlockingQueue(2); |
749 |
|
threadAssertTrue(q.isEmpty()); |
750 |
|
} |
751 |
|
catch (InterruptedException e) { |
752 |
< |
threadFail("should not be interrupted"); |
752 |
> |
threadUnexpectedException(); |
753 |
|
} |
754 |
|
} |
755 |
|
}); |
761 |
|
q.put(new Integer(1)); |
762 |
|
} |
763 |
|
catch (InterruptedException e) { |
764 |
< |
threadFail("should not be interrupted"); |
764 |
> |
threadUnexpectedException(); |
765 |
|
} |
766 |
|
} |
767 |
|
}); |
770 |
|
|
771 |
|
} |
772 |
|
|
773 |
+ |
/** |
774 |
+ |
* |
775 |
+ |
*/ |
776 |
|
public void testSerialization() { |
777 |
|
PriorityBlockingQueue q = populatedQueue(SIZE); |
778 |
|
try { |
788 |
|
while (!q.isEmpty()) |
789 |
|
assertEquals(q.remove(), r.remove()); |
790 |
|
} catch(Exception e){ |
791 |
< |
fail("unexpected exception"); |
791 |
> |
unexpectedException(); |
792 |
|
} |
793 |
|
} |
794 |
|
|