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

Comparing jsr166/src/test/tck/LinkedBlockingDequeTest.java (file contents):
Revision 1.13 by jsr166, Sat Nov 21 19:11:53 2009 UTC vs.
Revision 1.14 by jsr166, Sat Nov 21 21:00:34 2009 UTC

# Line 746 | Line 746 | public class LinkedBlockingDequeTest ext
746       */
747      public void testTimedPollWithOffer() throws InterruptedException {
748          final LinkedBlockingDeque q = new LinkedBlockingDeque(2);
749 <        Thread t = new ThreadShouldThrow(InterruptedException.class) {
749 >        Thread t = new Thread(new CheckedRunnable() {
750              public void realRun() throws InterruptedException {
751 <                threadAssertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS));
752 <                q.poll(LONG_DELAY_MS, MILLISECONDS);
753 <                q.poll(LONG_DELAY_MS, MILLISECONDS);
754 <            }};
751 >                assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS));
752 >                assertSame(zero, q.poll(LONG_DELAY_MS, MILLISECONDS));
753 >                try {
754 >                    q.poll(LONG_DELAY_MS, MILLISECONDS);
755 >                    shouldThrow();
756 >                } catch (InterruptedException success) {}
757 >            }});
758  
759          t.start();
760          Thread.sleep(SMALL_DELAY_MS);
# Line 957 | Line 960 | public class LinkedBlockingDequeTest ext
960       */
961      public void testTimedPollFirstWithOfferFirst() throws InterruptedException {
962          final LinkedBlockingDeque q = new LinkedBlockingDeque(2);
963 <        Thread t = new ThreadShouldThrow(InterruptedException.class) {
963 >        Thread t = new Thread(new CheckedRunnable() {
964              public void realRun() throws InterruptedException {
965 <                threadAssertNull(q.pollFirst(SHORT_DELAY_MS, MILLISECONDS));
966 <                q.pollFirst(LONG_DELAY_MS, MILLISECONDS);
967 <                q.pollFirst(LONG_DELAY_MS, MILLISECONDS);
968 <            }};
965 >                assertNull(q.pollFirst(SHORT_DELAY_MS, MILLISECONDS));
966 >                assertSame(zero, q.pollFirst(LONG_DELAY_MS, MILLISECONDS));
967 >                try {
968 >                    q.pollFirst(LONG_DELAY_MS, MILLISECONDS);
969 >                    shouldThrow();
970 >                } catch (InterruptedException success) {}
971 >            }});
972  
973          t.start();
974          Thread.sleep(SMALL_DELAY_MS);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines