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

Comparing jsr166/src/test/tck/BlockingQueueTest.java (file contents):
Revision 1.17 by jsr166, Thu Oct 8 00:41:57 2015 UTC vs.
Revision 1.21 by jsr166, Wed Jan 10 14:41:52 2018 UTC

# Line 106 | Line 106 | public abstract class BlockingQueueTest
106      }
107  
108      /**
109 <     * put(null) throws NullPointerException
109 >     * addAll(null) throws NullPointerException
110       */
111      public void testAddAllNull() throws InterruptedException {
112          final Collection q = emptyCollection();
# Line 189 | Line 189 | public abstract class BlockingQueueTest
189      public void testDrainToNonPositiveMaxElements() {
190          final BlockingQueue q = emptyCollection();
191          final int[] ns = { 0, -1, -42, Integer.MIN_VALUE };
192 <        for (int n : ns)
193 <            assertEquals(0, q.drainTo(new ArrayList(), n));
192 >        final ArrayList sink = new ArrayList();
193 >        for (int n : ns) {
194 >            assertEquals(0, q.drainTo(sink, n));
195 >            assertTrue(sink.isEmpty());
196 >        }
197          if (q.remainingCapacity() > 0) {
198              // Not SynchronousQueue, that is
199              Object one = makeElement(1);
200              q.add(one);
198            ArrayList c = new ArrayList();
201              for (int n : ns)
202 <                assertEquals(0, q.drainTo(new ArrayList(), n));
202 >                assertEquals(0, q.drainTo(sink, n));
203              assertEquals(1, q.size());
204              assertSame(one, q.poll());
205 <            assertTrue(c.isEmpty());
205 >            assertTrue(sink.isEmpty());
206          }
207      }
208  
# Line 245 | Line 247 | public abstract class BlockingQueueTest
247          assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
248  
249          barrier.await();
250 <        assertThreadStaysAlive(t);
250 >        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
251          t.interrupt();
252          awaitTermination(t);
253      }
# Line 267 | Line 269 | public abstract class BlockingQueueTest
269              }});
270  
271          await(threadStarted);
272 <        assertThreadStaysAlive(t);
272 >        assertThreadBlocks(t, Thread.State.WAITING);
273          t.interrupt();
274          awaitTermination(t);
275      }
# Line 308 | Line 310 | public abstract class BlockingQueueTest
310              }});
311  
312          await(threadStarted);
313 <        assertThreadStaysAlive(t);
313 >        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
314          t.interrupt();
315          awaitTermination(t);
316      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines