/** * 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); }
/** * Test method for {@link * org.apache.niolex.commons.collection.RetainLinkedList#addAll(org.apache.niolex.commons.collection.RetainLinkedList)}. */ @Test public void testHasRetain() { List<String> list = new ArrayList<String>(); list.add("It "); list.add("is "); list.add("a "); list.add("big "); list.add("world!"); RetainLinkedList<String> list2 = new RetainLinkedList<String>(3); list2.addAll(list); assertEquals(null, list2.handleRetain()); String w = ""; while (list2.handleNext() != null) { list2.handleNext(); } while (list2.hasRetain()) { w += list2.handleRetain(); } assertEquals(w, "a big world!"); assertEquals(list2.totalSize(), 0); assertEquals(list2.handleSize(), 0); }