Code example for FieldPosition

Methods: getBeginIndex, setBeginIndex, setEndIndex

0
        args = {java.lang.Object.class}
    ) 
    public void test_equalsLjava_lang_Object() { 
        // Test for method boolean 
        // java.text.FieldPosition.equals(java.lang.Object) 
        FieldPosition fpos = new FieldPosition(1);
        FieldPosition fpos1 = new FieldPosition(1);
        assertTrue("Identical objects were not equal!", fpos.equals(fpos1));
 
        FieldPosition fpos2 = new FieldPosition(2);
        assertTrue("Objects with a different ID should not be equal!", !fpos
                .equals(fpos2));
 
        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));