Exemplo n.º 1
0
 /** Queue contains all elements of successful addAll */
 public void testAddAll5() {
   PDelay[] empty = new PDelay[0];
   PDelay[] ints = new PDelay[SIZE];
   for (int i = SIZE - 1; i >= 0; --i) ints[i] = new PDelay(i);
   DelayQueue q = new DelayQueue();
   assertFalse(q.addAll(Arrays.asList(empty)));
   assertTrue(q.addAll(Arrays.asList(ints)));
   for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll());
 }
Exemplo n.º 2
0
 /** addAll(this) throws IAE */
 public void testAddAllSelf() {
   DelayQueue q = populatedQueue(SIZE);
   try {
     q.addAll(q);
     shouldThrow();
   } catch (IllegalArgumentException success) {
   }
 }
Exemplo n.º 3
0
 /**
  * addAll of a collection with any null elements throws NPE after possibly adding some elements
  */
 public void testAddAll3() {
   DelayQueue q = new DelayQueue();
   PDelay[] a = new PDelay[SIZE];
   for (int i = 0; i < SIZE - 1; ++i) a[i] = new PDelay(i);
   try {
     q.addAll(Arrays.asList(a));
     shouldThrow();
   } catch (NullPointerException success) {
   }
 }