[cvs] / jsr166 / src / test / tck / BlockingQueueTest.java Repository:
ViewVC logotype

Diff of /jsr166/src/test/tck/BlockingQueueTest.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.20, Sun May 14 14:52:50 2017 UTC revision 1.21, Wed Jan 10 14:41:52 2018 UTC
# Line 189  Line 189 
189      public void testDrainToNonPositiveMaxElements() {      public void testDrainToNonPositiveMaxElements() {
190          final BlockingQueue q = emptyCollection();          final BlockingQueue q = emptyCollection();
191          final int[] ns = { 0, -1, -42, Integer.MIN_VALUE };          final int[] ns = { 0, -1, -42, Integer.MIN_VALUE };
192          for (int n : ns)          final ArrayList sink = new ArrayList();
193              assertEquals(0, q.drainTo(new ArrayList(), n));          for (int n : ns) {
194                assertEquals(0, q.drainTo(sink, n));
195                assertTrue(sink.isEmpty());
196            }
197          if (q.remainingCapacity() > 0) {          if (q.remainingCapacity() > 0) {
198              // Not SynchronousQueue, that is              // Not SynchronousQueue, that is
199              Object one = makeElement(1);              Object one = makeElement(1);
200              q.add(one);              q.add(one);
             ArrayList c = new ArrayList();  
201              for (int n : ns)              for (int n : ns)
202                  assertEquals(0, q.drainTo(new ArrayList(), n));                  assertEquals(0, q.drainTo(sink, n));
203              assertEquals(1, q.size());              assertEquals(1, q.size());
204              assertSame(one, q.poll());              assertSame(one, q.poll());
205              assertTrue(c.isEmpty());              assertTrue(sink.isEmpty());
206          }          }
207      }      }
208    

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8