| Method from org.apache.commons.collections.primitives.TestCharIterator Detail: |
abstract protected char[] getFullElements()
|
abstract protected CharIterator makeEmptyCharIterator()
|
public Iterator makeEmptyIterator() {
return CharIteratorIterator.wrap(makeEmptyCharIterator());
}
|
abstract protected CharIterator makeFullCharIterator()
|
public Iterator makeFullIterator() {
return CharIteratorIterator.wrap(makeFullCharIterator());
}
|
public void testEmptyCharIterator() {
assertTrue( ! makeEmptyCharIterator().hasNext() );
try {
makeEmptyCharIterator().next();
fail("Expected NoSuchElementException");
} catch(NoSuchElementException e) {
// expected
}
if(supportsRemove()) {
try {
makeEmptyCharIterator().remove();
fail("Expected IllegalStateException");
} catch(IllegalStateException e) {
// expected
}
}
}
|
public void testNextHasNextRemove() {
char[] elements = getFullElements();
CharIterator iter = makeFullCharIterator();
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()) {
CharIterator iter = makeFullCharIterator();
iter.next();
iter.remove();
try {
iter.remove();
fail("Expected IllegalStateException");
} catch(IllegalStateException e) {
// expected
}
}
}
|
public void testRemoveBeforeNext() {
if(supportsRemove()) {
try {
makeFullCharIterator().remove();
fail("Expected IllegalStateException");
} catch(IllegalStateException e) {
// expected
}
}
}
|