示例#1
0
 /** toArray(a) contains all elements */
 public void testToArray2() {
   DelayQueue<PDelay> q = populatedQueue(SIZE);
   PDelay[] ints = new PDelay[SIZE];
   PDelay[] array = q.toArray(ints);
   assertSame(ints, array);
   Arrays.sort(ints);
   for (int i = 0; i < ints.length; i++) assertSame(ints[i], q.remove());
 }
示例#2
0
 /** toArray(incompatible array type) throws ArrayStoreException */
 public void testToArray1_BadArg() {
   DelayQueue q = populatedQueue(SIZE);
   try {
     q.toArray(new String[10]);
     shouldThrow();
   } catch (ArrayStoreException success) {
   }
 }
示例#3
0
 /** toArray contains all elements */
 public void testToArray() throws InterruptedException {
   DelayQueue q = populatedQueue(SIZE);
   Object[] o = q.toArray();
   Arrays.sort(o);
   for (int i = 0; i < o.length; i++) assertSame(o[i], q.take());
 }