harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r423037 - /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/FormatterTest.java
Date Tue, 18 Jul 2006 10:09:51 GMT
Author: pyang
Date: Tue Jul 18 03:09:49 2006
New Revision: 423037

URL: http://svn.apache.org/viewvc?rev=423037&view=rev
Log:
Fix for HARMONY-905([classlib][luni]Refactor test case: tests.api.java.util.FormatterTest.test_formatLjava_lang_String$Ljava_lang_Object_Percent)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/FormatterTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/FormatterTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/FormatterTest.java?rev=423037&r1=423036&r2=423037&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/FormatterTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/FormatterTest.java
Tue Jul 18 03:09:49 2006
@@ -1109,20 +1109,13 @@
         }
 
         f = new Formatter(Locale.US);
-        final String[] illFlags = { "%+%", "%#%", "% %", "%0%", "%,%", "%(%" };
-        for (int i = 0; i < illFlags.length; i++) {
-            try {
-                f.format(illFlags[i]);
-                fail("should throw FormatFlagsConversionMismatchException: "
-                        + illFlags[i]);
-                /*
-                 * error on RI, throw IllegalFormatFlagsException specification
-                 * says FormatFlagsConversionMismatchException should be thrown
-                 */
-            } catch (FormatFlagsConversionMismatchException e) {
-                // expected
-            }
-        }
+        assertFormatFlagsConversionMismatchException(f, "%+%");
+        assertFormatFlagsConversionMismatchException(f, "%#%");
+        assertFormatFlagsConversionMismatchException(f, "% %");
+        assertFormatFlagsConversionMismatchException(f, "%0%");
+        assertFormatFlagsConversionMismatchException(f, "%,%");
+        assertFormatFlagsConversionMismatchException(f, "%(%");
+        
 
         f = new Formatter(Locale.KOREAN);
         f.format("%4%", 1);
@@ -1140,6 +1133,20 @@
          * 4 chars width.
          */
         assertEquals("%   ", f.toString());
+    }
+
+    private void assertFormatFlagsConversionMismatchException(Formatter f, String str) {
+        try {
+            f.format(str);
+            fail("should throw FormatFlagsConversionMismatchException: "
+                    + str);
+             /*
+             * error on RI, throw IllegalFormatFlagsException specification
+             * says FormatFlagsConversionMismatchException should be thrown
+             */
+        } catch (FormatFlagsConversionMismatchException e) {
+           // expected
+        }
     }
 
     /**



Mime
View raw message