/** 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()); }
/** addAll(this) throws IAE */ public void testAddAllSelf() { DelayQueue q = populatedQueue(SIZE); try { q.addAll(q); shouldThrow(); } catch (IllegalArgumentException success) { } }
/** * 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) { } }