public void test_clone() { // Test for method java.lang.Object java.text.ChoiceFormat.clone() ChoiceFormat f = (ChoiceFormat)f1.Clone(); assertTrue("Not equal", f.Equals(f1)); f.SetChoices(new double[] { 0, 1, 2 }, new String[] { "0", "1", "2" }); assertTrue("Equal", !f.Equals(f1)); }
public void test_equalsLjava_lang_Object() { // Test for method boolean // java.text.ChoiceFormat.equals(java.lang.Object) String patternString = "-2#Inverted Orange| 0#No Orange| 0<Almost No Orange| 1#Normal Orange| 2#Expensive Orange"; double[] appleLimits = { 1, 2, 3, 4, 5 }; String[] appleFormats = { "Tiny Apple", "Small Apple", "Medium Apple", "Large Apple", "Huge Apple" }; double[] orangeLimits = { -2, 0, ChoiceFormat.NextDouble(0), 1, 2 }; String[] orangeFormats = { "Inverted Orange", "No Orange", "Almost No Orange", "Normal Orange", "Expensive Orange" }; ChoiceFormat appleChoiceFormat = new ChoiceFormat(appleLimits, appleFormats); ChoiceFormat orangeChoiceFormat = new ChoiceFormat(orangeLimits, orangeFormats); ChoiceFormat orangeChoiceFormat2 = new ChoiceFormat(patternString); ChoiceFormat hybridChoiceFormat = new ChoiceFormat(appleLimits, orangeFormats); assertTrue("Apples should not equal oranges", !appleChoiceFormat .Equals(orangeChoiceFormat)); assertTrue("Different limit list--should not appear as equal", !orangeChoiceFormat.Equals(hybridChoiceFormat)); assertTrue("Different format list--should not appear as equal", !appleChoiceFormat.Equals(hybridChoiceFormat)); assertTrue("Should be equal--identical format", appleChoiceFormat .Equals(appleChoiceFormat)); assertTrue("Should be equals--same limits, same formats", orangeChoiceFormat.Equals(orangeChoiceFormat2)); ChoiceFormat f2 = new ChoiceFormat( "0#Less than one|1#one|1<Between one and two|2<Greater than two"); assertTrue("Not equal", f1.Equals(f2)); }