Code example for ChoiceFormat

Methods: format

0
 
	/** 
	 * @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"); 
 
		assertEquals("NEGATIVE_ONE", fmt.format(Long.MIN_VALUE));
		assertEquals("NEGATIVE_ONE", fmt.format(-1));
		assertEquals("ZERO", fmt.format(0));
		assertEquals("ONE", fmt.format(1));
		assertEquals("GREATER_THAN_ONE", fmt.format(Long.MAX_VALUE));
	} 
	 
	/** 
	 * @tests java.text.ChoiceFormat#format(double) 
	 */ 
	public void test_formatD() { 
		ChoiceFormat fmt = new ChoiceFormat(
				"-1#NEGATIVE_ONE|0#ZERO|1#ONE|1<GREATER_THAN_ONE");