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.9 by jsr166, Sat Nov 21 08:37:39 2009 UTC vs.
Revision 1.10 by jsr166, Sat Nov 21 09:28:16 2009 UTC

# Line 548 | Line 548 | public class LinkedBlockingDequeTest ext
548      /**
549       * put(null) throws NPE
550       */
551 <     public void testPutNull() throws InterruptedException {
551 >    public void testPutNull() throws InterruptedException {
552          try {
553              LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE);
554              q.put(null);
555              shouldThrow();
556          } catch (NullPointerException success) {}
557 <     }
557 >    }
558  
559      /**
560       * all elements successfully put are contained
561       */
562 <     public void testPut() throws InterruptedException {
563 <         LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE);
564 <         for (int i = 0; i < SIZE; ++i) {
565 <             Integer I = new Integer(i);
566 <             q.put(I);
567 <             assertTrue(q.contains(I));
568 <         }
569 <         assertEquals(0, q.remainingCapacity());
562 >    public void testPut() throws InterruptedException {
563 >        LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE);
564 >        for (int i = 0; i < SIZE; ++i) {
565 >            Integer I = new Integer(i);
566 >            q.put(I);
567 >            assertTrue(q.contains(I));
568 >        }
569 >        assertEquals(0, q.remainingCapacity());
570      }
571  
572      /**
# Line 600 | Line 600 | public class LinkedBlockingDequeTest ext
600       */
601      public void testPutWithTake() throws InterruptedException {
602          final LinkedBlockingDeque q = new LinkedBlockingDeque(2);
603 <        Thread t = new Thread(new Runnable() {
604 <                public void run() {
605 <                    int added = 0;
606 <                    try {
607 <                        q.put(new Object());
608 <                        ++added;
609 <                        q.put(new Object());
610 <                        ++added;
611 <                        q.put(new Object());
612 <                        ++added;
613 <                        q.put(new Object());
614 <                        ++added;
615 <                        threadShouldThrow();
616 <                    } catch (InterruptedException success) {
617 <                        threadAssertTrue(added >= 2);
618 <                    }
603 >        Thread t = new Thread(new CheckedRunnable() {
604 >            public void realRun() {
605 >                int added = 0;
606 >                try {
607 >                    q.put(new Object());
608 >                    ++added;
609 >                    q.put(new Object());
610 >                    ++added;
611 >                    q.put(new Object());
612 >                    ++added;
613 >                    q.put(new Object());
614 >                    ++added;
615 >                    threadShouldThrow();
616 >                } catch (InterruptedException success) {
617 >                    threadAssertTrue(added >= 2);
618                  }
619 <            });
619 >            }});
620  
621          t.start();
622          Thread.sleep(SHORT_DELAY_MS);
# Line 1559 | Line 1558 | public class LinkedBlockingDequeTest ext
1558          try {
1559              q.drainTo(q);
1560              shouldThrow();
1561 <        } catch (IllegalArgumentException success) {
1563 <        }
1561 >        } catch (IllegalArgumentException success) {}
1562      }
1563  
1564      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines