| Method from org.apache.commons.collections.primitives.adapters.TestShortListIteratorListIterator Detail: |
protected Object addSetValue() {
return new Short((short)1);
}
|
public short[] getFullElements() {
return new short[] { (short)0, (short)1, (short)2, (short)3, (short)4, (short)5, (short)6, (short)7, (short)8, (short)9 };
}
|
public ListIterator makeEmptyListIterator() {
return ShortListIteratorListIterator.wrap(makeEmptyShortList().listIterator());
}
|
protected ShortList makeEmptyShortList() {
return new ArrayShortList();
}
|
public ListIterator makeFullListIterator() {
return ShortListIteratorListIterator.wrap(makeFullShortList().listIterator());
}
|
protected ShortList makeFullShortList() {
ShortList list = makeEmptyShortList();
short[] elts = getFullElements();
for(int i=0;i< elts.length;i++) {
list.add((short)elts[i]);
}
return list;
}
|
public static Test suite() {
return new TestSuite(TestShortListIteratorListIterator.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() {
short[] elements = getFullElements();
Iterator iter = makeFullIterator();
for(int i=0;i< elements.length;i++) {
assertTrue(iter.hasNext());
assertEquals(new Short(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
}
}
}
|