Code example for StringCharacterIterator

Methods: current, getBeginIndex, getEndIndex, getIndex, next

0
        assertTrue("Wrong previous char4",
                it1.previous() == CharacterIterator.DONE);
        assertEquals("Wrong index", 2, it1.getIndex());
        assertEquals("Wrong current char", 's', it1.current());
    } 
 
    /** 
     * @tests java.text.StringCharacterIterator.setIndex(int) 
     */ 
    @TestTargetNew( 
        level = TestLevel.COMPLETE, 
        notes = "", 
        method = "setIndex", 
        args = {int.class} 
    ) 
    public void test_setIndex() { 
        StringCharacterIterator fixture = new StringCharacterIterator("fixture");
        while (fixture.next() != CharacterIterator.DONE) {
            // empty 
        } 
        assertEquals("fixture".length(), fixture.getIndex());