/** 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()); }
/** 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()); }