| Method from org.apache.commons.collections.primitives.TestByteIterator Detail: |
abstract protected byte[] getFullElements()
|
abstract protected ByteIterator makeEmptyByteIterator()
|
public Iterator makeEmptyIterator() {
return ByteIteratorIterator.wrap(makeEmptyByteIterator());
}
|
abstract protected ByteIterator makeFullByteIterator()
|
public Iterator makeFullIterator() {
return ByteIteratorIterator.wrap(makeFullByteIterator());
}
|
public void testEmptyByteIterator() {
assertTrue( ! makeEmptyByteIterator().hasNext() );
try {
makeEmptyByteIterator().next();
fail("Expected NoSuchElementException");
} catch(NoSuchElementException e) {
// expected
}
if(supportsRemove()) {
try {
makeEmptyByteIterator().remove();
fail("Expected IllegalStateException");
} catch(IllegalStateException e) {
// expected
}
}
}
|
public void testNextHasNextRemove() {
byte[] elements = getFullElements();
ByteIterator iter = makeFullByteIterator();
for(int i=0;i< elements.length;i++) {
assertTrue(iter.hasNext());
assertEquals(elements[i],iter.next(),0f);
if(supportsRemove()) {
iter.remove();
}
}
assertTrue(! iter.hasNext() );
}
|
public void testRemoveAfterRemove() {
if(supportsRemove()) {
ByteIterator iter = makeFullByteIterator();
iter.next();
iter.remove();
try {
iter.remove();
fail("Expected IllegalStateException");
} catch(IllegalStateException e) {
// expected
}
}
}
|
public void testRemoveBeforeNext() {
if(supportsRemove()) {
try {
makeFullByteIterator().remove();
fail("Expected IllegalStateException");
} catch(IllegalStateException e) {
// expected
}
}
}
|