FYI - this change is related to this issue https://issues.apache.org/jira/browse/HARMONY-6184 i logged.
I found that the DecimalFormatSymbolsTest was failing because the localization data from the RI and the localization data from ICU. In this case, the major difference was the NaN property being "NaN" instead of the RI's "\uFFFD". I logged the bug as a non-bug difference. I modified the test to assert the data that was in ser file, rather than comparing it to Harmony's version. If we're going to stick with ICU, this seems like the only path to take, unless we wanted to modify the localization info for ICU ourselves. -Nathan On Mon, Apr 27, 2009 at 2:51 PM, <[email protected]> wrote: > Author: ndbeyer > Date: Mon Apr 27 19:51:09 2009 > New Revision: 769133 > > URL: http://svn.apache.org/viewvc?rev=769133&view=rev > Log: > fix DecimalFormatSymbolsTest to assert data in serialized files, not how they > compare to Harmony's data > > Modified: > harmony/enhanced/classlib/trunk/modules/text/make/exclude.common > > harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatSymbolsTest.java > > Modified: harmony/enhanced/classlib/trunk/modules/text/make/exclude.common > URL: > http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/text/make/exclude.common?rev=769133&r1=769132&r2=769133&view=diff > ============================================================================== > --- harmony/enhanced/classlib/trunk/modules/text/make/exclude.common > (original) > +++ harmony/enhanced/classlib/trunk/modules/text/make/exclude.common Mon Apr > 27 19:51:09 2009 > @@ -1,7 +1,5 @@ > org/apache/harmony/text/tests/java/text/DecimalFormatTest.java > org/apache/harmony/text/tests/java/text/MessageFormatTest.java > -org/apache/harmony/text/tests/java/text/DecimalFormatSymbolsTest.java > org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java > org/apache/harmony/text/tests/java/text/RuleBasedCollatorTest.java > org/apache/harmony/text/tests/java/text/CollationElementIteratorTest.java > - > > Modified: > harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatSymbolsTest.java > URL: > http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatSymbolsTest.java?rev=769133&r1=769132&r2=769133&view=diff > ============================================================================== > --- > harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatSymbolsTest.java > (original) > +++ > harmony/enhanced/classlib/trunk/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatSymbolsTest.java > Mon Apr 27 19:51:09 2009 > @@ -393,34 +393,57 @@ > assertNotNull(currency); > } > > - // Use RI to write DecimalFormatSymbols out, use Harmony to read > - // DecimalFormatSymbols in. The read symbol will be equal with those > - // instantiated inside Harmony. > - > - // This assertion will not come into existence the other way around. > This is > - // probably caused by different serialization mechanism used by RI and > - // Harmony. > + /** > + * Assert that Harmony can correct read an instance that was created by > + * the Java 1.5 RI. The actual values may differ on Harmony and other > JREs, > + * so we only assert the values that are known to be in the serialized > data. > + */ > public void test_RIHarmony_compatible() throws Exception { > + DecimalFormatSymbols dfs; > ObjectInputStream i = null; > try { > - DecimalFormatSymbols symbols = new DecimalFormatSymbols( > - Locale.FRANCE); > - i = new ObjectInputStream( > - getClass() > - .getClassLoader() > - .getResourceAsStream( > - > "/serialization/java/text/DecimalFormatSymbols.ser")); > - DecimalFormatSymbols symbolsD = (DecimalFormatSymbols) i > - .readObject(); > - assertEquals(symbols, symbolsD); > + i = new > ObjectInputStream(getClass().getClassLoader().getResourceAsStream( > + "/serialization/java/text/DecimalFormatSymbols.ser")); > + dfs = (DecimalFormatSymbols) i.readObject(); > } finally { > try { > if (i != null) { > i.close(); > } > } catch (Exception e) { > - // ignore > } > } > + // Values based on Java 1.5 RI DecimalFormatSymbols for Locale.FRANCE > + /* > + * currency = [EUR] > + * currencySymbol = [€][U+20ac] > + * decimalSeparator = [,][U+002c] > + * digit = [#][U+0023] > + * groupingSeparator = [ ][U+00a0] > + * infinity = [∞][U+221e] > + * internationalCurrencySymbol = [EUR] > + * minusSign = [-][U+002d] > + * monetaryDecimalSeparator = [,][U+002c] > + * naN = [�][U+fffd] > + * patternSeparator = [;][U+003b] > + * perMill = [‰][U+2030] > + * percent = [%][U+0025] > + * zeroDigit = [0][U+0030] > + */ > + assertEquals("EUR", dfs.getCurrency().getCurrencyCode()); > + assertEquals("\u20AC", dfs.getCurrencySymbol()); > + assertEquals(',', dfs.getDecimalSeparator()); > + assertEquals('#', dfs.getDigit()); > + assertEquals('\u00a0', dfs.getGroupingSeparator()); > + assertEquals("\u221e", dfs.getInfinity()); > + assertEquals("EUR", dfs.getInternationalCurrencySymbol()); > + assertEquals('-', dfs.getMinusSign()); > + assertEquals(',', dfs.getMonetaryDecimalSeparator()); > + // RI's default NaN is U+FFFD, Harmony's is based on ICU > + assertEquals("\uFFFD", dfs.getNaN()); > + assertEquals('\u003b', dfs.getPatternSeparator()); > + assertEquals('\u2030', dfs.getPerMill()); > + assertEquals('%', dfs.getPercent()); > + assertEquals('0', dfs.getZeroDigit()); > } > } > > >
