コード例 #1
0
ファイル: DelayQueueTest.java プロジェクト: FauxFaux/jdk9-jdk
 /** 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());
 }
コード例 #2
0
ファイル: DelayQueueTest.java プロジェクト: FauxFaux/jdk9-jdk
 /** addAll(this) throws IAE */
 public void testAddAllSelf() {
   DelayQueue q = populatedQueue(SIZE);
   try {
     q.addAll(q);
     shouldThrow();
   } catch (IllegalArgumentException success) {
   }
 }
コード例 #3
0
ファイル: DelayQueueTest.java プロジェクト: FauxFaux/jdk9-jdk
 /**
  * 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) {
   }
 }