Code example for ChoiceFormat

Methods: applyPatterntoPattern

0
        assertTrue(
                "Wrong pattern: " + pattern,
                pattern
                        .equals("0.0#Less than one|1.0#one|1.0<Between one and two|2.0<Greater than two"));
 
        cf = new ChoiceFormat(
                "-1#is negative| 0#is zero or fraction | 1#is one |1.0<is 1+|2#is two |2<is more than 2."); 
        String str = "org.apache.harmony.tests.java.lang.share.MyResources2";
        cf.applyPattern(str);
        ptrn = cf.toPattern();
		assertEquals("Return value should be empty string for invalid pattern",
				0, ptrn.length());
	} 
 
	/** 
	 * @tests java.text.ChoiceFormat#format(long) 
	 */ 
	public void test_formatL() { 
		ChoiceFormat fmt = new ChoiceFormat(
				"-1#NEGATIVE_ONE|0#ZERO|1#ONE|1<GREATER_THAN_ONE");