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.23 by dl, Wed Sep 29 12:33:48 2010 UTC vs.
Revision 1.24 by jsr166, Wed Oct 6 07:49:22 2010 UTC

# Line 11 | Line 11 | import static java.util.concurrent.TimeU
11   import java.io.*;
12  
13   public class LinkedBlockingDequeTest extends JSR166TestCase {
14 +
15 +    public static class Unbounded extends BlockingQueueTest {
16 +        protected BlockingQueue emptyCollection() {
17 +            return new LinkedBlockingDeque();
18 +        }
19 +    }
20 +
21 +    public static class Bounded extends BlockingQueueTest {
22 +        protected BlockingQueue emptyCollection() {
23 +            return new LinkedBlockingDeque(20);
24 +        }
25 +    }
26 +
27      public static void main(String[] args) {
28          junit.textui.TestRunner.run(suite());
29      }
30  
31      public static Test suite() {
32 <        return new TestSuite(LinkedBlockingDequeTest.class);
32 >        return newTestSuite(LinkedBlockingDequeTest.class,
33 >                            new Unbounded().testSuite(),
34 >                            new Bounded().testSuite());
35      }
36  
37      /**
# Line 762 | Line 777 | public class LinkedBlockingDequeTest ext
777      }
778  
779      /**
765     *  timed poll before a delayed offer fails; after offer succeeds;
766     *  on interruption throws
767     */
768    public void testTimedPollWithOffer() throws InterruptedException {
769        final LinkedBlockingDeque q = new LinkedBlockingDeque(2);
770        Thread t = new Thread(new CheckedRunnable() {
771            public void realRun() throws InterruptedException {
772                try {
773                    assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS));
774                    assertSame(zero, q.poll(LONG_DELAY_MS, MILLISECONDS));
775                    q.poll(LONG_DELAY_MS, MILLISECONDS);
776                    shouldThrow();
777                } catch (InterruptedException success) {}
778            }});
779
780        t.start();
781        Thread.sleep(SMALL_DELAY_MS);
782        assertTrue(q.offer(zero, SHORT_DELAY_MS, MILLISECONDS));
783        t.interrupt();
784        t.join();
785    }
786
787
788    /**
780       * putFirst(null) throws NPE
781       */
782       public void testPutFirstNull() throws InterruptedException {
# Line 1188 | Line 1179 | public class LinkedBlockingDequeTest ext
1179      }
1180  
1181      /**
1182 <     *  timed poll before a delayed offerLast fails; after offerLast succeeds;
1183 <     *  on interruption throws
1182 >     * timed poll before a delayed offerLast fails; after offerLast succeeds;
1183 >     * on interruption throws
1184       */
1185      public void testTimedPollWithOfferLast() throws InterruptedException {
1186          final LinkedBlockingDeque q = new LinkedBlockingDeque(2);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines