[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.9, Mon May 30 23:51:08 2011 UTC revision 1.10, Tue Jun 14 03:22:38 2011 UTC
# Line 8  Line 8 
8   */   */
9    
10  import junit.framework.*;  import junit.framework.*;
11    import java.util.ArrayList;
12  import java.util.Arrays;  import java.util.Arrays;
13  import java.util.Collection;  import java.util.Collection;
14  import java.util.Queue;  import java.util.Queue;
# Line 180  Line 181 
181      }      }
182    
183      /**      /**
184         * drainTo(c, -n) returns 0
185         */
186        public void testDrainToNegativeMaxElements() {
187            final BlockingQueue q = emptyCollection();
188            assertEquals(0, q.drainTo(new ArrayList(), -42));
189        }
190    
191        /**
192         * drainTo(c, 0) returns 0 and does nothing
193         */
194        public void testDrainToZeroMaxElements() {
195            final BlockingQueue q = emptyCollection();
196            if (q.remainingCapacity() == 0) {
197                // SynchronousQueue, for example
198                assertEquals(0, q.drainTo(new ArrayList(), 0));
199            } else {
200                Object one = makeElement(1);
201                q.add(one);
202                ArrayList c = new ArrayList();
203                assertEquals(0, q.drainTo(c, 0));
204                assertEquals(1, q.size());
205                assertSame(one, q.poll());
206                assertTrue(c.isEmpty());
207            }
208        }
209    
210        /**
211       * timed poll before a delayed offer times out; after offer succeeds;       * timed poll before a delayed offer times out; after offer succeeds;
212       * on interruption throws       * on interruption throws
213       */       */

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8