Search in sources :

Example 1 with Support_MessageFormat

use of tests.support.Support_MessageFormat in project robovm by robovm.

the class OldMessageFormatTest method test_formatToCharacterIteratorLjava_lang_Object.

public void test_formatToCharacterIteratorLjava_lang_Object() {
    // Test for method formatToCharacterIterator(java.lang.Object)
    new Support_MessageFormat("test_formatToCharacterIteratorLjava_lang_Object").t_formatToCharacterIterator();
    try {
        new MessageFormat("{1, number}").formatToCharacterIterator(null);
        fail("NullPointerException was not thrown.");
    } catch (NullPointerException npe) {
    //expected
    }
    try {
        new MessageFormat("{0, time}").formatToCharacterIterator(new Object[] { "" });
        fail("IllegalArgumentException was not thrown.");
    } catch (IllegalArgumentException iae) {
    //expected
    }
}
Also used : Support_MessageFormat(tests.support.Support_MessageFormat) MessageFormat(java.text.MessageFormat) Support_MessageFormat(tests.support.Support_MessageFormat)

Example 2 with Support_MessageFormat

use of tests.support.Support_MessageFormat in project robovm by robovm.

the class OldMessageFormatTest method test_formatLjava_lang_ObjectLjava_lang_StringBufferLjava_text_FieldPosition.

public void test_formatLjava_lang_ObjectLjava_lang_StringBufferLjava_text_FieldPosition() {
    // Test for method java.lang.StringBuffer
    // java.text.MessageFormat.format(java.lang.Object,
    // java.lang.StringBuffer, java.text.FieldPosition)
    new Support_MessageFormat("test_formatLjava_lang_ObjectLjava_lang_StringBufferLjava_text_FieldPosition").t_format_with_FieldPosition();
    String pattern = "On {4,date} at {3,time}, he ate {2,number, integer} " + "hamburger{2,choice,1#|1<s}.";
    MessageFormat format = new MessageFormat(pattern, Locale.US);
    Object[] objects = new Object[] { "", new Integer(3), 8, "" };
    try {
        format.format(objects, new StringBuffer(), new FieldPosition(DateFormat.Field.AM_PM));
        fail("IllegalArgumentException was not thrown.");
    } catch (IllegalArgumentException iae) {
    //expected
    }
}
Also used : Support_MessageFormat(tests.support.Support_MessageFormat) MessageFormat(java.text.MessageFormat) Support_MessageFormat(tests.support.Support_MessageFormat) FieldPosition(java.text.FieldPosition)

Aggregations

MessageFormat (java.text.MessageFormat)2 Support_MessageFormat (tests.support.Support_MessageFormat)2 FieldPosition (java.text.FieldPosition)1