コード例 #1
0
 /** Test append empty queues. */
 @Test
 public final void testAppendEmptyQueueToEmptyQueue() {
   originalQueue.append(q);
   assertTrue(
       "Appending queue is not empty when both queues are empty",
       q.isEmpty() && originalQueue.isEmpty());
 }
コード例 #2
0
 /** Test append nonempty queue to empty queue. */
 @Test
 public final void testAppendNonEmptyQueueToEmptyQueue() {
   for (int i = 0; i < 4; i++) {
     q.offer(i);
   }
   originalQueue.append(q);
   assertTrue("Original queue has wrong size.", originalQueue.size() == 4);
   for (int i = 0; i < 4; i++) {
     assertTrue("Returns wrong value", (originalQueue.poll() == i));
   }
   assertTrue("Appending queue is not empty when both queues are empty", q.isEmpty());
 }