Commits

Anonymous committed 04722be

Fix lossage in OldDecimalFormatSymbolsTest.

Change-Id: I5ed2c5784fcf545009f2b4d64c7db03933e8dc03

Comments (0)

Files changed (1)

luni/src/test/java/libcore/java/text/OldDecimalFormatSymbolsTest.java

     public void test_RIHarmony_compatible() throws Exception {
         ObjectInputStream i = null;
         try {
-            DecimalFormatSymbols symbols = new DecimalFormatSymbols(
-                    Locale.FRANCE);
+            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);
+            DecimalFormatSymbols riSymbols = (DecimalFormatSymbols) i.readObject();
+            // RI's default NaN is U+FFFD, Harmony's is based on ICU
+            // This suggests an RI bug, assuming that non-UTF8 bytes are UTF8 and
+            // getting a conversion failure.
+            riSymbols.setNaN("NaN");
+            assertEquals(symbols, riSymbols);
         } catch(NullPointerException e) {
             assertNotNull("Failed to load /serialization/java/text/" +
                     "DecimalFormatSymbols.ser", i);
             } catch (Exception e) {
             }
         }
-        assertDecimalFormatSymbolsRIFrance(dfs);
     }
 
 
                 '#', dfs.getMonetaryDecimalSeparator());
     }
 
-    static void assertDecimalFormatSymbolsRIFrance(DecimalFormatSymbols dfs) {
-        // Values based on Java 1.5 RI DecimalFormatSymbols for Locale.FRANCE
+    public void test_DecimalFormatSymbols_France() {
         /*
          * currency = [EUR]
          * currencySymbol = [U+20ac] // EURO SIGN
          * internationalCurrencySymbol = [EUR]
          * minusSign = [-][U+002d]
          * monetaryDecimalSeparator = [,][U+002c]
-         * naN = [U+fffd] // REPLACEMENT CHARACTER
+         * naN = "NaN"
          * patternSeparator = [;][U+003b]
          * perMill = [U+2030] // PER MILLE
          * percent = [%][U+0025]
          * zeroDigit = [0][U+0030]
          */
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.FRANCE);
         assertEquals("EUR", dfs.getCurrency().getCurrencyCode());
         assertEquals("\u20AC", dfs.getCurrencySymbol());
         assertEquals(',', dfs.getDecimalSeparator());
         // RI's default NaN is U+FFFD, Harmony's is based on ICU
         // This suggests an RI bug, assuming that non-UTF8 bytes are UTF8 and
         // getting a conversion failure.
-        assertEquals("\uFFFD", dfs.getNaN());
+        assertEquals("NaN", dfs.getNaN());
         assertEquals('\u003b', dfs.getPatternSeparator());
         assertEquals('\u2030', dfs.getPerMill());
         assertEquals('%', dfs.getPercent());