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.27 by jsr166, Thu Oct 28 17:22:13 2010 UTC vs.
Revision 1.41 by jsr166, Thu Nov 18 18:49:44 2010 UTC

# Line 40 | Line 40 | public class LinkedTransferQueueTest ext
40                              new Generic().testSuite());
41      }
42  
43 <    void checkEmpty(LinkedTransferQueue q) throws InterruptedException {
44 <        assertTrue(q.isEmpty());
45 <        assertEquals(0, q.size());
46 <        assertNull(q.peek());
47 <        assertNull(q.poll());
48 <        assertNull(q.poll(0, MILLISECONDS));
49 <        assertEquals(q.toString(), "[]");
50 <        assertTrue(Arrays.equals(q.toArray(), new Object[0]));
51 <        assertFalse(q.iterator().hasNext());
52 <        try {
53 <            q.element();
54 <            shouldThrow();
55 <        } catch (NoSuchElementException success) {}
43 >    void checkEmpty(BlockingQueue q) {
44          try {
45 <            q.iterator().next();
46 <            shouldThrow();
47 <        } catch (NoSuchElementException success) {}
48 <        try {
49 <            q.remove();
50 <            shouldThrow();
51 <        } catch (NoSuchElementException success) {}
45 >            assertTrue(q.isEmpty());
46 >            assertEquals(0, q.size());
47 >            assertNull(q.peek());
48 >            assertNull(q.poll());
49 >            assertNull(q.poll(0, MILLISECONDS));
50 >            assertEquals(q.toString(), "[]");
51 >            assertTrue(Arrays.equals(q.toArray(), new Object[0]));
52 >            assertFalse(q.iterator().hasNext());
53 >            try {
54 >                q.element();
55 >                shouldThrow();
56 >            } catch (NoSuchElementException success) {}
57 >            try {
58 >                q.iterator().next();
59 >                shouldThrow();
60 >            } catch (NoSuchElementException success) {}
61 >            try {
62 >                q.remove();
63 >                shouldThrow();
64 >            } catch (NoSuchElementException success) {}
65 >        } catch (InterruptedException ie) {
66 >            threadUnexpectedException(ie);
67 >        }
68      }
69  
70      /**
# Line 274 | Line 278 | public class LinkedTransferQueueTest ext
278      }
279  
280      /**
281 <     * take blocks interruptibly when empty
278 <     */
279 <    public void testTakeFromEmpty() throws InterruptedException {
280 <        final LinkedTransferQueue q = new LinkedTransferQueue();
281 <        Thread t = newStartedThread(new CheckedInterruptedRunnable() {
282 <            public void realRun() throws InterruptedException {
283 <                q.take();
284 <            }});
285 <        Thread.sleep(SHORT_DELAY_MS);
286 <        t.interrupt();
287 <        t.join();
288 <    }
289 <
290 <    /**
291 <     * Take removes existing elements until empty, then blocks interruptibly
281 >     * take removes existing elements until empty, then blocks interruptibly
282       */
283      public void testBlockingTake() throws InterruptedException {
284 <        final LinkedTransferQueue<Integer> q = populatedQueue(SIZE);
285 <        Thread t = new Thread(new CheckedRunnable() {
284 >        final BlockingQueue<Integer> q = populatedQueue(SIZE);
285 >        final CountDownLatch aboutToWait = new CountDownLatch(1);
286 >        Thread t = newStartedThread(new CheckedRunnable() {
287              public void realRun() throws InterruptedException {
288                  for (int i = 0; i < SIZE; ++i) {
289                      assertEquals(i, (int) q.take());
290                  }
291 +                aboutToWait.countDown();
292                  try {
293                      q.take();
294                      shouldThrow();
295                  } catch (InterruptedException success) {}
296              }});
297  
298 <        t.start();
299 <        Thread.sleep(SHORT_DELAY_MS);
298 >        aboutToWait.await();
299 >        waitForThreadToEnterWaitState(t, SMALL_DELAY_MS);
300          t.interrupt();
301 <        t.join();
301 >        awaitTermination(t, MEDIUM_DELAY_MS);
302          checkEmpty(q);
303      }
304  
# Line 323 | Line 315 | public class LinkedTransferQueueTest ext
315      }
316  
317      /**
318 <     * timed pool with zero timeout succeeds when non-empty, else times out
318 >     * timed poll with zero timeout succeeds when non-empty, else times out
319       */
320      public void testTimedPoll0() throws InterruptedException {
321          LinkedTransferQueue<Integer> q = populatedQueue(SIZE);
# Line 335 | Line 327 | public class LinkedTransferQueueTest ext
327      }
328  
329      /**
330 <     * timed pool with nonzero timeout succeeds when non-empty, else times out
330 >     * timed poll with nonzero timeout succeeds when non-empty, else times out
331       */
332      public void testTimedPoll() throws InterruptedException {
333          LinkedTransferQueue<Integer> q = populatedQueue(SIZE);
334          for (int i = 0; i < SIZE; ++i) {
335              long t0 = System.nanoTime();
336 <            assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS));
337 <            long millisElapsed = (System.nanoTime() - t0)/(1024 * 1024);
346 <            assertTrue(millisElapsed < SMALL_DELAY_MS);
336 >            assertEquals(i, (int) q.poll(SMALL_DELAY_MS, MILLISECONDS));
337 >            assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS);
338          }
339 +        long t0 = System.nanoTime();
340          assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS));
341 +        assertTrue(millisElapsedSince(t0) >= SHORT_DELAY_MS);
342          checkEmpty(q);
343      }
344  
# Line 354 | Line 347 | public class LinkedTransferQueueTest ext
347       * returning timeout status
348       */
349      public void testInterruptedTimedPoll() throws InterruptedException {
350 <        final LinkedTransferQueue<Integer> q = populatedQueue(SIZE);
350 >        final BlockingQueue<Integer> q = populatedQueue(SIZE);
351 >        final CountDownLatch aboutToWait = new CountDownLatch(1);
352          Thread t = newStartedThread(new CheckedRunnable() {
353              public void realRun() throws InterruptedException {
354                  for (int i = 0; i < SIZE; ++i) {
355                      long t0 = System.nanoTime();
356                      assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS));
357 <                    long millisElapsed = (System.nanoTime() - t0)/(1024 * 1024);
364 <                    assertTrue(millisElapsed < SMALL_DELAY_MS);
357 >                    assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS);
358                  }
359 +                long t0 = System.nanoTime();
360 +                aboutToWait.countDown();
361                  try {
362 <                    q.poll(LONG_DELAY_MS, MILLISECONDS);
362 >                    q.poll(MEDIUM_DELAY_MS, MILLISECONDS);
363                      shouldThrow();
364 <                } catch (InterruptedException success) {}
364 >                } catch (InterruptedException success) {
365 >                    assertTrue(millisElapsedSince(t0) < MEDIUM_DELAY_MS);
366 >                }
367              }});
368  
369 <        Thread.sleep(SMALL_DELAY_MS);
369 >        aboutToWait.await();
370 >        waitForThreadToEnterWaitState(t, SMALL_DELAY_MS);
371          t.interrupt();
372 <        t.join();
372 >        awaitTermination(t, MEDIUM_DELAY_MS);
373 >        checkEmpty(q);
374 >    }
375 >
376 >    /**
377 >     * timed poll after thread interrupted throws InterruptedException
378 >     * instead of returning timeout status
379 >     */
380 >    public void testTimedPollAfterInterrupt() throws InterruptedException {
381 >        final BlockingQueue<Integer> q = populatedQueue(SIZE);
382 >        Thread t = newStartedThread(new CheckedRunnable() {
383 >            public void realRun() throws InterruptedException {
384 >                Thread.currentThread().interrupt();
385 >                for (int i = 0; i < SIZE; ++i) {
386 >                    long t0 = System.nanoTime();
387 >                    assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS));
388 >                    assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS);
389 >                }
390 >                try {
391 >                    q.poll(MEDIUM_DELAY_MS, MILLISECONDS);
392 >                    shouldThrow();
393 >                } catch (InterruptedException success) {}
394 >            }});
395 >
396 >        awaitTermination(t, MEDIUM_DELAY_MS);
397          checkEmpty(q);
398      }
399  
# Line 528 | Line 550 | public class LinkedTransferQueueTest ext
550      }
551  
552      /**
553 <     * toArray() contains all elements
553 >     * toArray() contains all elements in FIFO order
554       */
555 <    public void testToArray() throws InterruptedException {
555 >    public void testToArray() {
556          LinkedTransferQueue q = populatedQueue(SIZE);
557          Object[] o = q.toArray();
558          for (int i = 0; i < o.length; i++) {
559 <            assertEquals(o[i], q.take());
559 >            assertSame(o[i], q.poll());
560          }
561      }
562  
563      /**
564 <     * toArray(a) contains all elements
564 >     * toArray(a) contains all elements in FIFO order
565       */
566 <    public void testToArray2() throws InterruptedException {
566 >    public void testToArray2() {
567          LinkedTransferQueue<Integer> q = populatedQueue(SIZE);
568          Integer[] ints = new Integer[SIZE];
569 <        ints = q.toArray(ints);
569 >        Integer[] array = q.toArray(ints);
570 >        assertSame(ints, array);
571          for (int i = 0; i < ints.length; i++) {
572 <            assertEquals(ints[i], q.take());
572 >            assertSame(ints[i], q.poll());
573          }
574      }
575  
576      /**
577       * toArray(null) throws NullPointerException
578       */
579 <    public void testToArray_BadArg() {
579 >    public void testToArray_NullArg() {
580          LinkedTransferQueue q = populatedQueue(SIZE);
581          try {
582 <            Object o[] = q.toArray(null);
582 >            q.toArray(null);
583              shouldThrow();
584          } catch (NullPointerException success) {}
585      }
586  
587      /**
588 <     * toArray(incompatible array type) throws CCE
588 >     * toArray(incompatible array type) throws ArrayStoreException
589       */
590      public void testToArray1_BadArg() {
591          LinkedTransferQueue q = populatedQueue(SIZE);
592          try {
593 <            Object o[] = q.toArray(new String[10]);
593 >            q.toArray(new String[10]);
594              shouldThrow();
595          } catch (ArrayStoreException success) {}
596      }
# Line 653 | Line 676 | public class LinkedTransferQueueTest ext
676       */
677      public void testOfferInExecutor() {
678          final LinkedTransferQueue q = new LinkedTransferQueue();
679 <        q.add(one);
657 <        q.add(two);
679 >        final CountDownLatch threadsStarted = new CountDownLatch(2);
680          ExecutorService executor = Executors.newFixedThreadPool(2);
681  
682          executor.execute(new CheckedRunnable() {
683 <            public void realRun() {
684 <                assertTrue(q.offer(three, MEDIUM_DELAY_MS, MILLISECONDS));
683 >            public void realRun() throws InterruptedException {
684 >                threadsStarted.countDown();
685 >                threadsStarted.await();
686 >                assertTrue(q.offer(one, MEDIUM_DELAY_MS, MILLISECONDS));
687              }});
688  
689          executor.execute(new CheckedRunnable() {
690              public void realRun() throws InterruptedException {
691 <                Thread.sleep(SMALL_DELAY_MS);
691 >                threadsStarted.countDown();
692 >                threadsStarted.await();
693                  assertSame(one, q.take());
694 +                checkEmpty(q);
695              }});
696  
697          joinPool(executor);
# Line 676 | Line 702 | public class LinkedTransferQueueTest ext
702       */
703      public void testPollInExecutor() {
704          final LinkedTransferQueue q = new LinkedTransferQueue();
705 +        final CountDownLatch threadsStarted = new CountDownLatch(2);
706          ExecutorService executor = Executors.newFixedThreadPool(2);
707  
708          executor.execute(new CheckedRunnable() {
709              public void realRun() throws InterruptedException {
710                  assertNull(q.poll());
711 <                assertSame(one, q.poll(MEDIUM_DELAY_MS, MILLISECONDS));
712 <                assertTrue(q.isEmpty());
711 >                threadsStarted.countDown();
712 >                threadsStarted.await();
713 >                assertSame(one, q.poll(SMALL_DELAY_MS, MILLISECONDS));
714 >                checkEmpty(q);
715              }});
716  
717          executor.execute(new CheckedRunnable() {
718              public void realRun() throws InterruptedException {
719 <                Thread.sleep(SMALL_DELAY_MS);
719 >                threadsStarted.countDown();
720 >                threadsStarted.await();
721                  q.put(one);
722              }});
723  
# Line 713 | Line 743 | public class LinkedTransferQueueTest ext
743          LinkedTransferQueue r = (LinkedTransferQueue) in.readObject();
744  
745          assertEquals(q.size(), r.size());
746 +        assertEquals(q.toString(), r.toString());
747 +        assertTrue(Arrays.equals(q.toArray(), r.toArray()));
748          while (!q.isEmpty()) {
749              assertEquals(q.remove(), r.remove());
750          }
# Line 781 | Line 813 | public class LinkedTransferQueueTest ext
813          for (int i = 0; i < SIZE; ++i) {
814              assertEquals(l.get(i), i);
815          }
816 <        t.join();
816 >        awaitTermination(t, MEDIUM_DELAY_MS);
817          assertTrue(q.size() + l.size() >= SIZE);
818      }
819  
# Line 837 | Line 869 | public class LinkedTransferQueueTest ext
869          final LinkedTransferQueue q = new LinkedTransferQueue();
870          assertEquals(q.getWaitingConsumerCount(), 0);
871          assertFalse(q.hasWaitingConsumer());
872 +        final CountDownLatch threadStarted = new CountDownLatch(1);
873  
874          Thread t = newStartedThread(new CheckedRunnable() {
875              public void realRun() throws InterruptedException {
876 <                Thread.sleep(SMALL_DELAY_MS);
877 <                assertTrue(q.hasWaitingConsumer());
845 <                assertEquals(q.getWaitingConsumerCount(), 1);
846 <                assertTrue(q.offer(one));
847 <                assertFalse(q.hasWaitingConsumer());
876 >                threadStarted.countDown();
877 >                assertSame(one, q.poll(LONG_DELAY_MS, MILLISECONDS));
878                  assertEquals(q.getWaitingConsumerCount(), 0);
879 +                assertFalse(q.hasWaitingConsumer());
880              }});
881  
882 <        assertSame(one, q.poll(LONG_DELAY_MS, MILLISECONDS));
882 >        threadStarted.await();
883 >        waitForThreadToEnterWaitState(t, SMALL_DELAY_MS);
884 >        assertEquals(q.getWaitingConsumerCount(), 1);
885 >        assertTrue(q.hasWaitingConsumer());
886 >
887 >        assertTrue(q.offer(one));
888          assertEquals(q.getWaitingConsumerCount(), 0);
889          assertFalse(q.hasWaitingConsumer());
890 <        t.join();
890 >
891 >        awaitTermination(t, MEDIUM_DELAY_MS);
892      }
893  
894      /**
# Line 872 | Line 909 | public class LinkedTransferQueueTest ext
909      public void testTransfer2() throws InterruptedException {
910          final LinkedTransferQueue<Integer> q
911              = new LinkedTransferQueue<Integer>();
912 +        final CountDownLatch threadStarted = new CountDownLatch(1);
913  
914          Thread t = newStartedThread(new CheckedRunnable() {
915              public void realRun() throws InterruptedException {
916 <                q.transfer(SIZE);
917 <                assertTrue(q.isEmpty());
916 >                threadStarted.countDown();
917 >                q.transfer(five);
918 >                checkEmpty(q);
919              }});
920  
921 <        Thread.sleep(SHORT_DELAY_MS);
921 >        threadStarted.await();
922 >        waitForThreadToEnterWaitState(t, SMALL_DELAY_MS);
923          assertEquals(1, q.size());
924 <        assertEquals(SIZE, (int) q.poll());
925 <        assertTrue(q.isEmpty());
926 <        t.join();
924 >        assertSame(five, q.poll());
925 >        checkEmpty(q);
926 >        awaitTermination(t, MEDIUM_DELAY_MS);
927      }
928  
929      /**
# Line 895 | Line 935 | public class LinkedTransferQueueTest ext
935  
936          Thread first = newStartedThread(new CheckedRunnable() {
937              public void realRun() throws InterruptedException {
938 <                Integer i = SIZE + 1;
939 <                q.transfer(i);
900 <                assertTrue(!q.contains(i));
938 >                q.transfer(four);
939 >                assertTrue(!q.contains(four));
940                  assertEquals(1, q.size());
941              }});
942  
943          Thread interruptedThread = newStartedThread(
944              new CheckedInterruptedRunnable() {
945                  public void realRun() throws InterruptedException {
946 <                    while (q.size() == 0)
946 >                    while (q.isEmpty())
947                          Thread.yield();
948 <                    q.transfer(SIZE);
948 >                    q.transfer(five);
949                  }});
950  
951          while (q.size() < 2)
952              Thread.yield();
953          assertEquals(2, q.size());
954 <        assertEquals(SIZE + 1, (int) q.poll());
954 >        assertSame(four, q.poll());
955          first.join();
956          assertEquals(1, q.size());
957          interruptedThread.interrupt();
958          interruptedThread.join();
959 <        assertEquals(0, q.size());
921 <        assertTrue(q.isEmpty());
959 >        checkEmpty(q);
960      }
961  
962      /**
# Line 935 | Line 973 | public class LinkedTransferQueueTest ext
973                  assertSame(three, q.poll());
974              }});
975  
976 <        Thread.sleep(SHORT_DELAY_MS);
976 >        while (q.isEmpty())
977 >            Thread.yield();
978 >        assertFalse(q.isEmpty());
979 >        assertEquals(1, q.size());
980          assertTrue(q.offer(three));
981          assertSame(four, q.poll());
982 <        t.join();
982 >        awaitTermination(t, MEDIUM_DELAY_MS);
983      }
984  
985      /**
# Line 951 | Line 992 | public class LinkedTransferQueueTest ext
992  
993          Thread t = newStartedThread(new CheckedRunnable() {
994              public void realRun() throws InterruptedException {
995 <                q.transfer(SIZE);
995 >                q.transfer(four);
996                  checkEmpty(q);
997              }});
998  
999 <        Thread.sleep(SHORT_DELAY_MS);
1000 <        assertEquals(SIZE, (int) q.take());
999 >        while (q.isEmpty())
1000 >            Thread.yield();
1001 >        assertFalse(q.isEmpty());
1002 >        assertEquals(1, q.size());
1003 >        assertSame(four, q.take());
1004          checkEmpty(q);
1005 <        t.join();
1005 >        awaitTermination(t, MEDIUM_DELAY_MS);
1006      }
1007  
1008      /**
# Line 996 | Line 1040 | public class LinkedTransferQueueTest ext
1040                  while (! q.hasWaitingConsumer())
1041                      Thread.yield();
1042                  assertTrue(q.hasWaitingConsumer());
1043 <                assertTrue(q.isEmpty());
1000 <                assertEquals(q.size(), 0);
1043 >                checkEmpty(q);
1044                  assertTrue(q.tryTransfer(hotPotato));
1045              }});
1046  
1047          assertSame(hotPotato, q.poll(MEDIUM_DELAY_MS, MILLISECONDS));
1048          checkEmpty(q);
1049 <        t.join();
1049 >        awaitTermination(t, MEDIUM_DELAY_MS);
1050      }
1051  
1052      /**
# Line 1019 | Line 1062 | public class LinkedTransferQueueTest ext
1062                  while (! q.hasWaitingConsumer())
1063                      Thread.yield();
1064                  assertTrue(q.hasWaitingConsumer());
1065 <                assertTrue(q.isEmpty());
1023 <                assertEquals(q.size(), 0);
1065 >                checkEmpty(q);
1066                  assertTrue(q.tryTransfer(hotPotato));
1067              }});
1068  
1069          assertSame(q.take(), hotPotato);
1070          checkEmpty(q);
1071 <        t.join();
1071 >        awaitTermination(t, MEDIUM_DELAY_MS);
1072      }
1073  
1074      /**
1075 <     * tryTransfer waits the amount given if interrupted, and
1076 <     * throws interrupted exception
1075 >     * tryTransfer waits the amount given, and throws
1076 >     * InterruptedException when interrupted.
1077       */
1078      public void testTryTransfer5() throws InterruptedException {
1079          final LinkedTransferQueue q = new LinkedTransferQueue();
1080 +        final CountDownLatch threadStarted = new CountDownLatch(1);
1081 +        assertTrue(q.isEmpty());
1082  
1083 <        Thread toInterrupt = newStartedThread(new CheckedInterruptedRunnable() {
1083 >        Thread t = newStartedThread(new CheckedRunnable() {
1084              public void realRun() throws InterruptedException {
1085 <                q.tryTransfer(new Object(), LONG_DELAY_MS, MILLISECONDS);
1085 >                long t0 = System.nanoTime();
1086 >                threadStarted.countDown();
1087 >                try {
1088 >                    q.tryTransfer(new Object(), LONG_DELAY_MS, MILLISECONDS);
1089 >                    shouldThrow();
1090 >                } catch (InterruptedException success) {}
1091 >                assertTrue(millisElapsedSince(t0) >= SHORT_DELAY_MS);
1092 >                assertTrue(millisElapsedSince(t0) < MEDIUM_DELAY_MS);
1093              }});
1094  
1095 <        Thread.sleep(SMALL_DELAY_MS);
1096 <        toInterrupt.interrupt();
1097 <        toInterrupt.join();
1095 >        threadStarted.await();
1096 >        while (q.isEmpty())
1097 >            Thread.yield();
1098 >        Thread.sleep(SHORT_DELAY_MS);
1099 >        t.interrupt();
1100 >        awaitTermination(t, MEDIUM_DELAY_MS);
1101 >        checkEmpty(q);
1102      }
1103  
1104      /**
1105 <     * tryTransfer gives up after the timeout and return false
1105 >     * tryTransfer gives up after the timeout and returns false
1106       */
1107      public void testTryTransfer6() throws InterruptedException {
1108          final LinkedTransferQueue q = new LinkedTransferQueue();
# Line 1057 | Line 1112 | public class LinkedTransferQueueTest ext
1112                  long t0 = System.nanoTime();
1113                  assertFalse(q.tryTransfer(new Object(),
1114                                            SHORT_DELAY_MS, MILLISECONDS));
1115 <                long elapsed = NANOSECONDS.toMillis(System.nanoTime() - t0);
1116 <                assertTrue(elapsed >= SHORT_DELAY_MS);
1115 >                assertTrue(millisElapsedSince(t0) >= SHORT_DELAY_MS);
1116 >                checkEmpty(q);
1117              }});
1118  
1064        checkEmpty(q);
1119          awaitTermination(t, MEDIUM_DELAY_MS);
1120          checkEmpty(q);
1121      }
# Line 1077 | Line 1131 | public class LinkedTransferQueueTest ext
1131          Thread t = newStartedThread(new CheckedRunnable() {
1132              public void realRun() throws InterruptedException {
1133                  assertTrue(q.tryTransfer(five, MEDIUM_DELAY_MS, MILLISECONDS));
1134 <                assertTrue(q.isEmpty());
1134 >                checkEmpty(q);
1135              }});
1136  
1137 <        Thread.sleep(SHORT_DELAY_MS);
1137 >        while (q.size() != 2)
1138 >            Thread.yield();
1139          assertEquals(2, q.size());
1140          assertSame(four, q.poll());
1141          assertSame(five, q.poll());
1142          checkEmpty(q);
1143 <        t.join();
1143 >        awaitTermination(t, MEDIUM_DELAY_MS);
1144      }
1145  
1146      /**
1147 <     * tryTransfer attempts to enqueue into the q and fails returning
1148 <     * false not enqueueing and the successive poll is null
1147 >     * tryTransfer attempts to enqueue into the queue and fails
1148 >     * returning false not enqueueing and the successive poll is null
1149       */
1150      public void testTryTransfer8() throws InterruptedException {
1151          final LinkedTransferQueue q = new LinkedTransferQueue();
1152          assertTrue(q.offer(four));
1153          assertEquals(1, q.size());
1154 +        long t0 = System.nanoTime();
1155          assertFalse(q.tryTransfer(five, SHORT_DELAY_MS, MILLISECONDS));
1156 +        assertTrue(millisElapsedSince(t0) >= SHORT_DELAY_MS);
1157          assertEquals(1, q.size());
1158          assertSame(four, q.poll());
1159          assertNull(q.poll());
# Line 1105 | Line 1162 | public class LinkedTransferQueueTest ext
1162  
1163      private LinkedTransferQueue<Integer> populatedQueue(int n) {
1164          LinkedTransferQueue<Integer> q = new LinkedTransferQueue<Integer>();
1165 <        assertTrue(q.isEmpty());
1165 >        checkEmpty(q);
1166          for (int i = 0; i < n; i++) {
1167              assertEquals(i, q.size());
1168              assertTrue(q.offer(i));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines