use of java.text.FieldPosition in project j2objc by google.
the class FieldPositionTest method test_setBeginIndexI.
public void test_setBeginIndexI() {
FieldPosition fpos = new FieldPosition(1);
fpos.setBeginIndex(2);
fpos.setEndIndex(3);
assertEquals("beginIndex should have been set to 2", 2, fpos.getBeginIndex());
fpos.setBeginIndex(Integer.MAX_VALUE);
assertEquals("beginIndex should have been set to Integer.MAX_VALUE", Integer.MAX_VALUE, fpos.getBeginIndex());
fpos.setBeginIndex(-1);
assertEquals("beginIndex should have been set to -1", -1, fpos.getBeginIndex());
}
use of java.text.FieldPosition in project j2objc by google.
the class FieldPositionTest method test_getEndIndex.
/**
* @tests java.text.FieldPosition#getEndIndex()
*/
public void test_getEndIndex() {
// Test for method int java.text.FieldPosition.getEndIndex()
FieldPosition fpos = new FieldPosition(1);
fpos.setBeginIndex(2);
fpos.setEndIndex(3);
assertEquals("getEndIndex should have returned 3", 3, fpos.getEndIndex());
}
use of java.text.FieldPosition in project j2objc by google.
the class FieldPositionTest method test_hashCode.
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.", fpos2.hashCode() != fpos3.hashCode());
}
use of java.text.FieldPosition in project j2objc by google.
the class FieldPositionTest method test_getField.
/**
* @tests java.text.FieldPosition#getField()
*/
public void test_getField() {
// Test for method int java.text.FieldPosition.getField()
FieldPosition fpos = new FieldPosition(65);
assertEquals("FieldPosition(65) should have caused getField to return 65", 65, fpos.getField());
FieldPosition fpos2 = new FieldPosition(DateFormat.Field.MINUTE);
assertEquals("FieldPosition(DateFormat.Field.MINUTE) should have caused getField to return -1", -1, fpos2.getField());
}
use of java.text.FieldPosition in project j2objc by google.
the class FieldPositionTest method test_getFieldAttribute.
/**
* @tests java.text.FieldPosition#getFieldAttribute()
*/
public void test_getFieldAttribute() {
// Test for method int java.text.FieldPosition.getFieldAttribute()
FieldPosition fpos = new FieldPosition(DateFormat.Field.TIME_ZONE);
assertTrue("FieldPosition(DateFormat.Field.TIME_ZONE) should have caused getFieldAttribute to return DateFormat.Field.TIME_ZONE", fpos.getFieldAttribute() == DateFormat.Field.TIME_ZONE);
FieldPosition fpos2 = new FieldPosition(DateFormat.TIMEZONE_FIELD);
assertNull("FieldPosition(DateFormat.TIMEZONE_FIELD) should have caused getFieldAttribute to return null", fpos2.getFieldAttribute());
}
Aggregations