Code example for ChoiceFormat

Methods: hashCode

0
    /** 
     * @tests java.text.ChoiceFormat#hashCode() 
     */ 
    public void test_hashCode() { 
        // Test for method int java.text.ChoiceFormat.hashCode() 
        ChoiceFormat f2 = new ChoiceFormat(
                "0#Less than one|1#one|1<Between one and two|2<Greater than two"); 
        assertTrue("Different hash", f1.hashCode() == f2.hashCode());
    } 
 
    /** 
     * @tests java.text.ChoiceFormat#nextDouble(double) 
     */ 
    public void test_nextDoubleD() { 
        // Test for method double java.text.ChoiceFormat.nextDouble(double) 
        assertTrue("Not greater 5", ChoiceFormat.nextDouble(5) > 5);
        assertTrue("Not greater 0", ChoiceFormat.nextDouble(0) > 0);
        assertTrue("Not greater -5", ChoiceFormat.nextDouble(-5) > -5);
        assertTrue("Not NaN", Double.isNaN(ChoiceFormat.nextDouble(Double.NaN)));
    } 
Experience pair programming with AI  Get Codota for Java