Code example for FieldPosition

Methods: hashCodesetBeginIndexsetEndIndex

0
 
public class OldFieldPositionTest extends junit.framework.TestCase {
 
    public void test_hashCode() { 
        // Test for method int java.text.FieldPosition.hashCode() 
        FieldPosition fpos1 = new FieldPosition(1);
        FieldPosition fpos2 = new FieldPosition(1);
        assertTrue("test 1: hash codes are not equal for equal objects.",
                fpos1.hashCode() == fpos2.hashCode());
        fpos1.setBeginIndex(5);
        fpos1.setEndIndex(110);
        assertTrue("test 2: hash codes are equal for non equal objects.",
                fpos1.hashCode() != fpos2.hashCode());
        fpos2.setBeginIndex(5);
        fpos2.setEndIndex(110);
        assertTrue("test 3: hash codes are not equal for equal objects.",
                fpos1.hashCode() == fpos2.hashCode());
 
        FieldPosition fpos3 = new FieldPosition(
                DateFormat.Field.DAY_OF_WEEK_IN_MONTH);
 
        assertTrue("test 4: hash codes are equal for non equal objects.",
Stop searching for code, let great code find you!  Add Codota to your java IDE