Search in sources :

Example 36 with FieldPosition

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());
}
Also used : FieldPosition(java.text.FieldPosition)

Example 37 with FieldPosition

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());
}
Also used : FieldPosition(java.text.FieldPosition)

Example 38 with FieldPosition

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());
}
Also used : FieldPosition(java.text.FieldPosition)

Example 39 with FieldPosition

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());
}
Also used : FieldPosition(java.text.FieldPosition)

Example 40 with FieldPosition

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());
}
Also used : FieldPosition(java.text.FieldPosition)

Aggregations

FieldPosition (java.text.FieldPosition)62 Date (java.util.Date)20 SimpleDateFormat (java.text.SimpleDateFormat)15 IsoDateFormat (alma.acs.util.IsoDateFormat)9 DecimalFormat (java.text.DecimalFormat)9 ILogEntry (com.cosylab.logging.engine.log.ILogEntry)8 ACSLogParser (alma.acs.logging.engine.parser.ACSLogParser)5 MessageFormat (java.text.MessageFormat)5 DateFormat (java.text.DateFormat)4 NumberFormat (java.text.NumberFormat)3 ParsePosition (java.text.ParsePosition)3 Vector (java.util.Vector)3 LogTypeHelper (com.cosylab.logging.engine.log.LogTypeHelper)2 ChoiceFormat (java.text.ChoiceFormat)2 ParseException (java.text.ParseException)2 Calendar (java.util.Calendar)2 GregorianCalendar (java.util.GregorianCalendar)2 List (java.util.List)2 Random (java.util.Random)2 EObject (org.eclipse.emf.ecore.EObject)2