ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/ArrayBlockingQueueTest.java
(Generate patch)

Comparing jsr166/src/test/tck/ArrayBlockingQueueTest.java (file contents):
Revision 1.22 by jsr166, Sat Nov 21 19:48:24 2009 UTC vs.
Revision 1.24 by jsr166, Sat Nov 21 22:00:46 2009 UTC

# Line 350 | Line 350 | public class ArrayBlockingQueueTest exte
350       */
351      public void testTimedOffer() throws InterruptedException {
352          final ArrayBlockingQueue q = new ArrayBlockingQueue(2);
353 <        Thread t = new ThreadShouldThrow(InterruptedException.class) {
353 >        Thread t = new Thread(new CheckedRunnable() {
354              public void realRun() throws InterruptedException {
355                  q.put(new Object());
356                  q.put(new Object());
357 <                threadAssertFalse(q.offer(new Object(), SHORT_DELAY_MS/2, MILLISECONDS));
358 <                q.offer(new Object(), LONG_DELAY_MS, MILLISECONDS);
359 <            }};
357 >                assertFalse(q.offer(new Object(), SHORT_DELAY_MS/2, MILLISECONDS));
358 >                try {
359 >                    q.offer(new Object(), LONG_DELAY_MS, MILLISECONDS);
360 >                    shouldThrow();
361 >                } catch (InterruptedException success) {}
362 >            }});
363  
364          t.start();
365          Thread.sleep(SHORT_DELAY_MS);
# Line 472 | Line 475 | public class ArrayBlockingQueueTest exte
475       */
476      public void testTimedPollWithOffer() throws InterruptedException {
477          final ArrayBlockingQueue q = new ArrayBlockingQueue(2);
478 <        Thread t = new ThreadShouldThrow(InterruptedException.class) {
478 >        Thread t = new Thread(new CheckedRunnable() {
479              public void realRun() throws InterruptedException {
480 <                threadAssertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS));
481 <                q.poll(LONG_DELAY_MS, MILLISECONDS);
482 <                q.poll(LONG_DELAY_MS, MILLISECONDS);
483 <            }};
480 >                assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS));
481 >                assertSame(zero, q.poll(LONG_DELAY_MS, MILLISECONDS));
482 >                try {
483 >                    q.poll(LONG_DELAY_MS, MILLISECONDS);
484 >                    shouldThrow();
485 >                } catch (InterruptedException success) {}
486 >            }});
487  
488          t.start();
489          Thread.sleep(SMALL_DELAY_MS);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines