| Method from org.apache.commons.collections.primitives.adapters.TestLongListIteratorListIterator Detail: |
protected Object addSetValue() {
return new Long((long)1);
}
|
public long[] getFullElements() {
return new long[] { (long)0, (long)1, (long)2, (long)3, (long)4, (long)5, (long)6, (long)7, (long)8, (long)9 };
}
|
public ListIterator makeEmptyListIterator() {
return LongListIteratorListIterator.wrap(makeEmptyLongList().listIterator());
}
|
protected LongList makeEmptyLongList() {
return new ArrayLongList();
}
|
public ListIterator makeFullListIterator() {
return LongListIteratorListIterator.wrap(makeFullLongList().listIterator());
}
|
protected LongList makeFullLongList() {
LongList list = makeEmptyLongList();
long[] elts = getFullElements();
for(int i=0;i< elts.length;i++) {
list.add((long)elts[i]);
}
return list;
}
|
public static Test suite() {
return new TestSuite(TestLongListIteratorListIterator.class);
}
|
public void testEmptyIterator() {
assertTrue( ! makeEmptyIterator().hasNext() );
try {
makeEmptyIterator().next();
fail("Expected NoSuchElementException");
} catch(NoSuchElementException e) {
// expected
}
if(supportsRemove()) {
try {
makeEmptyIterator().remove();
fail("Expected IllegalStateException");
} catch(IllegalStateException e) {
// expected
}
}
}
|
public void testNextHasNextRemove() {
long[] elements = getFullElements();
Iterator iter = makeFullIterator();
for(int i=0;i< elements.length;i++) {
assertTrue(iter.hasNext());
assertEquals(new Long(elements[i]),iter.next());
if(supportsRemove()) {
iter.remove();
}
}
assertTrue(! iter.hasNext() );
}
|
public void testRemoveAfterRemove() {
if(supportsRemove()) {
Iterator iter = makeFullIterator();
iter.next();
iter.remove();
try {
iter.remove();
fail("Expected IllegalStateException");
} catch(IllegalStateException e) {
// expected
}
}
}
|
public void testRemoveBeforeNext() {
if(supportsRemove()) {
try {
makeFullIterator().remove();
fail("Expected IllegalStateException");
} catch(IllegalStateException e) {
// expected
}
}
}
|