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