Code example for MessageFormat

0
    protected void setUp() { 
        Locale.setDefault(Locale.US);
 
        // test with repeating formats and max argument index < max offset 
        String pattern = "A {3, number, currency} B {2, time} C {0, number, percent} D {4}  E {1,choice,0#off|1#on} F {0, date}";
        format1 = new MessageFormat(pattern);
    } 
 
    public void test_applyPatternLjava_lang_String_AndroidFailure() { 
        MessageFormat format = new MessageFormat("test");
        format.setLocale(Locale.FRENCH); // use French since English has the
        // same LONG and FULL time patterns 
        format.applyPattern("{0,time, Full}");
        assertEquals("Wrong full time pattern", "{0,time,full}", format
                .toPattern());
    } 
 
    public void test_formatToCharacterIteratorLjava_lang_Object() { 
        // Test for method formatToCharacterIterator(java.lang.Object) 
        new Support_MessageFormat( 
                "test_formatToCharacterIteratorLjava_lang_Object")