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.12 by jsr166, Sat Aug 15 00:35:01 2009 UTC vs.
Revision 1.26 by jsr166, Tue Oct 19 00:41:14 2010 UTC

# Line 13 | Line 13 | import java.io.ObjectInputStream;
13   import java.io.ObjectOutputStream;
14   import java.util.ArrayList;
15   import java.util.Arrays;
16 import java.util.ConcurrentModificationException;
16   import java.util.Iterator;
17   import java.util.List;
18   import java.util.NoSuchElementException;
# Line 25 | 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 45 | Line 51 | public class LinkedTransferQueueTest ext
51          try {
52              q.element();
53              shouldThrow();
54 <        } catch (NoSuchElementException success) {
49 <        }
54 >        } catch (NoSuchElementException success) {}
55          try {
56              q.iterator().next();
57              shouldThrow();
58 <        } catch (NoSuchElementException success) {
54 <        }
58 >        } catch (NoSuchElementException success) {}
59          try {
60              q.remove();
61              shouldThrow();
62 <        } catch (NoSuchElementException success) {
59 <        }
62 >        } catch (NoSuchElementException success) {}
63      }
64  
65      /**
# Line 76 | Line 79 | public class LinkedTransferQueueTest ext
79          try {
80              new LinkedTransferQueue(null);
81              shouldThrow();
82 <        } catch (NullPointerException success) {
80 <        }
82 >        } catch (NullPointerException success) {}
83      }
84  
85      /**
# Line 89 | Line 91 | public class LinkedTransferQueueTest ext
91              Integer[] ints = new Integer[SIZE];
92              new LinkedTransferQueue(Arrays.asList(ints));
93              shouldThrow();
94 <        } catch (NullPointerException success) {
93 <        }
94 >        } catch (NullPointerException success) {}
95      }
96  
97      /**
# Line 105 | Line 106 | public class LinkedTransferQueueTest ext
106              }
107              new LinkedTransferQueue(Arrays.asList(ints));
108              shouldThrow();
109 <        } catch (NullPointerException success) {
109 <        }
109 >        } catch (NullPointerException success) {}
110      }
111  
112      /**
# Line 158 | Line 158 | public class LinkedTransferQueueTest ext
158              LinkedTransferQueue q = new LinkedTransferQueue();
159              q.offer(null);
160              shouldThrow();
161 <        } catch (NullPointerException success) {
162 <        }
161 >        } catch (NullPointerException success) {}
162      }
163  
164      /**
# Line 170 | Line 169 | public class LinkedTransferQueueTest ext
169              LinkedTransferQueue q = new LinkedTransferQueue();
170              q.add(null);
171              shouldThrow();
172 <        } catch (NullPointerException success) {
174 <        }
172 >        } catch (NullPointerException success) {}
173      }
174  
175      /**
# Line 182 | Line 180 | public class LinkedTransferQueueTest ext
180              LinkedTransferQueue q = new LinkedTransferQueue();
181              q.addAll(null);
182              shouldThrow();
183 <        } catch (NullPointerException success) {
186 <        }
183 >        } catch (NullPointerException success) {}
184      }
185  
186      /**
# Line 194 | Line 191 | public class LinkedTransferQueueTest ext
191              LinkedTransferQueue q = populatedQueue(SIZE);
192              q.addAll(q);
193              shouldThrow();
194 <        } catch (IllegalArgumentException success) {
198 <        }
194 >        } catch (IllegalArgumentException success) {}
195      }
196  
197      /**
# Line 207 | Line 203 | public class LinkedTransferQueueTest ext
203              Integer[] ints = new Integer[SIZE];
204              q.addAll(Arrays.asList(ints));
205              shouldThrow();
206 <        } catch (NullPointerException success) {
211 <        }
206 >        } catch (NullPointerException success) {}
207      }
208  
209      /**
# Line 224 | Line 219 | public class LinkedTransferQueueTest ext
219              }
220              q.addAll(Arrays.asList(ints));
221              shouldThrow();
222 <        } catch (NullPointerException success) {
228 <        }
222 >        } catch (NullPointerException success) {}
223      }
224  
225      /**
# Line 284 | Line 278 | public class LinkedTransferQueueTest ext
278      public void testTakeFromEmpty() throws InterruptedException {
279          final LinkedTransferQueue q = new LinkedTransferQueue();
280          Thread t = newStartedThread(new CheckedInterruptedRunnable() {
281 <            void realRun() throws InterruptedException {
281 >            public void realRun() throws InterruptedException {
282                  q.take();
283              }});
284          Thread.sleep(SHORT_DELAY_MS);
# Line 297 | Line 291 | public class LinkedTransferQueueTest ext
291       */
292      public void testBlockingTake() throws InterruptedException {
293          final LinkedTransferQueue<Integer> q = populatedQueue(SIZE);
294 <        Thread t = newStartedThread(new CheckedInterruptedRunnable() {
295 <            void realRun() throws InterruptedException {
294 >        Thread t = new Thread(new CheckedRunnable() {
295 >            public void realRun() throws InterruptedException {
296                  for (int i = 0; i < SIZE; ++i) {
297 <                    threadAssertEquals(i, (int) q.take());
297 >                    assertEquals(i, (int) q.take());
298                  }
299 <                q.take();
299 >                try {
300 >                    q.take();
301 >                    shouldThrow();
302 >                } catch (InterruptedException success) {}
303              }});
304 <        Thread.sleep(SMALL_DELAY_MS);
304 >
305 >        t.start();
306 >        Thread.sleep(SHORT_DELAY_MS);
307          t.interrupt();
308          t.join();
309          checkEmpty(q);
# Line 355 | Line 354 | public class LinkedTransferQueueTest ext
354       */
355      public void testInterruptedTimedPoll() throws InterruptedException {
356          final LinkedTransferQueue<Integer> q = populatedQueue(SIZE);
357 <        Thread t = newStartedThread(new CheckedInterruptedRunnable() {
358 <            void realRun() throws InterruptedException {
357 >        Thread t = newStartedThread(new CheckedRunnable() {
358 >            public void realRun() throws InterruptedException {
359                  for (int i = 0; i < SIZE; ++i) {
360                      long t0 = System.nanoTime();
361 <                    threadAssertEquals(i, (int) q.poll(LONG_DELAY_MS,
363 <                                                       MILLISECONDS));
361 >                    assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS));
362                      long millisElapsed = (System.nanoTime() - t0)/(1024 * 1024);
363                      assertTrue(millisElapsed < SMALL_DELAY_MS);
364                  }
365 <                q.poll(LONG_DELAY_MS, MILLISECONDS);
365 >                try {
366 >                    q.poll(LONG_DELAY_MS, MILLISECONDS);
367 >                    shouldThrow();
368 >                } catch (InterruptedException success) {}
369              }});
369        Thread.sleep(SMALL_DELAY_MS);
370        t.interrupt();
371        t.join();
372        checkEmpty(q);
373    }
370  
375    /**
376     * timed poll before a delayed offer fails; after offer succeeds;
377     * on interruption throws
378     */
379    public void testTimedPollWithOffer() throws InterruptedException {
380        final LinkedTransferQueue q = new LinkedTransferQueue();
381        Thread t = newStartedThread(new CheckedInterruptedRunnable() {
382            void realRun() throws InterruptedException {
383                threadAssertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS));
384                q.poll(LONG_DELAY_MS, MILLISECONDS);
385                q.poll(LONG_DELAY_MS, MILLISECONDS);
386            }});
371          Thread.sleep(SMALL_DELAY_MS);
388        assertTrue(q.offer(zero, SHORT_DELAY_MS, MILLISECONDS));
372          t.interrupt();
373          t.join();
374 +        checkEmpty(q);
375      }
376  
377      /**
# Line 417 | Line 401 | public class LinkedTransferQueueTest ext
401          try {
402              q.element();
403              shouldThrow();
404 <        } catch (NoSuchElementException success) {
421 <        }
404 >        } catch (NoSuchElementException success) {}
405          checkEmpty(q);
406      }
407  
# Line 433 | Line 416 | public class LinkedTransferQueueTest ext
416          try {
417              q.remove();
418              shouldThrow();
419 <        } catch (NoSuchElementException success) {
437 <        }
419 >        } catch (NoSuchElementException success) {}
420          checkEmpty(q);
421      }
422  
# Line 463 | Line 445 | public class LinkedTransferQueueTest ext
445          assertTrue(q.remove(one));
446          assertTrue(q.remove(two));
447          assertTrue(q.add(three));
448 <        assertTrue(q.take() == three);
448 >        assertSame(q.take(), three);
449      }
450  
451      /**
# Line 545 | Line 527 | public class LinkedTransferQueueTest ext
527      }
528  
529      /**
530 <     * toArray contains all elements
530 >     * toArray() contains all elements
531       */
532      public void testToArray() throws InterruptedException {
533          LinkedTransferQueue q = populatedQueue(SIZE);
# Line 571 | Line 553 | public class LinkedTransferQueueTest ext
553       * toArray(null) throws NullPointerException
554       */
555      public void testToArray_BadArg() {
556 +        LinkedTransferQueue q = populatedQueue(SIZE);
557          try {
575            LinkedTransferQueue q = populatedQueue(SIZE);
558              Object o[] = q.toArray(null);
559              shouldThrow();
560 <        } catch (NullPointerException success) {
579 <        }
560 >        } catch (NullPointerException success) {}
561      }
562  
563      /**
564 <     * toArray with incompatible array type throws CCE
564 >     * toArray(incompatible array type) throws CCE
565       */
566      public void testToArray1_BadArg() {
567 +        LinkedTransferQueue q = populatedQueue(SIZE);
568          try {
587            LinkedTransferQueue q = populatedQueue(SIZE);
569              Object o[] = q.toArray(new String[10]);
570              shouldThrow();
571 <        } catch (ArrayStoreException success) {
591 <        }
571 >        } catch (ArrayStoreException success) {}
572      }
573  
574      /**
# Line 618 | Line 598 | public class LinkedTransferQueueTest ext
598          it.remove();
599  
600          it = q.iterator();
601 <        assertEquals(it.next(), one);
602 <        assertEquals(it.next(), three);
601 >        assertSame(it.next(), one);
602 >        assertSame(it.next(), three);
603          assertFalse(it.hasNext());
604      }
605  
# Line 677 | Line 657 | public class LinkedTransferQueueTest ext
657          ExecutorService executor = Executors.newFixedThreadPool(2);
658  
659          executor.execute(new CheckedRunnable() {
660 <            void realRun() {
661 <                threadAssertTrue(q.offer(three, MEDIUM_DELAY_MS,
682 <                                         MILLISECONDS));
660 >            public void realRun() {
661 >                assertTrue(q.offer(three, MEDIUM_DELAY_MS, MILLISECONDS));
662              }});
663  
664          executor.execute(new CheckedRunnable() {
665 <            void realRun() throws InterruptedException {
665 >            public void realRun() throws InterruptedException {
666                  Thread.sleep(SMALL_DELAY_MS);
667 <                threadAssertEquals(one, q.take());
667 >                assertSame(one, q.take());
668              }});
669  
670          joinPool(executor);
671      }
672  
673      /**
674 <     * poll retrieves elements across Executor threads
674 >     * timed poll retrieves elements across Executor threads
675       */
676      public void testPollInExecutor() {
677          final LinkedTransferQueue q = new LinkedTransferQueue();
678          ExecutorService executor = Executors.newFixedThreadPool(2);
679  
680          executor.execute(new CheckedRunnable() {
681 <            void realRun() throws InterruptedException {
682 <                threadAssertNull(q.poll());
683 <                threadAssertTrue(null != q.poll(MEDIUM_DELAY_MS,
684 <                                                MILLISECONDS));
706 <                threadAssertTrue(q.isEmpty());
681 >            public void realRun() throws InterruptedException {
682 >                assertNull(q.poll());
683 >                assertSame(one, q.poll(MEDIUM_DELAY_MS, MILLISECONDS));
684 >                assertTrue(q.isEmpty());
685              }});
686  
687          executor.execute(new CheckedRunnable() {
688 <            void realRun() throws InterruptedException {
688 >            public void realRun() throws InterruptedException {
689                  Thread.sleep(SMALL_DELAY_MS);
690                  q.put(one);
691              }});
# Line 747 | Line 725 | public class LinkedTransferQueueTest ext
725          try {
726              q.drainTo(null);
727              shouldThrow();
728 <        } catch (NullPointerException success) {
751 <        }
728 >        } catch (NullPointerException success) {}
729      }
730  
731      /**
# Line 759 | Line 736 | public class LinkedTransferQueueTest ext
736          try {
737              q.drainTo(q);
738              shouldThrow();
739 <        } catch (IllegalArgumentException success) {
763 <        }
739 >        } catch (IllegalArgumentException success) {}
740      }
741  
742      /**
# Line 790 | Line 766 | public class LinkedTransferQueueTest ext
766      }
767  
768      /**
769 <     * drainTo empties full queue, unblocking a waiting put.
769 >     * drainTo(c) empties full queue, unblocking a waiting put.
770       */
771      public void testDrainToWithActivePut() throws InterruptedException {
772          final LinkedTransferQueue q = populatedQueue(SIZE);
773          Thread t = newStartedThread(new CheckedRunnable() {
774 <            void realRun() {
774 >            public void realRun() {
775                  q.put(SIZE + 1);
776              }});
777          ArrayList l = new ArrayList();
# Line 816 | Line 792 | public class LinkedTransferQueueTest ext
792          try {
793              q.drainTo(null, SIZE);
794              shouldThrow();
795 <        } catch (NullPointerException success) {
820 <        }
795 >        } catch (NullPointerException success) {}
796      }
797  
798      /**
# Line 828 | Line 803 | public class LinkedTransferQueueTest ext
803          try {
804              q.drainTo(q, SIZE);
805              shouldThrow();
806 <        } catch (IllegalArgumentException success) {
832 <        }
806 >        } catch (IllegalArgumentException success) {}
807      }
808  
809      /**
810 <     * drainTo(c, n) empties first max {n, size} elements of queue into c
810 >     * drainTo(c, n) empties first min(n, size) elements of queue into c
811       */
812      public void testDrainToN() {
813          LinkedTransferQueue q = new LinkedTransferQueue();
# Line 855 | Line 829 | public class LinkedTransferQueueTest ext
829      }
830  
831      /**
832 <     * poll and take decrement the waiting consumer count
832 >     * timed poll() or take() increments the waiting consumer count;
833 >     * offer(e) decrements the waiting consumer count
834       */
835      public void testWaitingConsumer() throws InterruptedException {
836          final LinkedTransferQueue q = new LinkedTransferQueue();
837 <        final ConsumerObserver waiting = new ConsumerObserver();
837 >        assertEquals(q.getWaitingConsumerCount(), 0);
838 >        assertFalse(q.hasWaitingConsumer());
839  
840          Thread t = newStartedThread(new CheckedRunnable() {
841 <            void realRun() throws InterruptedException {
841 >            public void realRun() throws InterruptedException {
842                  Thread.sleep(SMALL_DELAY_MS);
843 <                threadAssertTrue(q.hasWaitingConsumer());
844 <                waiting.setWaitingConsumer(q.getWaitingConsumerCount());
845 <                threadAssertTrue(q.offer(new Object()));
843 >                assertTrue(q.hasWaitingConsumer());
844 >                assertEquals(q.getWaitingConsumerCount(), 1);
845 >                assertTrue(q.offer(one));
846 >                assertFalse(q.hasWaitingConsumer());
847 >                assertEquals(q.getWaitingConsumerCount(), 0);
848              }});
849  
850 <        assertTrue(q.poll(LONG_DELAY_MS, MILLISECONDS) != null);
851 <        assertTrue(q.getWaitingConsumerCount()
852 <                   < waiting.getWaitingConsumers());
850 >        assertSame(one, q.poll(LONG_DELAY_MS, MILLISECONDS));
851 >        assertEquals(q.getWaitingConsumerCount(), 0);
852 >        assertFalse(q.hasWaitingConsumer());
853          t.join();
854      }
855  
# Line 883 | Line 861 | public class LinkedTransferQueueTest ext
861              LinkedTransferQueue q = new LinkedTransferQueue();
862              q.transfer(null);
863              shouldThrow();
864 <        } catch (NullPointerException ex) {
887 <        }
864 >        } catch (NullPointerException success) {}
865      }
866  
867      /**
# Line 896 | Line 873 | public class LinkedTransferQueueTest ext
873              = new LinkedTransferQueue<Integer>();
874  
875          Thread t = newStartedThread(new CheckedRunnable() {
876 <            void realRun() throws InterruptedException {
876 >            public void realRun() throws InterruptedException {
877                  q.transfer(SIZE);
878 <                threadAssertTrue(q.isEmpty());
878 >                assertTrue(q.isEmpty());
879              }});
880  
881          Thread.sleep(SHORT_DELAY_MS);
# Line 916 | Line 893 | public class LinkedTransferQueueTest ext
893              = new LinkedTransferQueue<Integer>();
894  
895          Thread first = newStartedThread(new CheckedRunnable() {
896 <            void realRun() throws InterruptedException {
896 >            public void realRun() throws InterruptedException {
897                  Integer i = SIZE + 1;
898                  q.transfer(i);
899 <                threadAssertTrue(!q.contains(i));
900 <                threadAssertEquals(1, q.size());
899 >                assertTrue(!q.contains(i));
900 >                assertEquals(1, q.size());
901              }});
902  
903          Thread interruptedThread = newStartedThread(
904              new CheckedInterruptedRunnable() {
905 <                void realRun() throws InterruptedException {
905 >                public void realRun() throws InterruptedException {
906                      while (q.size() == 0)
907                          Thread.yield();
908                      q.transfer(SIZE);
# Line 951 | Line 928 | public class LinkedTransferQueueTest ext
928          final LinkedTransferQueue q = new LinkedTransferQueue();
929  
930          Thread t = newStartedThread(new CheckedRunnable() {
931 <            void realRun() throws InterruptedException {
931 >            public void realRun() throws InterruptedException {
932                  q.transfer(four);
933 <                threadAssertFalse(q.contains(four));
934 <                threadAssertEquals(three, q.poll());
933 >                assertFalse(q.contains(four));
934 >                assertSame(three, q.poll());
935              }});
936  
937          Thread.sleep(SHORT_DELAY_MS);
938          assertTrue(q.offer(three));
939 <        assertEquals(four, q.poll());
939 >        assertSame(four, q.poll());
940          t.join();
941      }
942  
# Line 972 | Line 949 | public class LinkedTransferQueueTest ext
949              = new LinkedTransferQueue<Integer>();
950  
951          Thread t = newStartedThread(new CheckedRunnable() {
952 <            void realRun() throws InterruptedException {
952 >            public void realRun() throws InterruptedException {
953                  q.transfer(SIZE);
954                  checkEmpty(q);
955              }});
# Line 991 | Line 968 | public class LinkedTransferQueueTest ext
968              final LinkedTransferQueue q = new LinkedTransferQueue();
969              q.tryTransfer(null);
970              shouldThrow();
971 <        } catch (NullPointerException ex) {
995 <        }
971 >        } catch (NullPointerException success) {}
972      }
973  
974      /**
# Line 1015 | Line 991 | public class LinkedTransferQueueTest ext
991          final LinkedTransferQueue q = new LinkedTransferQueue();
992  
993          Thread t = newStartedThread(new CheckedRunnable() {
994 <            void realRun() {
994 >            public void realRun() {
995                  while (! q.hasWaitingConsumer())
996                      Thread.yield();
997 <                threadAssertTrue(q.hasWaitingConsumer());
998 <                threadAssertTrue(q.isEmpty());
999 <                threadAssertTrue(q.size() == 0);
1000 <                threadAssertTrue(q.tryTransfer(hotPotato));
997 >                assertTrue(q.hasWaitingConsumer());
998 >                assertTrue(q.isEmpty());
999 >                assertEquals(q.size(), 0);
1000 >                assertTrue(q.tryTransfer(hotPotato));
1001              }});
1002  
1003 <        assertTrue(q.poll(MEDIUM_DELAY_MS, MILLISECONDS) == hotPotato);
1003 >        assertSame(hotPotato, q.poll(MEDIUM_DELAY_MS, MILLISECONDS));
1004          checkEmpty(q);
1005          t.join();
1006      }
# Line 1038 | Line 1014 | public class LinkedTransferQueueTest ext
1014          final LinkedTransferQueue q = new LinkedTransferQueue();
1015  
1016          Thread t = newStartedThread(new CheckedRunnable() {
1017 <            void realRun() {
1017 >            public void realRun() {
1018                  while (! q.hasWaitingConsumer())
1019                      Thread.yield();
1020 <                threadAssertTrue(q.hasWaitingConsumer());
1021 <                threadAssertTrue(q.isEmpty());
1022 <                threadAssertTrue(q.size() == 0);
1023 <                threadAssertTrue(q.tryTransfer(hotPotato));
1020 >                assertTrue(q.hasWaitingConsumer());
1021 >                assertTrue(q.isEmpty());
1022 >                assertEquals(q.size(), 0);
1023 >                assertTrue(q.tryTransfer(hotPotato));
1024              }});
1025  
1026 <        assertTrue(q.take() == hotPotato);
1026 >        assertSame(q.take(), hotPotato);
1027          checkEmpty(q);
1028          t.join();
1029      }
# Line 1060 | Line 1036 | public class LinkedTransferQueueTest ext
1036          final LinkedTransferQueue q = new LinkedTransferQueue();
1037  
1038          Thread toInterrupt = newStartedThread(new CheckedInterruptedRunnable() {
1039 <            void realRun() throws InterruptedException {
1039 >            public void realRun() throws InterruptedException {
1040                  q.tryTransfer(new Object(), LONG_DELAY_MS, MILLISECONDS);
1041              }});
1042  
# Line 1076 | Line 1052 | public class LinkedTransferQueueTest ext
1052          final LinkedTransferQueue q = new LinkedTransferQueue();
1053  
1054          Thread t = newStartedThread(new CheckedRunnable() {
1055 <            void realRun() throws InterruptedException {
1056 <                threadAssertFalse
1057 <                    (q.tryTransfer(new Object(),
1082 <                                   SHORT_DELAY_MS, MILLISECONDS));
1055 >            public void realRun() throws InterruptedException {
1056 >                assertFalse(q.tryTransfer(new Object(),
1057 >                                          SHORT_DELAY_MS, MILLISECONDS));
1058              }});
1059  
1060          Thread.sleep(SMALL_DELAY_MS);
# Line 1096 | Line 1071 | public class LinkedTransferQueueTest ext
1071          assertTrue(q.offer(four));
1072  
1073          Thread t = newStartedThread(new CheckedRunnable() {
1074 <            void realRun() throws InterruptedException {
1075 <                threadAssertTrue(q.tryTransfer(five,
1076 <                                               MEDIUM_DELAY_MS, MILLISECONDS));
1102 <                threadAssertTrue(q.isEmpty());
1074 >            public void realRun() throws InterruptedException {
1075 >                assertTrue(q.tryTransfer(five, MEDIUM_DELAY_MS, MILLISECONDS));
1076 >                assertTrue(q.isEmpty());
1077              }});
1078  
1079          Thread.sleep(SHORT_DELAY_MS);
1080          assertEquals(2, q.size());
1081 <        assertEquals(four, q.poll());
1082 <        assertEquals(five, q.poll());
1081 >        assertSame(four, q.poll());
1082 >        assertSame(five, q.poll());
1083          checkEmpty(q);
1084          t.join();
1085      }
# Line 1120 | Line 1094 | public class LinkedTransferQueueTest ext
1094          assertEquals(1, q.size());
1095          assertFalse(q.tryTransfer(five, SHORT_DELAY_MS, MILLISECONDS));
1096          assertEquals(1, q.size());
1097 <        assertEquals(four, q.poll());
1124 <        checkEmpty(q);
1097 >        assertSame(four, q.poll());
1098          assertNull(q.poll());
1099 +        checkEmpty(q);
1100      }
1101  
1102      private LinkedTransferQueue<Integer> populatedQueue(int n) {
# Line 1136 | Line 1110 | public class LinkedTransferQueueTest ext
1110          assertFalse(q.isEmpty());
1111          return q;
1112      }
1139
1140    private static class ConsumerObserver {
1141
1142        private int waitingConsumers;
1143
1144        private ConsumerObserver() {
1145        }
1146
1147        private void setWaitingConsumer(int i) {
1148            this.waitingConsumers = i;
1149        }
1150
1151        private int getWaitingConsumers() {
1152            return waitingConsumers;
1153        }
1154    }
1113   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines