示例#1
0
        /// @tests java.text.Collator#getAvailableLocales()
        // FIXME This test fails on Harmony ClassLibrary
        public void Failing_test_getAvailableLocales()
        {
            Locale[] locales = ILOG.J2CsMapping.Text.Collator.GetAvailableLocales();
            NUnit.Framework.Assert.IsTrue(locales.Length > 0, "No locales");
            bool english = false, german = false;

            for (int i = locales.Length; --i >= 0;)
            {
                if (locales[i].Equals(Locale.ENGLISH))
                {
                    english = true;
                }
                if (locales[i].Equals(Locale.GERMAN))
                {
                    german = true;
                }
                // Output the working locale to help diagnose a hang
                Collator c1 = ILOG.J2CsMapping.Text.Collator.GetInstance(locales[i]);
                NUnit.Framework.Assert.IsTrue(c1.Compare("a", "b") < 0, "Doesn't work");
                NUnit.Framework.Assert.IsTrue(c1.GetDecomposition() == ILOG.J2CsMapping.Text.Collator.NO_DECOMPOSITION, "Wrong decomposition");
                NUnit.Framework.Assert.IsTrue(c1.GetStrength() == ILOG.J2CsMapping.Text.Collator.TERTIARY, "Wrong strength");
                if (c1  is  RuleBasedCollator)
                {
                    try {
                        new RuleBasedCollator(((RuleBasedCollator)c1).GetRules());
                    } catch (ParseException e) {
                        NUnit.Framework.Assert.Fail("ParseException");
                    }
                    // assertTrue("Can't recreate: " + locales[i], temp.equals(c1));
                }
            }
            NUnit.Framework.Assert.IsTrue(english && german, "Missing locales");
        }