/** Test method for {@link org.apache.niolex.commons.collection.RetainLinkedList#isEmpty()}. */
 @Test
 public void testIsEmpty() {
   RetainLinkedList<String> list = new RetainLinkedList<String>(3);
   list.add("It ");
   list.add("is ");
   list.add("a ");
   list.add("big ");
   list.add("world!");
   assertTrue(list.hasNext());
   assertFalse(list.hasRetain());
   String w = "";
   while (list.hasNext()) {
     list.handleNext();
   }
   assertFalse(list.hasNext());
   assertTrue(list.hasRetain());
   assertEquals(list.totalSize(), 3);
   assertEquals(list.handleSize(), 0);
   while (list.hasRetain()) {
     w += list.handleRetain();
   }
   assertEquals(w, "a big world!");
   assertEquals(list.totalSize(), 0);
   assertEquals(list.handleSize(), 0);
   assertFalse(list.hasNext());
   assertFalse(list.hasRetain());
 }
 /** Test method for {@link org.apache.niolex.commons.collection.RetainLinkedList#toArray(E[])}. */
 @Test
 public void testToArray() {
   RetainLinkedList<String> list = new RetainLinkedList<String>(3);
   list.add("It ");
   list.add("is ");
   list.add("a ");
   list.add("big ");
   list.add("world!");
   String[] arr = new String[6];
   arr[5] = "not me.";
   list.toArray(arr);
   assertEquals(arr[5], "not me.");
   assertEquals(arr[4], "world!");
   String w = "";
   while (list.hasNext()) {
     list.handleNext();
   }
   assertEquals(list.totalSize(), 3);
   assertEquals(list.handleSize(), 0);
   arr = new String[2];
   list.toArray(arr);
   assertEquals(arr[0], "a ");
   assertEquals(arr[1], "big ");
   while (list.hasRetain()) {
     w += list.handleRetain();
   }
   assertEquals(w, "a big world!");
   assertEquals(list.totalSize(), 0);
   assertEquals(list.handleSize(), 0);
 }
 /**
  * Test method for {@link
  * org.apache.niolex.commons.collection.RetainLinkedList#addAll(java.util.Collection)}.
  */
 @Test
 public void testHasNext() {
   RetainLinkedList<String> list = new RetainLinkedList<String>(3);
   list.add("It ");
   list.add("is ");
   list.add("a ");
   list.add("big ");
   list.add("world!");
   RetainLinkedList<String> list2 = new RetainLinkedList<String>(5);
   list2.addAll(list);
   list2.add("Good");
   list2.add("Not yet implemented");
   while (list2.handleNext() != null) {
     list2.handleNext();
   }
   assertFalse(list2.hasNext());
   assertEquals(list2.handleSize(), 0);
   assertTrue(list2.hasRetain());
   assertEquals(list2.totalSize(), 5);
 }