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

Comparing jsr166/src/test/tck/LinkedTransferQueueTest.java (file contents):
Revision 1.24 by jsr166, Tue Dec 1 09:56:28 2009 UTC vs.
Revision 1.25 by jsr166, Wed Oct 6 07:49:22 2010 UTC

# Line 24 | Line 24 | import junit.framework.TestSuite;
24   @SuppressWarnings({"unchecked", "rawtypes"})
25   public class LinkedTransferQueueTest extends JSR166TestCase {
26  
27 +    public static class Generic extends BlockingQueueTest {
28 +        protected BlockingQueue emptyCollection() {
29 +            return new LinkedTransferQueue();
30 +        }
31 +    }
32 +
33      public static void main(String[] args) {
34          junit.textui.TestRunner.run(suite());
35      }
36  
37      public static Test suite() {
38 <        return new TestSuite(LinkedTransferQueueTest.class);
38 >        return newTestSuite(LinkedTransferQueueTest.class,
39 >                            new Generic().testSuite());
40      }
41  
42      void checkEmpty(LinkedTransferQueue q) throws InterruptedException {
# Line 368 | Line 375 | public class LinkedTransferQueueTest ext
375      }
376  
377      /**
371     * timed poll before a delayed offer fails; after offer succeeds;
372     * on interruption throws
373     */
374    public void testTimedPollWithOffer() throws InterruptedException {
375        final LinkedTransferQueue q = new LinkedTransferQueue();
376        Thread t = new Thread(new CheckedRunnable() {
377            public void realRun() throws InterruptedException {
378                assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS));
379                assertSame(zero, q.poll(LONG_DELAY_MS, MILLISECONDS));
380                try {
381                    q.poll(LONG_DELAY_MS, MILLISECONDS);
382                    shouldThrow();
383                } catch (InterruptedException success) {}
384            }});
385
386        t.start();
387        Thread.sleep(SMALL_DELAY_MS);
388        assertTrue(q.offer(zero, SHORT_DELAY_MS, MILLISECONDS));
389        t.interrupt();
390        t.join();
391    }
392
393    /**
378       * peek returns next element, or null if empty
379       */
380      public void testPeek() throws InterruptedException {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines