Code example for StringCharacterIterator

Methods: next, previous, setIndex

0
        level = TestLevel.COMPLETE, 
        notes = "", 
        method = "StringCharacterIterator", 
        args = {java.lang.String.class}
    ) 
    public void test_ConstructorLjava_lang_String() { 
        assertNotNull(new StringCharacterIterator("value"));
        assertNotNull(new StringCharacterIterator(""));
        try { 
            new StringCharacterIterator(null);
            fail("Assert 0: no null pointer");
        } catch (NullPointerException e) {
            // expected 
        } 
 
        StringCharacterIterator it = new StringCharacterIterator("testing");
        assertEquals("Wrong begin index", 0, it.getBeginIndex());
        assertEquals("Wrong end index", 7, it.getEndIndex());
        assertEquals("Wrong current index", 0, it.getIndex());
        assertEquals("Wrong current char", 't', it.current());
        assertEquals("Wrong next char", 'e', it.next());