Code example for NumberFormat

Methods: equals, getMaximumIntegerDigits

0
        nf1.setMaximumIntegerDigits(max_digits);
 
        NumberFormat nf2 = (NumberFormat) nf1.clone();
        NumberFormat nf3 = (NumberFormat) nf1.clone();
 
        assertTrue("Clonned object is not equal to object", nf2.equals(nf1));
        assertTrue("Two clonned objects are not equal", nf2.equals(nf3));
 
        assertTrue("Max digits value is incorrect for clonned object", nf2
                .getMaximumIntegerDigits() == max_digits);
 
        nf1.setMaximumIntegerDigits(10);
        assertTrue(
                "Max digits value is incorrect for clonned object after changing this value for object", 
                nf2.getMaximumIntegerDigits() == max_digits);
    } 
 
    public void test_equals() { 
 
        NumberFormat nf1 = NumberFormat.getInstance();
        NumberFormat nf2 = NumberFormat.getInstance();