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); NUnit.Framework.Assert.IsTrue(!appleChoiceFormat.Equals(orangeChoiceFormat), "Apples should not equal oranges"); NUnit.Framework.Assert.IsTrue(!orangeChoiceFormat.Equals(hybridChoiceFormat), "Different limit list--should not appear as equal"); NUnit.Framework.Assert.IsTrue(!appleChoiceFormat.Equals(hybridChoiceFormat), "Different format list--should not appear as equal"); NUnit.Framework.Assert.IsTrue(appleChoiceFormat.Equals(appleChoiceFormat), "Should be equal--identical format"); NUnit.Framework.Assert.IsTrue(orangeChoiceFormat.Equals(orangeChoiceFormat2), "Should be equals--same limits, same formats"); ChoiceFormat f2 = new ChoiceFormat( "0#Less than one|1#one|1<Between one and two|2<Greater than two"); NUnit.Framework.Assert.IsTrue(f1.Equals(f2), "Not equal"); }
public void Test4104976() { double[] limits = { 1, 20 }; String[] formats = { "xyz", "abc" }; ChoiceFormat cf = new ChoiceFormat(limits, formats); try { Log("Compares to null is always false, returned : "); Logln(cf.Equals(null) ? "TRUE" : "FALSE"); } catch (Exception foo) { Errln("ChoiceFormat.Equals(null) throws exception."); } }