Code example for FieldPosition

Methods: getEndIndex, setBeginIndex, setEndIndex

0
 
        fpos.setBeginIndex(1);
        fpos1.setBeginIndex(2);
        assertTrue("Objects with a different beginIndex were still equal!",
                !fpos.equals(fpos1));
        fpos1.setBeginIndex(1);
        fpos1.setEndIndex(2);
        assertTrue("Objects with a different endIndex were still equal!", !fpos
                .equals(fpos1));
 
        FieldPosition fpos3 = new FieldPosition(DateFormat.Field.ERA, 1);
        assertTrue("Objects with a different attribute should not be equal!",
                !fpos.equals(fpos3));
        FieldPosition fpos4 = new FieldPosition(DateFormat.Field.AM_PM, 1);
        assertTrue("Objects with a different attribute should not be equal!",
                !fpos3.equals(fpos4));
    } 
 
    /** 
     * @tests java.text.FieldPosition#getBeginIndex() 
     */