Merge "Fix buggy PriorityQueue test. .remove() is NOT specified to throw a ClassCastException when provided an incorrect type. It simply returns false. Verified by testing with mode host in Vogar." into dalvik-dev
diff --git a/expectations/brokentests.txt b/expectations/brokentests.txt
index c6dcfcc..7219c23 100644
--- a/expectations/brokentests.txt
+++ b/expectations/brokentests.txt
@@ -620,11 +620,6 @@
 result EXEC_FAILED
 pattern .*junit.framework.AssertionFailedError: expected:<3> but was:<2>.*
 
-# our behaviour is consistent with the JDK
-test tests.api.java.math.BigDecimalTest#test_stripTrailingZero
-result EXEC_FAILED
-pattern .*junit.framework.AssertionFailedError: stripTrailingZero failed for 0.0000.*
-
 # this is testing exception priorities
 test org.apache.harmony.nio.tests.java.nio.channels.DatagramChannelTest#testReadByteBuffer_readOnlyBuf
 result EXEC_FAILED
@@ -684,10 +679,6 @@
 result UNSUPPORTED
 
 
-# This test is obsoleted by our java.lang.CharacterTest#test_valueOfC.
-test org.apache.harmony.luni.tests.java.lang.CharacterImplTest#test_valueOfC
-result EXEC_FAILED
-
 # The RI is still on Unicode 4.0, we're on 5.2, and Harmony is inconsistent
 # between its test for isJavaIdentifierPart(char) and isJavaIdentifierPart(int).
 test org.apache.harmony.luni.tests.java.lang.CharacterTest#test_isJavaIdentifierPartC
@@ -706,6 +697,10 @@
 test org.apache.harmony.luni.tests.util.NYITest
 result UNSUPPORTED
 
+# We removed this: we don't support localized exceptions.
+test org.apache.harmony.luni.tests.internal.nls.MessagesTest
+result UNSUPPORTED
+
 
 # These test implementation details we don't share.
 test org.apache.harmony.text.tests.java.text.BreakIteratorTest#test_getInt
@@ -714,3 +709,26 @@
 result EXEC_FAILED
 test org.apache.harmony.text.tests.java.text.BreakIteratorTest#test_getShort
 result EXEC_FAILED
+
+
+
+
+# These test exception priority.
+test org.apache.harmony.luni.tests.java.util.FormatterTest#test_formatLjava_lang_String$Ljava_lang_Object_BigDecimalExceptionOrder
+result EXEC_FAILED
+test org.apache.harmony.luni.tests.java.util.FormatterTest#test_formatLjava_lang_String$Ljava_lang_Object_BigIntegerExceptionOrder
+result EXEC_FAILED
+test org.apache.harmony.luni.tests.java.util.FormatterTest#test_formatLjava_lang_String$Ljava_lang_Object_FloatDoubleBigDecimalExceptionOrder
+result EXEC_FAILED
+
+
+# These format specifiers are documented to not take flags, but the RI accepts and ignores them.
+test org.apache.harmony.luni.tests.java.util.FormatterTest#test_formatLjava_lang_String$Ljava_lang_Object_LineSeparator
+pattern .*java.util.IllegalFormatFlagsException: %n doesn't take an argument.*
+result EXEC_FAILED
+test org.apache.harmony.luni.tests.java.util.FormatterTest#test_formatLjava_lang_String$Ljava_lang_Object_Percent
+pattern .*java.util.IllegalFormatFlagsException: %% doesn't take an argument.*
+result EXEC_FAILED
+test org.apache.harmony.luni.tests.java.util.FormatterTest#test_formatLjava_lang_String$Ljava_lang_Object_Width
+pattern .*java.util.IllegalFormatFlagsException: %% doesn't take an argument.*
+result EXEC_FAILED
diff --git a/expectations/knownfailures.txt b/expectations/knownfailures.txt
index d2ab18b..e8f004b 100644
--- a/expectations/knownfailures.txt
+++ b/expectations/knownfailures.txt
@@ -22,18 +22,6 @@
 result EXEC_FAILED
 
 # Fails in CTS but passes under run-core-tests
-test tests.api.java.lang.reflect.GenericTypesTest#testSimpleInheritance
-result EXEC_FAILED
-
-# Fails in CTS but passes under run-core-tests
-test tests.api.java.lang.reflect.GenericReflectionCornerCases#testMultipleBoundedWildcard
-result EXEC_FAILED
-
-# Fails in CTS but passes under run-core-tests
-test tests.api.java.lang.reflect.GenericReflectionCornerCases#testMultipleBoundedWildcardUnEquality
-result EXEC_FAILED
-
-# Fails in CTS but passes under run-core-tests
 test tests.api.java.net.MulticastSocketTest#test_joinGroupLjava_net_SocketAddressLjava_net_NetworkInterface
 result EXEC_FAILED
 
@@ -47,7 +35,7 @@
 result EXEC_FAILED
 
 # http://b/1952042 - issues with sockets forgetting their local and remote addresses
-test org.apache.harmony.nio.tests.java.nio.channels.ServerSocketChannelTest#test_accept_Security
+test java.nio.channels.OldServerSocketChannelTest#test_accept_Security
 result EXEC_FAILED
 
 # Fails in CTS but passes under run-core-tests
@@ -146,7 +134,7 @@
 test tests.java.sql.DatabaseMetaDataTest#test_getColumnsSpecific
 result EXEC_FAILED
 
-# Not supported ops applied: test fails on arguments: '', '', '%', '%' 
+# Not supported ops applied: test fails on arguments: '', '', '%', '%'
 test tests.java.sql.DatabaseMetaDataTest#test_getColumnsTableWithNoCatalogSchema
 result EXEC_FAILED
 
@@ -756,7 +744,7 @@
 result EXEC_FAILED
 
 # Spec is not precise enough: should be: number of rows affected. eg. to be consistent for deletes:
-# 'delete from s1;' should be different from 'delete from s1 where c1 = 1;' 
+# 'delete from s1;' should be different from 'delete from s1 where c1 = 1;'
 test tests.sql.StatementTest#testExecuteUpdate_String
 result EXEC_FAILED
 
@@ -780,7 +768,7 @@
 test tests.sql.StatementTest#testGetQueryTimeout
 result EXEC_FAILED
 
-# Does not return null on update count > 0 (not a select statement) 
+# Does not return null on update count > 0 (not a select statement)
 test tests.sql.StatementTest#testGetResultSet
 result EXEC_FAILED
 
diff --git a/luni/src/main/java/com/ibm/icu4jni/util/ICU.java b/luni/src/main/java/com/ibm/icu4jni/util/ICU.java
index 30e7001..0e42118 100644
--- a/luni/src/main/java/com/ibm/icu4jni/util/ICU.java
+++ b/luni/src/main/java/com/ibm/icu4jni/util/ICU.java
@@ -16,10 +16,7 @@
 
 package com.ibm.icu4jni.util;
 
-import java.util.HashMap;
 import java.util.Locale;
-import java.util.TimeZone;
-import java.util.logging.Logger;
 
 /**
  * Makes ICU data accessible to Java.
@@ -36,11 +33,6 @@
     private static String[] isoCountries;
 
     /**
-     * Available timezones cache.
-     */
-    private static String[] availableTimezones;
-
-    /**
      * Returns an array of ISO language names (two-letter codes), fetched either
      * from ICU's database or from our memory cache.
      *
@@ -67,158 +59,6 @@
     }
 
     /**
-     * Returns an array of names of timezones that are available in the system,
-     * fetched either from the TimeZone class or from our memory cache.
-     *
-     * @return The array.
-     */
-    public static String[] getKnownTimezones() {
-        if (availableTimezones == null) {
-            availableTimezones = TimeZone.getAvailableIDs();
-        }
-        return availableTimezones.clone();
-    }
-
-    /**
-     * Returns the display name for the given time zone using the given locale.
-     *
-     * @param id The time zone ID, for example "Europe/Berlin"
-     * @param daylight Indicates whether daylight savings is in use
-     * @param style The style, 0 for long, 1 for short
-     * @param locale The locale name, for example "en_US".
-     * @return The desired display name
-     */
-    public static String getDisplayTimeZone(String id, boolean daylight, int style, String locale) {
-        // If we already have the strings, linear search through them is 10x quicker than
-        // calling ICU for just the one we want.
-        if (DefaultTimeZones.locale.equals(locale)) {
-            String result = lookupDisplayTimeZone(DefaultTimeZones.names, id, daylight, style);
-            if (result != null) {
-                return result;
-            }
-        }
-        return getDisplayTimeZoneNative(id, daylight, style, locale);
-    }
-
-    public static String lookupDisplayTimeZone(String[][] zoneStrings, String id, boolean daylight, int style) {
-        for (String[] row : zoneStrings) {
-            if (row[0].equals(id)) {
-                if (daylight) {
-                    return (style == TimeZone.LONG) ? row[3] : row[4];
-                } else {
-                    return (style == TimeZone.LONG) ? row[1] : row[2];
-                }
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Initialization holder for default time zone names. This class will
-     * be preloaded by the zygote to share the time and space costs of setting
-     * up the list of time zone names, so although it looks like the lazy
-     * initialization idiom, it's actually the opposite.
-     */
-    private static class DefaultTimeZones {
-        /**
-         * Name of default locale at the time this class was initialized.
-         */
-        private static final String locale = Locale.getDefault().toString();
-
-        /**
-         * Names of time zones for the default locale.
-         */
-        private static final String[][] names = createTimeZoneNamesFor(locale);
-    }
-
-    /**
-     * Creates array of time zone names for the given locale. This method takes
-     * about 2s to run on a 400MHz ARM11.
-     */
-    private static String[][] createTimeZoneNamesFor(String locale) {
-        long start = System.currentTimeMillis();
-
-        /*
-         * The following code is optimized for fast native response (the time a
-         * method call can be in native code is limited). It prepares an empty
-         * array to keep native code from having to create new Java objects. It
-         * also fill in the time zone IDs to speed things up a bit. There's one
-         * array for each time zone name type. (standard/long, standard/short,
-         * daylight/long, daylight/short) The native method that fetches these
-         * strings is faster if it can do all entries of one type, before having
-         * to change to the next type. That's why the array passed down to
-         * native has 5 entries, each providing space for all time zone names of
-         * one type. Likely this access to the fields is much faster in the
-         * native code because there's less array access overhead.
-         */
-        String[][] arrayToFill = new String[5][];
-        arrayToFill[0] = getKnownTimezones();
-        arrayToFill[1] = new String[availableTimezones.length];
-        arrayToFill[2] = new String[availableTimezones.length];
-        arrayToFill[3] = new String[availableTimezones.length];
-        arrayToFill[4] = new String[availableTimezones.length];
-
-        // Don't be distracted by all the code either side of this line: this is the expensive bit!
-        getTimeZonesNative(arrayToFill, locale);
-
-        // Reorder the entries so we get the expected result.
-        // We also take the opportunity to de-duplicate the names (http://b/2672057).
-        HashMap<String, String> internTable = new HashMap<String, String>();
-        String[][] result = new String[availableTimezones.length][5];
-        for (int i = 0; i < availableTimezones.length; ++i) {
-            result[i][0] = arrayToFill[0][i];
-            for (int j = 1; j <= 4; ++j) {
-                String original = arrayToFill[j][i];
-                String nonDuplicate = internTable.get(original);
-                if (nonDuplicate == null) {
-                    internTable.put(original, original);
-                    nonDuplicate = original;
-                }
-                result[i][j] = nonDuplicate;
-            }
-        }
-
-        Logger.global.info("Loaded time zone names for " + locale + " in "
-                + (System.currentTimeMillis() - start) + "ms.");
-
-        return result;
-    }
-
-    /**
-     * Returns the display names for all given timezones using the given locale.
-     *
-     * @return An array of time zone strings. Each row represents one time zone.
-     *         The first columns holds the ID of the time zone, for example
-     *         "Europe/Berlin". The other columns then hold for each row the
-     *         four time zone names with and without daylight savings and in
-     *         long and short format. It's exactly the array layout required by
-     *         the TimeZone class.
-     */
-    public static String[][] getDisplayTimeZones(String locale) {
-        String defaultLocale = Locale.getDefault().toString();
-        if (locale == null) {
-            locale = defaultLocale;
-        }
-
-        // If locale == default and the default locale hasn't changed since
-        // DefaultTimeZones loaded, return the cached names.
-        // TODO: We should force a reboot if the default locale changes.
-        if (defaultLocale.equals(locale) && DefaultTimeZones.locale.equals(defaultLocale)) {
-            return clone2dStringArray(DefaultTimeZones.names);
-        }
-
-        return createTimeZoneNamesFor(locale);
-    }
-
-    public static String[][] clone2dStringArray(String[][] array) {
-        String[][] result = new String[array.length][];
-        for (int i = 0; i < array.length; ++i) {
-            result[i] = array[i].clone();
-        }
-        return result;
-    }
-
-    /**
      * Returns the appropriate {@code Locale} given a {@code String} of the form returned
      * by {@code toString}. This is very lenient, and doesn't care what's between the underscores:
      * this method can parse strings that {@code Locale.toString} won't produce.
@@ -306,10 +146,5 @@
     private static native String[] getISOLanguagesNative();
     private static native String[] getISOCountriesNative();
 
-    private static native void getTimeZonesNative(String[][] arrayToFill, String locale);
-
-    private static native String getDisplayTimeZoneNative(String id, boolean isDST, int style,
-            String locale);
-
     static native boolean initLocaleDataImpl(String locale, LocaleData result);
 }
diff --git a/luni/src/main/java/java/io/File.java b/luni/src/main/java/java/io/File.java
index 168d2ac..05220d2 100644
--- a/luni/src/main/java/java/io/File.java
+++ b/luni/src/main/java/java/io/File.java
@@ -32,6 +32,7 @@
 import java.net.URL;
 import java.nio.ByteBuffer;
 import java.nio.charset.Charset;
+import java.nio.charset.Charsets;
 import java.security.AccessController;
 import java.security.SecureRandom;
 import java.util.ArrayList;
@@ -65,8 +66,6 @@
 
     private static final long serialVersionUID = 301077366599181567L;
 
-    private static final Charset UTF_8 = Charset.forName("UTF-8");
-
     /**
      * The system dependent file separator character.
      * This field is initialized from the system property "file.separator".
@@ -205,11 +204,7 @@
     }
 
     private byte[] newCString(String s) {
-        ByteBuffer buffer = UTF_8.encode(s);
-        // Add a trailing NUL, because this byte[] is going to be used as a char*.
-        int byteCount = buffer.limit() + 1;
-        byte[] bytes = new byte[byteCount];
-        buffer.get(bytes, 0, byteCount - 1);
+        byte[] bytes = s.getBytes(Charsets.UTF_8);
         // This is an awful mistake, because '\' is a perfectly acceptable
         // character on Linux/Android. But we've shipped so many versions
         // that behaved like this, I'm too scared to change it.
@@ -218,7 +213,11 @@
                 bytes[i] = '/';
             }
         }
-        return bytes;
+        // Add a trailing NUL, because this byte[] is going to be used as a char*.
+        int byteCount = bytes.length + 1;
+        byte[] result = new byte[byteCount];
+        System.arraycopy(bytes, 0, result, 0, bytes.length);
+        return result;
     }
 
     // Removes duplicate adjacent slashes and any trailing slash.
@@ -464,7 +463,7 @@
      * @return the absolute file path.
      */
     public String getAbsolutePath() {
-        return new String(pathBytes, 0, pathBytes.length - 1, UTF_8);
+        return new String(pathBytes, 0, pathBytes.length - 1, Charsets.UTF_8);
     }
 
     /**
@@ -576,7 +575,7 @@
         newResult[newLength] = 0;
         newResult = getCanonImpl(newResult);
         newLength = newResult.length;
-        return new String(newResult, 0, newLength, UTF_8);
+        return new String(newResult, 0, newLength, Charsets.UTF_8);
     }
 
     /*
diff --git a/luni/src/main/java/java/io/InputStreamReader.java b/luni/src/main/java/java/io/InputStreamReader.java
index 9c98fdc..364db4c 100644
--- a/luni/src/main/java/java/io/InputStreamReader.java
+++ b/luni/src/main/java/java/io/InputStreamReader.java
@@ -21,6 +21,7 @@
 import java.nio.CharBuffer;
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetDecoder;
+import java.nio.charset.Charsets;
 import java.nio.charset.CoderResult;
 import java.nio.charset.CodingErrorAction;
 import java.nio.charset.MalformedInputException;
@@ -59,15 +60,7 @@
      *            the input stream from which to read characters.
      */
     public InputStreamReader(InputStream in) {
-        super(in);
-        this.in = in;
-        String encoding = AccessController
-                .doPrivileged(new PriviAction<String>(
-                        "file.encoding", "ISO8859_1"));
-        decoder = Charset.forName(encoding).newDecoder().onMalformedInput(
-                CodingErrorAction.REPLACE).onUnmappableCharacter(
-                CodingErrorAction.REPLACE);
-        bytes.limit(0);
+        this(in, Charset.defaultCharset());
     }
 
     /**
@@ -98,7 +91,7 @@
                     CodingErrorAction.REPLACE);
         } catch (IllegalArgumentException e) {
             throw (UnsupportedEncodingException)
-                    new UnsupportedEncodingException().initCause(e);
+                    new UnsupportedEncodingException(enc).initCause(e);
         }
         bytes.limit(0);
     }
@@ -228,18 +221,16 @@
             if (!isOpen()) {
                 throw new IOException("InputStreamReader is closed");
             }
-            // BEGIN android-changed
-            // Exception priorities (in case of multiple errors) differ from
-            // RI, but are spec-compliant.
-            // made implicit null check explicit, used (offset | length) < 0
-            // instead of (offset < 0) || (length < 0) to safe one operation
+            // RI exception compatibility so we can run more tests.
+            if (offset < 0) {
+                throw new IndexOutOfBoundsException();
+            }
             if (buffer == null) {
                 throw new NullPointerException("buffer == null");
             }
-            if ((offset | length) < 0 || offset > buffer.length - length) {
+            if (length < 0 || offset > buffer.length - length) {
                 throw new IndexOutOfBoundsException();
             }
-            // END android-changed
             if (length == 0) {
                 return 0;
             }
diff --git a/luni/src/main/java/java/io/OutputStreamWriter.java b/luni/src/main/java/java/io/OutputStreamWriter.java
index f096842..a8f7b23 100644
--- a/luni/src/main/java/java/io/OutputStreamWriter.java
+++ b/luni/src/main/java/java/io/OutputStreamWriter.java
@@ -21,6 +21,7 @@
 import java.nio.CharBuffer;
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetEncoder;
+import java.nio.charset.Charsets;
 import java.nio.charset.CoderResult;
 import java.nio.charset.CodingErrorAction;
 import java.security.AccessController;
@@ -54,14 +55,7 @@
      *            the non-null target stream to write converted bytes to.
      */
     public OutputStreamWriter(OutputStream out) {
-        super(out);
-        this.out = out;
-        String encoding = AccessController
-                .doPrivileged(new PriviAction<String>(
-                        "file.encoding", "ISO8859_1"));
-        encoder = Charset.forName(encoding).newEncoder();
-        encoder.onMalformedInput(CodingErrorAction.REPLACE);
-        encoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
+        this(out, Charset.defaultCharset());
     }
 
     /**
@@ -221,19 +215,15 @@
     public void write(char[] buffer, int offset, int count) throws IOException {
         synchronized (lock) {
             checkStatus();
-            // BEGIN android-changed
-            // Exception priorities (in case of multiple errors) differ from
-            // RI, but are spec-compliant.
-            // made implicit null check explicit,
-            // used (offset | count) < 0 instead of (offset < 0) || (count < 0)
-            // to safe one operation
+            if (offset < 0) {
+                throw new IndexOutOfBoundsException();
+            }
             if (buffer == null) {
                 throw new NullPointerException("buffer == null");
             }
-            if ((offset | count) < 0 || offset > buffer.length - count) {
+            if (count < 0 || offset > buffer.length - count) {
                 throw new IndexOutOfBoundsException();
             }
-            // END android-changed
             CharBuffer chars = CharBuffer.wrap(buffer, offset, count);
             convert(chars);
         }
@@ -297,19 +287,15 @@
     @Override
     public void write(String str, int offset, int count) throws IOException {
         synchronized (lock) {
-            // avoid int overflow
-            // BEGIN android-changed
-            // Exception priorities (in case of multiple errors) differ from RI,
-            // but are spec-compliant.
-            // made implicit null check explicit, used (offset | count) < 0
-            // instead of (offset < 0) || (count < 0) to safe one operation
+            if (count < 0) {
+                throw new StringIndexOutOfBoundsException();
+            }
             if (str == null) {
                 throw new NullPointerException("str == null");
             }
-            if ((offset | count) < 0 || offset > str.length() - count) {
+            if (offset < 0 || offset > str.length() - count) {
                 throw new StringIndexOutOfBoundsException();
             }
-            // END android-changed
             checkStatus();
             CharBuffer chars = CharBuffer.wrap(str, offset, count + offset);
             convert(chars);
diff --git a/luni/src/main/java/java/io/PrintStream.java b/luni/src/main/java/java/io/PrintStream.java
index 28abd98..bae7740 100644
--- a/luni/src/main/java/java/io/PrintStream.java
+++ b/luni/src/main/java/java/io/PrintStream.java
@@ -173,7 +173,7 @@
             throw new NullPointerException();
         }
         if (!Charset.isSupported(csn)) {
-            throw new UnsupportedEncodingException();
+            throw new UnsupportedEncodingException(csn);
         }
         encoding = csn;
     }
diff --git a/luni/src/main/java/java/lang/Math.java b/luni/src/main/java/java/lang/Math.java
index 33b8dba..1160b7f 100644
--- a/luni/src/main/java/java/lang/Math.java
+++ b/luni/src/main/java/java/lang/Math.java
@@ -230,7 +230,7 @@
      *            the denominator of the value whose atan has to be computed.
      * @return the arc tangent of {@code y/x}.
      */
-    public static native double atan2(double x, double y);
+    public static native double atan2(double y, double x);
 
     /**
      * Returns the closest double approximation of the cube root of the
diff --git a/luni/src/main/java/java/lang/ProcessBuilder.java b/luni/src/main/java/java/lang/ProcessBuilder.java
index 65e66c0..504b79c 100644
--- a/luni/src/main/java/java/lang/ProcessBuilder.java
+++ b/luni/src/main/java/java/lang/ProcessBuilder.java
@@ -19,6 +19,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
 
@@ -65,9 +66,9 @@
             throw new NullPointerException();
         }
         this.command = command;
-        // BEGIN android-changed
-        this.environment = System.getenv();
-        // END android-changed
+
+        // use a hashtable to prevent nulls from sneaking in
+        this.environment = new Hashtable<String, String>(System.getenv());
     }
 
     /**
diff --git a/luni/src/main/java/java/lang/Runtime.java b/luni/src/main/java/java/lang/Runtime.java
index c88b02a..7c7b2b3 100644
--- a/luni/src/main/java/java/lang/Runtime.java
+++ b/luni/src/main/java/java/lang/Runtime.java
@@ -32,6 +32,8 @@
 
 package java.lang;
 
+import dalvik.system.VMDebug;
+import dalvik.system.VMStack;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.IOException;
@@ -44,14 +46,11 @@
 import java.io.InputStreamReader;
 import java.io.UnsupportedEncodingException;
 import java.io.Writer;
-
+import java.nio.charset.Charsets;
 import java.util.StringTokenizer;
 import java.util.List;
 import java.util.ArrayList;
 
-import dalvik.system.VMDebug;
-import dalvik.system.VMStack;
-
 /**
  * Allows Java applications to interface with the environment in which they are
  * running. Applications can not create an instance of this class, but they can
@@ -499,7 +498,7 @@
 
     /**
      * Switches the output of debug information for instructions on or off.
-     * For the Android 1.0 reference implementation, this method does nothing.
+     * On Android, this method does nothing.
      *
      * @param enable
      *            {@code true} to switch tracing on, {@code false} to switch it
@@ -541,10 +540,8 @@
      */
     @Deprecated
     public InputStream getLocalizedInputStream(InputStream stream) {
-        if (System.getProperty("file.encoding", "UTF-8").equals("UTF-8")) {
-            return stream;
-        }
-        return new ReaderInputStream(stream);
+        String encoding = System.getProperty("file.encoding", "UTF-8");
+        return encoding.equals("UTF-8") ? stream : new ReaderInputStream(stream, encoding);
     }
 
     /**
@@ -560,10 +557,8 @@
      */
     @Deprecated
     public OutputStream getLocalizedOutputStream(OutputStream stream) {
-        if (System.getProperty("file.encoding", "UTF-8").equals("UTF-8")) {
-            return stream;
-        }
-        return new WriterOutputStream(stream );
+        String encoding = System.getProperty("file.encoding", "UTF-8");
+        return encoding.equals("UTF-8") ? stream : new WriterOutputStream(stream, encoding);
     }
 
     /**
@@ -727,11 +722,9 @@
 
     private int numBytes;
 
-    String encoding = System.getProperty("file.encoding", "UTF-8");
-
-    public ReaderInputStream(InputStream stream) {
+    public ReaderInputStream(InputStream stream, String encoding) {
         try {
-            reader = new InputStreamReader(stream, "UTF-8");
+            reader = new InputStreamReader(stream, Charsets.UTF_8);
             writer = new OutputStreamWriter(out, encoding);
         } catch (UnsupportedEncodingException e) {
             // Should never happen, since UTF-8 and platform encoding must be
@@ -783,17 +776,15 @@
 
     private int numBytes;
 
-    private String enc = System.getProperty("file.encoding", "UTF-8");
-
-    public WriterOutputStream(OutputStream stream) {
+    public WriterOutputStream(OutputStream stream, String encoding) {
         try {
             // sink
-            this.writer = new OutputStreamWriter(stream, enc);
+            this.writer = new OutputStreamWriter(stream, encoding);
 
             // transcriber
             out = new PipedOutputStream();
             pipe = new PipedInputStream(out);
-            this.reader = new InputStreamReader(pipe, "UTF-8");
+            this.reader = new InputStreamReader(pipe, Charsets.UTF_8);
 
         } catch (UnsupportedEncodingException e) {
             // Should never happen, since platform encoding must be supported.
diff --git a/luni/src/main/java/java/lang/String.java b/luni/src/main/java/java/lang/String.java
index 04a2fda..df8da94 100644
--- a/luni/src/main/java/java/lang/String.java
+++ b/luni/src/main/java/java/lang/String.java
@@ -236,7 +236,21 @@
      *             if the named charset is not supported.
      */
     public String(byte[] data, int start, int length, String charsetName) throws UnsupportedEncodingException {
-        this(data, start, length, Charset.forName(charsetName));
+        this(data, start, length, charsetForName(charsetName));
+    }
+
+    /**
+     * Calls Charset.forName but only throws UnsupportedEncodingException, which is all String
+     * claims to throw.
+     */
+    private static Charset charsetForName(String charsetName) throws UnsupportedEncodingException {
+        try {
+            return Charset.forName(charsetName);
+        } catch (Exception cause) {
+            UnsupportedEncodingException ex = new UnsupportedEncodingException(charsetName);
+            ex.initCause(cause);
+            throw ex;
+        }
     }
 
     /**
@@ -255,7 +269,7 @@
      *             if {@code charsetName} is not supported.
      */
     public String(byte[] data, String charsetName) throws UnsupportedEncodingException {
-        this(data, 0, data.length, Charset.forName(charsetName));
+        this(data, 0, data.length, charsetForName(charsetName));
     }
 
     /**
@@ -956,7 +970,7 @@
      * @throws UnsupportedEncodingException if the charset is not supported
      */
     public byte[] getBytes(String charsetName) throws UnsupportedEncodingException {
-        return getBytes(Charset.forName(charsetName));
+        return getBytes(charsetForName(charsetName));
     }
 
     /**
@@ -1528,7 +1542,6 @@
      * @return a new string with occurrences of oldChar replaced by newChar.
      */
     public String replace(char oldChar, char newChar) {
-        // BEGIN endroid-changed
         char[] buffer = value;
         int _offset = offset;
         int _count = count;
@@ -1552,7 +1565,6 @@
         }
 
         return copied ? new String(0, count, buffer) : this;
-        // END android-changed
     }
 
     /**
@@ -1570,30 +1582,47 @@
      */
     public String replace(CharSequence target, CharSequence replacement) {
         if (target == null) {
-            throw new NullPointerException("target should not be null");
+            throw new NullPointerException("target == null");
         }
         if (replacement == null) {
-            throw new NullPointerException("replacement should not be null");
+            throw new NullPointerException("replacement == null");
         }
-        String ts = target.toString();
-        int index = indexOf(ts, 0);
 
-        if (index == -1)
+        String targetString = target.toString();
+        int matchStart = indexOf(targetString, 0);
+        if (matchStart == -1) {
+            // If there's nothing to replace, return the original string untouched.
             return this;
+        }
 
-        String rs = replacement.toString();
-        StringBuilder buffer = new StringBuilder(count);
-        int tl = target.length();
-        int tail = 0;
+        String replacementString = replacement.toString();
+
+        // The empty target matches at the start and end and between each character.
+        int targetLength = targetString.length();
+        if (targetLength == 0) {
+            int resultLength = (count + 2) * replacementString.length();
+            StringBuilder result = new StringBuilder(resultLength);
+            result.append(replacementString);
+            for (int i = offset; i < count; ++i) {
+                result.append(value[i]);
+                result.append(replacementString);
+            }
+            return result.toString();
+        }
+
+        StringBuilder result = new StringBuilder(count);
+        int searchStart = 0;
         do {
-            buffer.append(value, offset + tail, index - tail);
-            buffer.append(rs);
-            tail = index + tl;
-        } while ((index = indexOf(ts, tail)) != -1);
-        //append trailing chars
-        buffer.append(value, offset + tail, count - tail);
-
-        return buffer.toString();
+            // Copy characters before the match...
+            result.append(value, offset + searchStart, matchStart - searchStart);
+            // Insert the replacement...
+            result.append(replacementString);
+            // And skip over the match...
+            searchStart = matchStart + targetLength;
+        } while ((matchStart = indexOf(targetString, searchStart)) != -1);
+        // Copy any trailing chars...
+        result.append(value, offset + searchStart, count - searchStart);
+        return result.toString();
     }
 
     /**
diff --git a/luni/src/main/java/java/net/IDN.java b/luni/src/main/java/java/net/IDN.java
index df9ea2a..1ee1ca6 100644
--- a/luni/src/main/java/java/net/IDN.java
+++ b/luni/src/main/java/java/net/IDN.java
@@ -16,7 +16,7 @@
 
 package java.net;
 
-import com.ibm.icu4jni.text.NativeIDN;
+import libcore.icu.NativeIDN;
 
 /**
  * Converts internationalized domain names between Unicode and the ASCII Compatible Encoding
diff --git a/luni/src/main/java/java/text/DateFormatSymbols.java b/luni/src/main/java/java/text/DateFormatSymbols.java
index 15858d7..cc810c1 100644
--- a/luni/src/main/java/java/text/DateFormatSymbols.java
+++ b/luni/src/main/java/java/text/DateFormatSymbols.java
@@ -25,6 +25,7 @@
 import java.io.Serializable;
 import java.util.Arrays;
 import java.util.Locale;
+import libcore.icu.TimeZones;
 
 /**
  * Encapsulates localized date-time formatting data, such as the names of the
@@ -81,7 +82,7 @@
      */
     synchronized String[][] internalZoneStrings() {
         if (zoneStrings == null) {
-            zoneStrings = ICU.getDisplayTimeZones(locale.toString());
+            zoneStrings = TimeZones.getZoneStrings(locale);
         }
         return zoneStrings;
     }
@@ -325,7 +326,7 @@
      * </ul>
      */
     public String[][] getZoneStrings() {
-        return ICU.clone2dStringArray(internalZoneStrings());
+        return TimeZones.clone2dStringArray(internalZoneStrings());
     }
 
     @Override
@@ -464,7 +465,7 @@
                 throw new IllegalArgumentException(Arrays.toString(row) + ".length < 5");
             }
         }
-        this.zoneStrings = ICU.clone2dStringArray(zoneStrings);
+        this.zoneStrings = TimeZones.clone2dStringArray(zoneStrings);
         this.customZoneStrings = true;
     }
 }
diff --git a/luni/src/main/java/java/text/Normalizer.java b/luni/src/main/java/java/text/Normalizer.java
index e5d231e..2e6647e 100644
--- a/luni/src/main/java/java/text/Normalizer.java
+++ b/luni/src/main/java/java/text/Normalizer.java
@@ -16,7 +16,7 @@
 
 package java.text;
 
-import com.ibm.icu4jni.text.NativeNormalizer;
+import libcore.icu.NativeNormalizer;
 
 /**
  * Provides normalization functions according to
diff --git a/luni/src/main/java/java/text/SimpleDateFormat.java b/luni/src/main/java/java/text/SimpleDateFormat.java
index 30f3afa..a46ec3c 100644
--- a/luni/src/main/java/java/text/SimpleDateFormat.java
+++ b/luni/src/main/java/java/text/SimpleDateFormat.java
@@ -18,7 +18,6 @@
 package java.text;
 
 import com.ibm.icu4jni.util.LocaleData;
-import com.ibm.icu4jni.util.ICU;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
@@ -30,6 +29,7 @@
 import java.util.SimpleTimeZone;
 import java.util.TimeZone;
 import java.util.Vector;
+import libcore.icu.TimeZones;
 
 /**
  * A concrete class for formatting and parsing dates in a locale-sensitive
@@ -744,7 +744,7 @@
             }
             // We can't call TimeZone.getDisplayName() because it would not use
             // the custom DateFormatSymbols of this SimpleDateFormat.
-            String custom = ICU.lookupDisplayTimeZone(formatData.zoneStrings, tz.getID(), daylight, style);
+            String custom = TimeZones.lookupDisplayName(formatData.zoneStrings, tz.getID(), daylight, style);
             if (custom != null) {
                 buffer.append(custom);
                 return;
diff --git a/luni/src/main/java/java/util/ArrayList.java b/luni/src/main/java/java/util/ArrayList.java
index 59331f2..19d2449 100644
--- a/luni/src/main/java/java/util/ArrayList.java
+++ b/luni/src/main/java/java/util/ArrayList.java
@@ -148,7 +148,7 @@
     @Override public void add(int index, E object) {
         Object[] a = array;
         int s = size;
-        if (index > s) {
+        if (index > s || index < 0) {
             throwIndexOutOfBoundsException(index, s);
         }
 
@@ -226,16 +226,16 @@
      */
     @Override
     public boolean addAll(int index, Collection<? extends E> collection) {
+        int s = size;
+        if (index > s || index < 0) {
+            throwIndexOutOfBoundsException(index, s);
+        }
         Object[] newPart = collection.toArray();
         int newPartSize = newPart.length;
         if (newPartSize == 0) {
             return false;
         }
         Object[] a = array;
-        int s = size;
-        if (index > s) {
-            throwIndexOutOfBoundsException(index, s);
-        }
         int newSize = s + newPartSize; // If add overflows, arraycopy will fail
         if (newSize <= a.length) {
              System.arraycopy(a, index, a, index + newPartSize, s - index);
@@ -441,6 +441,9 @@
     }
 
     @Override protected void removeRange(int fromIndex, int toIndex) {
+        if (fromIndex == toIndex) {
+            return;
+        }
         Object[] a = array;
         int s = size;
         if (fromIndex >= s) {
diff --git a/luni/src/main/java/java/util/DuplicateFormatFlagsException.java b/luni/src/main/java/java/util/DuplicateFormatFlagsException.java
index 7362e9b..d04db8e 100644
--- a/luni/src/main/java/java/util/DuplicateFormatFlagsException.java
+++ b/luni/src/main/java/java/util/DuplicateFormatFlagsException.java
@@ -26,7 +26,7 @@
 
     private static final long serialVersionUID = 18890531L;
 
-    private String flags;
+    private final String flags;
 
     /**
      * Constructs a new {@code DuplicateFormatFlagsException} with the flags
@@ -36,7 +36,7 @@
      *           the format flags that contain a duplicate flag.
      */
     public DuplicateFormatFlagsException(String f) {
-        if (null == f) {
+        if (f == null) {
             throw new NullPointerException();
         }
         flags = f;
@@ -51,18 +51,8 @@
         return flags;
     }
 
-    /**
-     * Returns the message string of the DuplicateFormatFlagsException.
-     *
-     * @return the message string of the DuplicateFormatFlagsException.
-     */
     @Override
     public String getMessage() {
-        StringBuilder buffer = new StringBuilder();
-        buffer.append("Flags of the DuplicateFormatFlagsException is'");
-        buffer.append(flags);
-        buffer.append("'");
-        return buffer.toString();
+        return flags;
     }
-
 }
diff --git a/luni/src/main/java/java/util/FormatFlagsConversionMismatchException.java b/luni/src/main/java/java/util/FormatFlagsConversionMismatchException.java
index 1ab0720..73d8a64 100644
--- a/luni/src/main/java/java/util/FormatFlagsConversionMismatchException.java
+++ b/luni/src/main/java/java/util/FormatFlagsConversionMismatchException.java
@@ -29,9 +29,9 @@
 
     private static final long serialVersionUID = 19120414L;
 
-    private String f;
+    private final String f;
 
-    private char c;
+    private final char c;
 
     /**
      * Constructs a new {@code FormatFlagsConversionMismatchException} with the
@@ -68,18 +68,8 @@
         return c;
     }
 
-    /**
-     * Returns the message string of the {@code FormatFlagsConversionMismatchException}.
-     *
-     * @return the message string of the {@code FormatFlagsConversionMismatchException}.
-     */
     @Override
     public String getMessage() {
-        StringBuilder buffer = new StringBuilder();
-        buffer.append("Mismatched Convertor =");
-        buffer.append(c);
-        buffer.append(", Flags= ");
-        buffer.append(f);
-        return buffer.toString();
+        return "%" + c + " does not support '" + f + "'";
     }
 }
diff --git a/luni/src/main/java/java/util/Formatter.java b/luni/src/main/java/java/util/Formatter.java
index 7000581..9a0951e 100644
--- a/luni/src/main/java/java/util/Formatter.java
+++ b/luni/src/main/java/java/util/Formatter.java
@@ -1223,6 +1223,8 @@
                 return false;
             }
             if (dupe) {
+                // The RI documentation implies we're supposed to report all the flags, not just
+                // the first duplicate, but the RI behaves the same as we do.
                 throw new DuplicateFormatFlagsException(String.valueOf(ch));
             }
             if (strFlags == null) {
@@ -1361,7 +1363,8 @@
             // Check that no-argument conversion types don't have an argument.
             // Note: the RI doesn't enforce this.
             if (!allowArgument && argIndex != UNSET) {
-                throw new IllegalFormatFlagsException(getStrFlags());
+                throw new IllegalFormatFlagsException("%" + conversionType +
+                        " doesn't take an argument");
             }
 
             // Check that we don't have a precision or width where they're not allowed.
diff --git a/luni/src/main/java/java/util/IllegalFormatCodePointException.java b/luni/src/main/java/java/util/IllegalFormatCodePointException.java
index 9679b81..ddded88 100644
--- a/luni/src/main/java/java/util/IllegalFormatCodePointException.java
+++ b/luni/src/main/java/java/util/IllegalFormatCodePointException.java
@@ -29,7 +29,7 @@
         implements Serializable {
     private static final long serialVersionUID = 19080630L;
 
-    private int c;
+    private final int c;
 
     /**
      * Constructs a new {@code IllegalFormatCodePointException} which is
@@ -51,19 +51,8 @@
         return c;
     }
 
-    /**
-     * Returns the message string of the IllegalFormatCodePointException.
-     *
-     * @return the message string of the IllegalFormatCodePointException.
-     */
     @Override
     public String getMessage() {
-        StringBuilder buffer = new StringBuilder();
-        buffer.append("Code point is ");
-        char[] chars = Character.toChars(c);
-        for (int i = 0; i < chars.length; i++) {
-            buffer.append(chars[i]);
-        }
-        return buffer.toString();
+        return Integer.toHexString(c);
     }
 }
diff --git a/luni/src/main/java/java/util/IllegalFormatConversionException.java b/luni/src/main/java/java/util/IllegalFormatConversionException.java
index 5270f6b..31c0eed 100644
--- a/luni/src/main/java/java/util/IllegalFormatConversionException.java
+++ b/luni/src/main/java/java/util/IllegalFormatConversionException.java
@@ -30,9 +30,9 @@
         implements Serializable {
     private static final long serialVersionUID = 17000126L;
 
-    private char c;
+    private final char c;
 
-    private Class<?> arg;
+    private final Class<?> arg;
 
     /**
      * Constructs a new {@code IllegalFormatConversionException} with the class
@@ -69,18 +69,8 @@
         return c;
     }
 
-    /**
-     * Returns the message string of the IllegalFormatConversionException.
-     *
-     * @return the message string of the IllegalFormatConversionException.
-     */
     @Override
     public String getMessage() {
-        StringBuilder buffer = new StringBuilder();
-        buffer.append(c);
-        buffer.append(" is incompatible with ");
-        buffer.append(arg.getName());
-        return buffer.toString();
+        return "%" + c + " can't format " + arg.getName() + " arguments";
     }
-
 }
diff --git a/luni/src/main/java/java/util/IllegalFormatFlagsException.java b/luni/src/main/java/java/util/IllegalFormatFlagsException.java
index a1fbfcf..6947912 100644
--- a/luni/src/main/java/java/util/IllegalFormatFlagsException.java
+++ b/luni/src/main/java/java/util/IllegalFormatFlagsException.java
@@ -24,24 +24,23 @@
  *
  * @see java.lang.RuntimeException
  */
-public class IllegalFormatFlagsException extends IllegalFormatException
-        implements Serializable {
+public class IllegalFormatFlagsException extends IllegalFormatException implements Serializable {
     private static final long serialVersionUID = 790824L;
 
-    private String flags;
+    private final String flags;
 
     /**
      * Constructs a new {@code IllegalFormatFlagsException} with the specified
      * flags.
      *
-     * @param f
+     * @param flags
      *           the specified flags.
      */
-    public IllegalFormatFlagsException(String f) {
-        if (null == f) {
+    public IllegalFormatFlagsException(String flags) {
+        if (flags == null) {
             throw new NullPointerException();
         }
-        flags = f;
+        this.flags = flags;
     }
 
     /**
@@ -53,18 +52,8 @@
         return flags;
     }
 
-    /**
-     * Returns the message string of the IllegalFormatFlagsException.
-     *
-     * @return the message string of the IllegalFormatFlagsException.
-     */
     @Override
     public String getMessage() {
-        StringBuilder buffer = new StringBuilder();
-        buffer.append("Flags = '");
-        buffer.append(flags);
-        buffer.append("'");
-        return buffer.toString();
+        return flags;
     }
-
 }
diff --git a/luni/src/main/java/java/util/IllegalFormatPrecisionException.java b/luni/src/main/java/java/util/IllegalFormatPrecisionException.java
index 5e78569..d7be65d 100644
--- a/luni/src/main/java/java/util/IllegalFormatPrecisionException.java
+++ b/luni/src/main/java/java/util/IllegalFormatPrecisionException.java
@@ -26,7 +26,7 @@
 public class IllegalFormatPrecisionException extends IllegalFormatException {
     private static final long serialVersionUID = 18711008L;
 
-    private int p;
+    private final int p;
 
     /**
      * Constructs a new {@code IllegalFormatPrecisionException} with specified
@@ -48,14 +48,8 @@
         return p;
     }
 
-    /**
-     * Returns the message of the exception.
-     *
-     * @return the message of the exception.
-     */
     @Override
     public String getMessage() {
-        return String.valueOf(p);
+        return Integer.toString(p);
     }
-
 }
diff --git a/luni/src/main/java/java/util/IllegalFormatWidthException.java b/luni/src/main/java/java/util/IllegalFormatWidthException.java
index 25a2ecc..b864358 100644
--- a/luni/src/main/java/java/util/IllegalFormatWidthException.java
+++ b/luni/src/main/java/java/util/IllegalFormatWidthException.java
@@ -27,7 +27,7 @@
 
     private static final long serialVersionUID = 16660902L;
 
-    private int w;
+    private final int w;
 
     /**
      * Constructs a new {@code IllegalFormatWidthException} with specified
@@ -49,13 +49,8 @@
         return w;
     }
 
-    /**
-     * Returns the message of the exception.
-     *
-     * @return the message of the exception.
-     */
     @Override
     public String getMessage() {
-        return String.valueOf(w);
+        return Integer.toString(w);
     }
 }
diff --git a/luni/src/main/java/java/util/MissingFormatArgumentException.java b/luni/src/main/java/java/util/MissingFormatArgumentException.java
index 4ee5b22..cd56f87 100644
--- a/luni/src/main/java/java/util/MissingFormatArgumentException.java
+++ b/luni/src/main/java/java/util/MissingFormatArgumentException.java
@@ -26,7 +26,7 @@
 public class MissingFormatArgumentException extends IllegalFormatException {
     private static final long serialVersionUID = 19190115L;
 
-    private String s;
+    private final String s;
 
     /**
      * Constructs a new {@code MissingFormatArgumentException} with the
@@ -51,11 +51,6 @@
         return s;
     }
 
-    /**
-     * Returns the message of the exception.
-     *
-     * @return the message of the exception.
-     */
     @Override
     public String getMessage() {
         return "Format specifier: " + s;
diff --git a/luni/src/main/java/java/util/MissingFormatWidthException.java b/luni/src/main/java/java/util/MissingFormatWidthException.java
index 6b26754..842b0c4 100644
--- a/luni/src/main/java/java/util/MissingFormatWidthException.java
+++ b/luni/src/main/java/java/util/MissingFormatWidthException.java
@@ -25,7 +25,7 @@
 public class MissingFormatWidthException extends IllegalFormatException {
     private static final long serialVersionUID = 15560123L;
 
-    private String s;
+    private final String s;
 
     /**
      * Constructs a new {@code MissingFormatWidthException} with the specified
@@ -50,14 +50,8 @@
         return s;
     }
 
-    /**
-     * Returns the message of the exception.
-     *
-     * @return the message of the exception.
-     */
     @Override
     public String getMessage() {
         return s;
     }
-
 }
diff --git a/luni/src/main/java/java/util/Properties.java b/luni/src/main/java/java/util/Properties.java
index f9801dc..34a8faa 100644
--- a/luni/src/main/java/java/util/Properties.java
+++ b/luni/src/main/java/java/util/Properties.java
@@ -255,7 +255,7 @@
 
     /**
      * Loads properties from the specified {@code InputStream}. The encoding is
-     * ISO8859-1.
+     * ISO-8859-1.
      * @param in the {@code InputStream}
      * @throws IOException
      */
@@ -263,7 +263,7 @@
         if (in == null) {
             throw new NullPointerException();
         }
-        load(new InputStreamReader(in, "ISO8859_1"));
+        load(new InputStreamReader(in, "ISO-8859-1"));
     }
 
     /**
@@ -538,7 +538,7 @@
     /**
      * Stores the mappings in this {@code Properties} object to {@code out},
      * putting the specified comment at the beginning. The encoding is
-     * ISO8859-1.
+     * ISO-8859-1.
      *
      * @param out the {@code OutputStream}
      * @param comment an optional comment to be written, or null
@@ -546,7 +546,7 @@
      * @throws ClassCastException if a key or value is not a string
      */
     public synchronized void store(OutputStream out, String comment) throws IOException {
-        store(new OutputStreamWriter(out, "ISO8859_1"), comment);
+        store(new OutputStreamWriter(out, "ISO-8859-1"), comment);
     }
 
     private static String lineSeparator;
diff --git a/luni/src/main/java/java/util/TimeZone.java b/luni/src/main/java/java/util/TimeZone.java
index 540681e..e2dbccb 100644
--- a/luni/src/main/java/java/util/TimeZone.java
+++ b/luni/src/main/java/java/util/TimeZone.java
@@ -17,8 +17,8 @@
 
 package java.util;
 
-import com.ibm.icu4jni.util.ICU;
 import java.io.Serializable;
+import libcore.icu.TimeZones;
 import org.apache.harmony.luni.internal.util.ZoneInfo;
 import org.apache.harmony.luni.internal.util.ZoneInfoDB;
 
@@ -181,8 +181,7 @@
 
         boolean useDaylight = daylightTime && useDaylightTime();
 
-        String result = ICU.getDisplayTimeZone(getID(), daylightTime, style,
-                locale.toString());
+        String result = TimeZones.getDisplayName(getID(), daylightTime, style, locale);
         if (result != null) {
             return result;
         }
diff --git a/luni/src/main/java/java/util/UnknownFormatConversionException.java b/luni/src/main/java/java/util/UnknownFormatConversionException.java
index fc39e21..e26de91 100644
--- a/luni/src/main/java/java/util/UnknownFormatConversionException.java
+++ b/luni/src/main/java/java/util/UnknownFormatConversionException.java
@@ -24,7 +24,7 @@
 public class UnknownFormatConversionException extends IllegalFormatException {
     private static final long serialVersionUID = 19060418L;
 
-    private String s;
+    private final String s;
 
     /**
      * Constructs an {@code UnknownFormatConversionException} with the unknown
@@ -49,11 +49,6 @@
         return s;
     }
 
-    /**
-     * Returns the message of the exception.
-     *
-     * @return the message of the exception.
-     */
     @Override
     public String getMessage() {
         return "Conversion: " + s;
diff --git a/luni/src/main/java/java/util/UnknownFormatFlagsException.java b/luni/src/main/java/java/util/UnknownFormatFlagsException.java
index 066a3f0..9daa3f1 100644
--- a/luni/src/main/java/java/util/UnknownFormatFlagsException.java
+++ b/luni/src/main/java/java/util/UnknownFormatFlagsException.java
@@ -26,7 +26,7 @@
 
     private static final long serialVersionUID = 19370506L;
 
-    private String flags;
+    private final String flags;
 
     /**
      * Constructs a new {@code UnknownFormatFlagsException} with the specified
@@ -51,11 +51,6 @@
         return flags;
     }
 
-    /**
-     * Returns the message associated with the exception.
-     *
-     * @return the message associated with the exception.
-     */
     @Override
     public String getMessage() {
         return "Flags: " + flags;
diff --git a/luni/src/main/java/java/util/prefs/AbstractPreferences.java b/luni/src/main/java/java/util/prefs/AbstractPreferences.java
index bc6dce1..5da63c4 100644
--- a/luni/src/main/java/java/util/prefs/AbstractPreferences.java
+++ b/luni/src/main/java/java/util/prefs/AbstractPreferences.java
@@ -670,11 +670,7 @@
 
     @Override
     public void putByteArray(String key, byte[] value) {
-        try {
-            put(key, Base64.encode(value, "US-ASCII"));
-        } catch (UnsupportedEncodingException e) {
-            throw new AssertionError(e);
-        }
+        put(key, Base64.encode(value, Charsets.US_ASCII));
     }
 
     @Override
diff --git a/luni/src/main/java/java/util/regex/Pattern.java b/luni/src/main/java/java/util/regex/Pattern.java
index 7733b72..9352c5e 100644
--- a/luni/src/main/java/java/util/regex/Pattern.java
+++ b/luni/src/main/java/java/util/regex/Pattern.java
@@ -61,8 +61,9 @@
  * <tr> <td> \Q </td> <td>Quote all following metacharacters until {@code \E}.</td> </tr>
  * <tr> <td> \E </td> <td>Stop quoting metacharacters (started by {@code \Q}).</td> </tr>
  * <tr> <td> \\ </td> <td>A literal backslash.</td> </tr>
- * <tr> <td> &#x005c;<i>hhhh</i> </td> <td>The Unicode character U+hhhh (in hex).</td> </tr>
- * <tr> <td> \c<i>x</i> </td> <td>The ASCII control character <i>x</i> (so {@code \cI} would be U+0009).</td> </tr>
+ * <tr> <td> &#x005c;u<i>hhhh</i> </td> <td>The Unicode character U+hhhh (in hex).</td> </tr>
+ * <tr> <td> &#x005c;x<i>hh</i> </td> <td>The Unicode character U+00hh (in hex).</td> </tr>
+ * <tr> <td> \c<i>x</i> </td> <td>The ASCII control character ^x (so {@code \cH} would be ^H, U+0008).</td> </tr>
  *
  * <tr> <td> \a </td> <td>The ASCII bell character (U+0007).</td> </tr>
  * <tr> <td> \e </td> <td>The ASCII ESC character (U+001b).</td> </tr>
diff --git a/luni/src/main/java/com/ibm/icu4jni/text/NativeIDN.java b/luni/src/main/java/libcore/icu/NativeIDN.java
similarity index 96%
rename from luni/src/main/java/com/ibm/icu4jni/text/NativeIDN.java
rename to luni/src/main/java/libcore/icu/NativeIDN.java
index b973131..9bf5cb1 100644
--- a/luni/src/main/java/com/ibm/icu4jni/text/NativeIDN.java
+++ b/luni/src/main/java/libcore/icu/NativeIDN.java
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.ibm.icu4jni.text;
+package libcore.icu;
 
-public class NativeIDN {
+public final class NativeIDN {
     public static String toASCII(String s, int flags) {
         return convert(s, flags, true);
     }
diff --git a/luni/src/main/java/com/ibm/icu4jni/text/NativeNormalizer.java b/luni/src/main/java/libcore/icu/NativeNormalizer.java
similarity index 97%
rename from luni/src/main/java/com/ibm/icu4jni/text/NativeNormalizer.java
rename to luni/src/main/java/libcore/icu/NativeNormalizer.java
index 1ece170..a5d8da2 100644
--- a/luni/src/main/java/com/ibm/icu4jni/text/NativeNormalizer.java
+++ b/luni/src/main/java/libcore/icu/NativeNormalizer.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.icu4jni.text;
+package libcore.icu;
 
 import java.text.Normalizer.Form;
 
diff --git a/luni/src/main/java/com/ibm/icu4jni/text/NativePluralRules.java b/luni/src/main/java/libcore/icu/NativePluralRules.java
similarity index 98%
rename from luni/src/main/java/com/ibm/icu4jni/text/NativePluralRules.java
rename to luni/src/main/java/libcore/icu/NativePluralRules.java
index 97770d8..5547038 100644
--- a/luni/src/main/java/com/ibm/icu4jni/text/NativePluralRules.java
+++ b/luni/src/main/java/libcore/icu/NativePluralRules.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.icu4jni.text;
+package libcore.icu;
 
 import java.util.Locale;
 
diff --git a/luni/src/main/java/libcore/icu/TimeZones.java b/luni/src/main/java/libcore/icu/TimeZones.java
new file mode 100644
index 0000000..1b5de15
--- /dev/null
+++ b/luni/src/main/java/libcore/icu/TimeZones.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package libcore.icu;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.TimeZone;
+import java.util.logging.Logger;
+
+/**
+ * Provides access to ICU's time zone data.
+ */
+public final class TimeZones {
+    private static final String[] availableTimeZones = TimeZone.getAvailableIDs();
+
+    private TimeZones() {}
+
+    /**
+     * Implements TimeZone.getDisplayName by asking ICU.
+     */
+    public static String getDisplayName(String id, boolean daylight, int style, Locale locale) {
+        // If we already have the strings, linear search through them is 10x quicker than
+        // calling ICU for just the one we want.
+        if (CachedTimeZones.locale.equals(locale)) {
+            String result = lookupDisplayName(CachedTimeZones.names, id, daylight, style);
+            if (result != null) {
+                return result;
+            }
+        }
+        return getDisplayNameImpl(id, daylight, style, locale.toString());
+    }
+
+    public static String lookupDisplayName(String[][] zoneStrings, String id, boolean daylight, int style) {
+        for (String[] row : zoneStrings) {
+            if (row[0].equals(id)) {
+                if (daylight) {
+                    return (style == TimeZone.LONG) ? row[3] : row[4];
+                } else {
+                    return (style == TimeZone.LONG) ? row[1] : row[2];
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Initialization holder for default time zone names. This class will
+     * be preloaded by the zygote to share the time and space costs of setting
+     * up the list of time zone names, so although it looks like the lazy
+     * initialization idiom, it's actually the opposite.
+     */
+    private static class CachedTimeZones {
+        /**
+         * Name of default locale at the time this class was initialized.
+         */
+        private static final Locale locale = Locale.getDefault();
+
+        /**
+         * Names of time zones for the default locale.
+         */
+        private static final String[][] names = createZoneStringsFor(locale);
+    }
+
+    /**
+     * Creates array of time zone names for the given locale.
+     * This method takes about 2s to run on a 400MHz ARM11.
+     */
+    private static String[][] createZoneStringsFor(Locale locale) {
+        long start = System.currentTimeMillis();
+
+        /*
+         * The following code is optimized for fast native response (the time a
+         * method call can be in native code is limited). It prepares an empty
+         * array to keep native code from having to create new Java objects. It
+         * also fill in the time zone IDs to speed things up a bit. There's one
+         * array for each time zone name type. (standard/long, standard/short,
+         * daylight/long, daylight/short) The native method that fetches these
+         * strings is faster if it can do all entries of one type, before having
+         * to change to the next type. That's why the array passed down to
+         * native has 5 entries, each providing space for all time zone names of
+         * one type. Likely this access to the fields is much faster in the
+         * native code because there's less array access overhead.
+         */
+        String[][] arrayToFill = new String[5][];
+        arrayToFill[0] = availableTimeZones.clone();
+        arrayToFill[1] = new String[availableTimeZones.length];
+        arrayToFill[2] = new String[availableTimeZones.length];
+        arrayToFill[3] = new String[availableTimeZones.length];
+        arrayToFill[4] = new String[availableTimeZones.length];
+
+        // Don't be distracted by all the code either side of this line: this is the expensive bit!
+        getZoneStringsImpl(arrayToFill, locale.toString());
+
+        // Reorder the entries so we get the expected result.
+        // We also take the opportunity to de-duplicate the names (http://b/2672057).
+        HashMap<String, String> internTable = new HashMap<String, String>();
+        String[][] result = new String[availableTimeZones.length][5];
+        for (int i = 0; i < availableTimeZones.length; ++i) {
+            result[i][0] = arrayToFill[0][i];
+            for (int j = 1; j <= 4; ++j) {
+                String original = arrayToFill[j][i];
+                String nonDuplicate = internTable.get(original);
+                if (nonDuplicate == null) {
+                    internTable.put(original, original);
+                    nonDuplicate = original;
+                }
+                result[i][j] = nonDuplicate;
+            }
+        }
+
+        long duration = System.currentTimeMillis() - start;
+        Logger.global.info("Loaded time zone names for " + locale + " in " + duration + "ms.");
+
+        return result;
+    }
+
+    /**
+     * Returns an array of time zone strings, as used by DateFormatSymbols.getZoneStrings.
+     */
+    public static String[][] getZoneStrings(Locale locale) {
+        if (locale == null) {
+            locale = Locale.getDefault();
+        }
+
+        // TODO: We should force a reboot if the default locale changes.
+        if (CachedTimeZones.locale.equals(locale)) {
+            return clone2dStringArray(CachedTimeZones.names);
+        }
+
+        return createZoneStringsFor(locale);
+    }
+
+    public static String[][] clone2dStringArray(String[][] array) {
+        String[][] result = new String[array.length][];
+        for (int i = 0; i < array.length; ++i) {
+            result[i] = array[i].clone();
+        }
+        return result;
+    }
+
+    /**
+     * Returns an array containing the time zone ids in use in the country corresponding to
+     * the given locale. This is not necessary for Java API, but is used by telephony as a
+     * fallback.
+     */
+    public static String[] forLocale(Locale locale) {
+        return forCountryCode(locale.getCountry());
+    }
+
+    private static native String[] forCountryCode(String countryCode);
+    private static native void getZoneStringsImpl(String[][] arrayToFill, String locale);
+    private static native String getDisplayNameImpl(String id, boolean isDST, int style, String locale);
+}
diff --git a/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java b/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java
index ca527a5..ea855e6 100644
--- a/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java
+++ b/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java
@@ -1784,7 +1784,7 @@
         // base64 encode the username and password
         String usernameAndPassword = pa.getUserName() + ":" + new String(pa.getPassword());
         byte[] bytes = usernameAndPassword.getBytes(Charsets.ISO_8859_1);
-        String encoded = Base64.encode(bytes, "ISO8859_1");
+        String encoded = Base64.encode(bytes, Charsets.ISO_8859_1);
         return scheme + " " + encoded;
     }
 
diff --git a/luni/src/main/java/org/apache/harmony/luni/util/Base64.java b/luni/src/main/java/org/apache/harmony/luni/util/Base64.java
index e172a61..f688839 100644
--- a/luni/src/main/java/org/apache/harmony/luni/util/Base64.java
+++ b/luni/src/main/java/org/apache/harmony/luni/util/Base64.java
@@ -22,12 +22,15 @@
 package org.apache.harmony.luni.util;
 
 import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
 
 /**
  * This class implements Base64 encoding/decoding functionality
  * as specified in RFC 2045 (http://www.ietf.org/rfc/rfc2045.txt).
  */
 public class Base64 {
+    private Base64() {
+    }
 
     public static byte[] decode(byte[] in) {
         return decode(in, in.length);
@@ -36,7 +39,7 @@
     public static byte[] decode(byte[] in, int len) {
         // approximate output length
         int length = len / 4 * 3;
-        // return an empty array on emtpy or short input without padding
+        // return an empty array on empty or short input without padding
         if (length == 0) {
             return new byte[0];
         }
@@ -129,7 +132,7 @@
          'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3',
          '4', '5', '6', '7', '8', '9', '+', '/'};
 
-    public static String encode(byte[] in, String charsetName) throws UnsupportedEncodingException {
+    public static String encode(byte[] in, Charset charset) {
         int length = in.length * 4 / 3;
         length += length / 76 + 3; // for crlr
         byte[] out = new byte[length];
@@ -163,7 +166,6 @@
                 out[index++] = '=';
                 break;
         }
-        return new String(out, 0, index, charsetName);
+        return new String(out, 0, index, charset);
     }
 }
-
diff --git a/luni/src/main/java/org/apache/harmony/xml/ExpatParser.java b/luni/src/main/java/org/apache/harmony/xml/ExpatParser.java
index 0bac7db..3e099e6 100644
--- a/luni/src/main/java/org/apache/harmony/xml/ExpatParser.java
+++ b/luni/src/main/java/org/apache/harmony/xml/ExpatParser.java
@@ -307,7 +307,7 @@
         }
 
         String encoding = pickEncoding(inputSource);
-        int pointer = createEntityParser(this.pointer, context, encoding);
+        int pointer = createEntityParser(this.pointer, context);
         try {
             EntityParser entityParser = new EntityParser(encoding, xmlReader,
                     pointer, inputSource.getPublicId(),
@@ -397,11 +397,9 @@
      *
      * @param parentPointer pointer to parent Expat parser
      * @param context passed to {@link #handleExternalEntity}
-     * @param encoding
      * @return pointer to native parser
      */
-    private static native int createEntityParser(int parentPointer,
-            String context, String encoding);
+    private static native int createEntityParser(int parentPointer, String context);
 
     /**
      * Appends part of an XML document. This parser will parse the given XML to
diff --git a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/IndexedPKIXParameters.java b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/IndexedPKIXParameters.java
new file mode 100644
index 0000000..1cc80ba
--- /dev/null
+++ b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/IndexedPKIXParameters.java
@@ -0,0 +1,159 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.xnet.provider.jsse;
+
+import javax.security.auth.x500.X500Principal;
+
+import java.security.cert.CertPath;
+import java.security.cert.CertPathValidatorException;
+import java.security.cert.CertificateEncodingException;
+import java.security.cert.PKIXParameters;
+import java.security.cert.TrustAnchor;
+import java.security.cert.X509Certificate;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.KeyStoreException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Logger;
+import java.util.logging.Level;
+
+/**
+ * Indexes trust anchors so they can be found in O(1) time instead of O(N).
+ */
+public class IndexedPKIXParameters extends PKIXParameters {
+
+    final Map<Bytes, TrustAnchor> encodings
+            = new HashMap<Bytes, TrustAnchor>();
+    final Map<X500Principal, TrustAnchor> bySubject
+            = new HashMap<X500Principal, TrustAnchor>();
+    final Map<X500Principal, List<TrustAnchor>> byCA
+            = new HashMap<X500Principal, List<TrustAnchor>>();
+
+    public IndexedPKIXParameters(Set<TrustAnchor> anchors)
+            throws KeyStoreException, InvalidAlgorithmParameterException,
+            CertificateEncodingException {
+        super(anchors);
+
+        for (TrustAnchor anchor : anchors) {
+            X509Certificate cert = anchor.getTrustedCert();
+
+            Bytes encoded = new Bytes(cert.getEncoded());
+            encodings.put(encoded, anchor);
+
+            X500Principal subject = cert.getSubjectX500Principal();
+            if (bySubject.put(subject, anchor) != null) {
+                // TODO: Should we allow this?
+                throw new KeyStoreException("Two certs have the same subject: "
+                        + subject);
+            }
+
+            X500Principal ca = anchor.getCA();
+            List<TrustAnchor> caAnchors = byCA.get(ca);
+            if (caAnchors == null) {
+                caAnchors = new ArrayList<TrustAnchor>();
+                byCA.put(ca, caAnchors);
+            }
+            caAnchors.add(anchor);
+        }
+    }
+
+    public TrustAnchor findTrustAnchor(X509Certificate cert)
+            throws CertPathValidatorException {
+        // Mimic the alg in CertPathValidatorUtilities.findTrustAnchor().
+        Exception verificationException = null;
+        X500Principal issuer = cert.getIssuerX500Principal();
+
+        List<TrustAnchor> anchors = byCA.get(issuer);
+        if (anchors != null) {
+            for (TrustAnchor caAnchor : anchors) {
+                try {
+                    cert.verify(caAnchor.getCAPublicKey());
+                    return caAnchor;
+                } catch (Exception e) {
+                    verificationException = e;
+                }
+            }
+        }
+
+        TrustAnchor anchor = bySubject.get(issuer);
+        if (anchor != null) {
+            try {
+                cert.verify(anchor.getTrustedCert().getPublicKey());
+                return anchor;
+            } catch (Exception e) {
+                verificationException = e;
+            }
+        }
+
+        try {
+            Bytes encoded = new Bytes(cert.getEncoded());
+            anchor = encodings.get(encoded);
+            if (anchor != null) {
+                return anchor;
+            }
+        } catch (Exception e) {
+            Logger.getLogger(IndexedPKIXParameters.class.getName()).log(
+                    Level.WARNING, "Error encoding cert.", e);
+        }
+
+        // Throw last verification exception.
+        if (verificationException != null) {
+            throw new CertPathValidatorException("TrustAnchor found but"
+                    + " certificate verification failed.",
+                    verificationException);
+        }
+
+        return null;
+    }
+
+    /**
+     * Returns true if the given certificate is found in the trusted key
+     * store.
+     */
+    public boolean isDirectlyTrusted(X509Certificate cert) {
+        try {
+            Bytes encoded = new Bytes(cert.getEncoded());
+            return encodings.containsKey(encoded);
+        } catch (Exception e) {
+            Logger.getLogger(IndexedPKIXParameters.class.getName()).log(
+                    Level.WARNING, "Error encoding cert.", e);
+            return false;
+        }
+    }
+
+    /**
+     * Wraps a byte[] and adds equals() and hashCode() support.
+     */
+    static class Bytes {
+        final byte[] bytes;
+        final int hash;
+        Bytes(byte[] bytes) {
+            this.bytes = bytes;
+            this.hash = Arrays.hashCode(bytes);
+        }
+        @Override public int hashCode() {
+            return hash;
+        }
+        @Override public boolean equals(Object o) {
+            return Arrays.equals(bytes, ((Bytes) o).bytes);
+        }
+    }
+}
diff --git a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/TrustManagerImpl.java b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/TrustManagerImpl.java
index 543dfb2..502396e 100644
--- a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/TrustManagerImpl.java
+++ b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/TrustManagerImpl.java
@@ -17,8 +17,6 @@
 
 package org.apache.harmony.xnet.provider.jsse;
 
-import org.bouncycastle.jce.provider.IndexedPKIXParameters;
-
 import java.security.InvalidAlgorithmParameterException;
 import java.security.KeyStore;
 import java.security.KeyStoreException;
diff --git a/luni/src/main/native/ICU.cpp b/luni/src/main/native/ICU.cpp
index 8df7c7e..91358fd 100644
--- a/luni/src/main/native/ICU.cpp
+++ b/luni/src/main/native/ICU.cpp
@@ -19,6 +19,7 @@
 #include "ErrorCode.h"
 #include "JNIHelp.h"
 #include "JniConstants.h"
+#include "ScopedJavaUnicodeString.h"
 #include "ScopedLocalRef.h"
 #include "ScopedUtfChars.h"
 #include "UniquePtr.h"
@@ -31,9 +32,7 @@
 #include "unicode/gregocal.h"
 #include "unicode/locid.h"
 #include "unicode/numfmt.h"
-#include "unicode/smpdtfmt.h"
 #include "unicode/strenum.h"
-#include "unicode/timezone.h"
 #include "unicode/ubrk.h"
 #include "unicode/ucal.h"
 #include "unicode/uclean.h"
@@ -71,19 +70,18 @@
     void operator=(const ScopedResourceBundle&);
 };
 
-static Locale getLocale(JNIEnv* env, jstring localeName) {
+Locale getLocale(JNIEnv* env, jstring localeName) {
     return Locale::createFromName(ScopedUtfChars(env, localeName).c_str());
 }
 
-static jint getCurrencyFractionDigitsNative(JNIEnv* env, jclass, jstring currencyCode) {
+static jint getCurrencyFractionDigitsNative(JNIEnv* env, jclass, jstring javaCurrencyCode) {
     UErrorCode status = U_ZERO_ERROR;
     UniquePtr<NumberFormat> fmt(NumberFormat::createCurrencyInstance(status));
     if (U_FAILURE(status)) {
         return -1;
     }
-    const jchar* cCode = env->GetStringChars(currencyCode, NULL);
-    fmt->setCurrency(cCode, status);
-    env->ReleaseStringChars(currencyCode, cCode);
+    ScopedJavaUnicodeString currencyCode(env, javaCurrencyCode);
+    fmt->setCurrency(currencyCode.unicodeString().getBuffer(), status);
     if (U_FAILURE(status)) {
         return -1;
     }
@@ -263,94 +261,6 @@
     return getAvailableLocales(env, unum_countAvailable, unum_getAvailable);
 }
 
-static TimeZone* timeZoneFromId(JNIEnv* env, jstring id) {
-    const jchar* chars = env->GetStringChars(id, NULL);
-    const UnicodeString zoneID(reinterpret_cast<const UChar*>(chars), env->GetStringLength(id));
-    env->ReleaseStringChars(id, chars);
-    return TimeZone::createTimeZone(zoneID);
-}
-
-static jstring formatDate(JNIEnv* env, const SimpleDateFormat& fmt, const UDate& when) {
-    UnicodeString str;
-    fmt.format(when, str);
-    return env->NewString(str.getBuffer(), str.length());
-}
-
-static void getTimeZonesNative(JNIEnv* env, jclass, jobjectArray outerArray, jstring localeName) {
-    Locale locale = getLocale(env, localeName);
-
-    // We could use TimeZone::getDisplayName, but that's way too slow.
-    // The cost of this method goes from 0.5s to 4.5s on a Nexus One.
-    // Much of the saving comes from caching SimpleDateFormat instances.
-    UErrorCode status = U_ZERO_ERROR;
-    UnicodeString longPattern("zzzz", "");
-    SimpleDateFormat longFormat(longPattern, locale, status);
-    UnicodeString shortPattern("z", "");
-    SimpleDateFormat shortFormat(shortPattern, locale, status);
-
-    jobjectArray longStdArray = (jobjectArray) env->GetObjectArrayElement(outerArray, 1);
-    jobjectArray shortStdArray = (jobjectArray) env->GetObjectArrayElement(outerArray, 2);
-    jobjectArray longDstArray = (jobjectArray) env->GetObjectArrayElement(outerArray, 3);
-    jobjectArray shortDstArray = (jobjectArray) env->GetObjectArrayElement(outerArray, 4);
-
-    // 15th January 2008
-    UDate date1 = 1203105600000.0;
-    // 15th July 2008
-    UDate date2 = 1218826800000.0;
-
-    jobjectArray zoneIds = (jobjectArray) env->GetObjectArrayElement(outerArray, 0);
-    int zoneIdCount = env->GetArrayLength(zoneIds);
-    for (int i = 0; i < zoneIdCount; ++i) {
-        ScopedLocalRef<jstring> id(env, reinterpret_cast<jstring>(env->GetObjectArrayElement(zoneIds, i)));
-        UniquePtr<TimeZone> tz(timeZoneFromId(env, id.get()));
-
-        longFormat.setTimeZone(*tz);
-        shortFormat.setTimeZone(*tz);
-
-        int32_t daylightOffset;
-        int32_t rawOffset;
-        tz->getOffset(date1, false, rawOffset, daylightOffset, status);
-        UDate standardDate;
-        UDate daylightSavingDate;
-        if (daylightOffset != 0) {
-            // The Timezone is reporting that we are in daylight time
-            // for the winter date.  The dates are for the wrong hemisphere,
-            // swap them.
-            standardDate = date2;
-            daylightSavingDate = date1;
-        } else {
-            standardDate = date1;
-            daylightSavingDate = date2;
-        }
-
-        ScopedLocalRef<jstring> shortStd(env, formatDate(env, shortFormat, standardDate));
-        env->SetObjectArrayElement(shortStdArray, i, shortStd.get());
-
-        ScopedLocalRef<jstring> longStd(env, formatDate(env, longFormat, standardDate));
-        env->SetObjectArrayElement(longStdArray, i, longStd.get());
-
-        if (tz->useDaylightTime()) {
-            ScopedLocalRef<jstring> shortDst(env, formatDate(env, shortFormat, daylightSavingDate));
-            env->SetObjectArrayElement(shortDstArray, i, shortDst.get());
-
-            ScopedLocalRef<jstring> longDst(env, formatDate(env, longFormat, daylightSavingDate));
-            env->SetObjectArrayElement(longDstArray, i, longDst.get());
-        } else {
-            env->SetObjectArrayElement(shortDstArray, i, shortStd.get());
-            env->SetObjectArrayElement(longDstArray, i, longStd.get());
-        }
-    }
-}
-
-static jstring getDisplayTimeZoneNative(JNIEnv* env, jclass, jstring zoneId, jboolean isDST, jint style, jstring localeId) {
-    UniquePtr<TimeZone> zone(timeZoneFromId(env, zoneId));
-    Locale locale = getLocale(env, localeId);
-    // Try to get the display name of the TimeZone according to the Locale
-    UnicodeString displayName;
-    zone->getDisplayName((UBool)isDST, (style == 0 ? TimeZone::SHORT : TimeZone::LONG), locale, displayName);
-    return env->NewString(displayName.getBuffer(), displayName.length());
-}
-
 static bool getDayIntVector(JNIEnv*, UResourceBundle* gregorian, int* values) {
     // get the First day of week and the minimal days in first week numbers
     UErrorCode status = U_ZERO_ERROR;
@@ -506,7 +416,7 @@
 static jboolean initLocaleDataImpl(JNIEnv* env, jclass, jstring locale, jobject localeData) {
     ScopedUtfChars localeName(env, locale);
     UErrorCode status = U_ZERO_ERROR;
-    ScopedResourceBundle root(ures_openU(NULL, localeName.c_str(), &status));
+    ScopedResourceBundle root(ures_open(NULL, localeName.c_str(), &status));
     if (U_FAILURE(status)) {
         LOGE("Error getting ICU resource bundle: %s", u_errorName(status));
         status = U_ZERO_ERROR;
@@ -638,15 +548,13 @@
     {"getCurrencySymbolNative", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", (void*) getCurrencySymbolNative},
     {"getDisplayCountryNative", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", (void*) getDisplayCountryNative},
     {"getDisplayLanguageNative", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", (void*) getDisplayLanguageNative},
-    {"getDisplayTimeZoneNative", "(Ljava/lang/String;ZILjava/lang/String;)Ljava/lang/String;", (void*) getDisplayTimeZoneNative},
     {"getDisplayVariantNative", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", (void*) getDisplayVariantNative},
     {"getISO3CountryNative", "(Ljava/lang/String;)Ljava/lang/String;", (void*) getISO3CountryNative},
     {"getISO3LanguageNative", "(Ljava/lang/String;)Ljava/lang/String;", (void*) getISO3LanguageNative},
     {"getISOCountriesNative", "()[Ljava/lang/String;", (void*) getISOCountriesNative},
     {"getISOLanguagesNative", "()[Ljava/lang/String;", (void*) getISOLanguagesNative},
-    {"getTimeZonesNative", "([[Ljava/lang/String;Ljava/lang/String;)V", (void*) getTimeZonesNative},
     {"initLocaleDataImpl", "(Ljava/lang/String;Lcom/ibm/icu4jni/util/LocaleData;)Z", (void*) initLocaleDataImpl},
 };
-int register_com_ibm_icu4jni_util_Resources(JNIEnv* env) {
+int register_com_ibm_icu4jni_util_ICU(JNIEnv* env) {
     return jniRegisterNativeMethods(env, "com/ibm/icu4jni/util/ICU", gMethods, NELEM(gMethods));
 }
diff --git a/luni/src/main/native/NativeBreakIterator.cpp b/luni/src/main/native/NativeBreakIterator.cpp
index cb7b7b9..89ccbc6 100644
--- a/luni/src/main/native/NativeBreakIterator.cpp
+++ b/luni/src/main/native/NativeBreakIterator.cpp
@@ -18,6 +18,7 @@
 
 #include "JNIHelp.h"
 #include "ErrorCode.h"
+#include "ScopedJavaUnicodeString.h"
 #include "ScopedUtfChars.h"
 #include "unicode/ubrk.h"
 #include "unicode/putil.h"
@@ -66,11 +67,11 @@
     return reinterpret_cast<uintptr_t>(it);
 }
 
-static void setTextImpl(JNIEnv* env, jclass, jint address, jstring text) {
+static void setTextImpl(JNIEnv* env, jclass, jint address, jstring javaText) {
+    ScopedJavaUnicodeString text(env, javaText);
+    UnicodeString& s(text.unicodeString());
     UErrorCode status = U_ZERO_ERROR;
-    const UChar* chars = env->GetStringChars(text, NULL);
-    ubrk_setText(breakIterator(address), chars, env->GetStringLength(text), &status);
-    env->ReleaseStringChars(text, chars);
+    ubrk_setText(breakIterator(address), s.getBuffer(), s.length(), &status);
     icu4jni_error(env, status);
 }
 
diff --git a/luni/src/main/native/NativeDecimalFormat.cpp b/luni/src/main/native/NativeDecimalFormat.cpp
index 6fda6b1..ee9fc3a 100644
--- a/luni/src/main/native/NativeDecimalFormat.cpp
+++ b/luni/src/main/native/NativeDecimalFormat.cpp
@@ -22,6 +22,7 @@
 #include "ScopedJavaUnicodeString.h"
 #include "ScopedPrimitiveArray.h"
 #include "ScopedUtfChars.h"
+#include "UniquePtr.h"
 #include "cutils/log.h"
 #include "digitlst.h"
 #include "unicode/decimfmt.h"
@@ -37,6 +38,10 @@
     return reinterpret_cast<DecimalFormat*>(static_cast<uintptr_t>(addr));
 }
 
+static UNumberFormat* toUNumberFormat(jint addr) {
+    return reinterpret_cast<UNumberFormat*>(static_cast<uintptr_t>(addr));
+}
+
 static DecimalFormatSymbols* makeDecimalFormatSymbols(JNIEnv* env,
         jstring currencySymbol0, jchar decimalSeparator, jchar digit,
         jchar groupingSeparator0, jstring infinity0,
@@ -117,89 +122,51 @@
     fmt->setRoundingIncrement(increment);
 }
 
-static void setSymbol(JNIEnv* env, jclass, jint addr, jint symbol, jstring s) {
-    const UChar* chars = env->GetStringChars(s, NULL);
-    const int32_t charCount = env->GetStringLength(s);
+static void setSymbol(JNIEnv* env, jclass, jint addr, jint javaSymbol, jstring javaValue) {
+    ScopedJavaUnicodeString value(env, javaValue);
+    UnicodeString& s(value.unicodeString());
     UErrorCode status = U_ZERO_ERROR;
-    UNumberFormat* fmt = reinterpret_cast<UNumberFormat*>(static_cast<uintptr_t>(addr));
-    unum_setSymbol(fmt, static_cast<UNumberFormatSymbol>(symbol), chars, charCount, &status);
-    icu4jni_error(env, status);
-    env->ReleaseStringChars(s, chars);
-}
-
-static void setAttribute(JNIEnv*, jclass, jint addr, jint symbol,
-        jint value) {
-
-    UNumberFormat *fmt = (UNumberFormat *)(int)addr;
-
-    unum_setAttribute(fmt, (UNumberFormatAttribute) symbol, value);
-}
-
-static jint getAttribute(JNIEnv*, jclass, jint addr, jint symbol) {
-
-    UNumberFormat *fmt = (UNumberFormat *)(int)addr;
-
-    int res = unum_getAttribute(fmt, (UNumberFormatAttribute) symbol);
-
-    return res;
-}
-
-static void setTextAttribute(JNIEnv* env, jclass, jint addr, jint symbol,
-        jstring text) {
-
-    // the errorcode returned by unum_setTextAttribute
-    UErrorCode status = U_ZERO_ERROR;
-
-    // get the pointer to the number format
-    UNumberFormat *fmt = (UNumberFormat *)(int)addr;
-
-    const UChar *textChars = env->GetStringChars(text, NULL);
-    int textLen = env->GetStringLength(text);
-
-    unum_setTextAttribute(fmt, (UNumberFormatTextAttribute) symbol, textChars,
-            textLen, &status);
-
-    env->ReleaseStringChars(text, textChars);
-
+    UNumberFormatSymbol symbol = static_cast<UNumberFormatSymbol>(javaSymbol);
+    unum_setSymbol(toUNumberFormat(addr), symbol, s.getBuffer(), s.length(), &status);
     icu4jni_error(env, status);
 }
 
-static jstring getTextAttribute(JNIEnv* env, jclass, jint addr,
-        jint symbol) {
+static void setAttribute(JNIEnv*, jclass, jint addr, jint javaAttr, jint value) {
+    UNumberFormatAttribute attr = static_cast<UNumberFormatAttribute>(javaAttr);
+    unum_setAttribute(toUNumberFormat(addr), attr, value);
+}
 
-    uint32_t resultlength, reslenneeded;
+static jint getAttribute(JNIEnv*, jclass, jint addr, jint javaAttr) {
+    UNumberFormatAttribute attr = static_cast<UNumberFormatAttribute>(javaAttr);
+    return unum_getAttribute(toUNumberFormat(addr), attr);
+}
 
-    // the errorcode returned by unum_getTextAttribute
+static void setTextAttribute(JNIEnv* env, jclass, jint addr, jint javaAttr, jstring javaValue) {
+    ScopedJavaUnicodeString value(env, javaValue);
+    UnicodeString& s(value.unicodeString());
     UErrorCode status = U_ZERO_ERROR;
+    UNumberFormatTextAttribute attr = static_cast<UNumberFormatTextAttribute>(javaAttr);
+    unum_setTextAttribute(toUNumberFormat(addr), attr, s.getBuffer(), s.length(), &status);
+    icu4jni_error(env, status);
+}
 
-    // get the pointer to the number format
-    UNumberFormat *fmt = (UNumberFormat *)(int)addr;
+static jstring getTextAttribute(JNIEnv* env, jclass, jint addr, jint javaAttr) {
+    UErrorCode status = U_ZERO_ERROR;
+    UNumberFormat* fmt = toUNumberFormat(addr);
+    UNumberFormatTextAttribute attr = static_cast<UNumberFormatTextAttribute>(javaAttr);
 
-    UChar* result = NULL;
-    resultlength=0;
-
-    // find out how long the result will be
-    reslenneeded=unum_getTextAttribute(fmt, (UNumberFormatTextAttribute) symbol,
-            result, resultlength, &status);
-
-    result = NULL;
-    if(status==U_BUFFER_OVERFLOW_ERROR) {
-        status=U_ZERO_ERROR;
-        resultlength=reslenneeded+1;
-        result=(UChar*)malloc(sizeof(UChar) * resultlength);
-        reslenneeded=unum_getTextAttribute(fmt,
-                (UNumberFormatTextAttribute) symbol, result, resultlength,
-                &status);
+    // Find out how long the result will be...
+    UniquePtr<UChar[]> chars;
+    uint32_t charCount = 0;
+    uint32_t desiredCount = unum_getTextAttribute(fmt, attr, chars.get(), charCount, &status);
+    if (status == U_BUFFER_OVERFLOW_ERROR) {
+        // ...then get it.
+        status = U_ZERO_ERROR;
+        charCount = desiredCount + 1;
+        chars.reset(new UChar[charCount]);
+        charCount = unum_getTextAttribute(fmt, attr, chars.get(), charCount, &status);
     }
-    if (icu4jni_error(env, status) != FALSE) {
-        return NULL;
-    }
-
-    jstring res = env->NewString(result, reslenneeded);
-
-    free(result);
-
-    return res;
+    return icu4jni_error(env, status) ? NULL : env->NewString(chars.get(), charCount);
 }
 
 static void applyPatternImpl(JNIEnv* env, jclass, jint addr, jboolean localized, jstring pattern0) {
diff --git a/luni/src/main/native/NativeIDN.cpp b/luni/src/main/native/NativeIDN.cpp
index e8052fc..c507eaf 100644
--- a/luni/src/main/native/NativeIDN.cpp
+++ b/luni/src/main/native/NativeIDN.cpp
@@ -32,7 +32,7 @@
     }
 }
 
-static jstring convertImpl(JNIEnv* env, jclass, jstring s, jint flags, jboolean toAscii) {
+static jstring NativeIDN_convertImpl(JNIEnv* env, jclass, jstring s, jint flags, jboolean toAscii) {
     ScopedJavaUnicodeString sus(env, s);
     const UChar* src = sus.unicodeString().getBuffer();
     const size_t srcLength = sus.unicodeString().length();
@@ -59,8 +59,8 @@
 }
 
 static JNINativeMethod gMethods[] = {
-    {"convertImpl", "(Ljava/lang/String;IZ)Ljava/lang/String;", (void*) convertImpl},
+    {"convertImpl", "(Ljava/lang/String;IZ)Ljava/lang/String;", (void*) NativeIDN_convertImpl},
 };
-int register_com_ibm_icu4jni_text_NativeIDN(JNIEnv* env) {
-    return jniRegisterNativeMethods(env, "com/ibm/icu4jni/text/NativeIDN", gMethods, NELEM(gMethods));
+int register_libcore_icu_NativeIDN(JNIEnv* env) {
+    return jniRegisterNativeMethods(env, "libcore/icu/NativeIDN", gMethods, NELEM(gMethods));
 }
diff --git a/luni/src/main/native/NativeNormalizer.cpp b/luni/src/main/native/NativeNormalizer.cpp
index 257cf9b..e4afed4 100644
--- a/luni/src/main/native/NativeNormalizer.cpp
+++ b/luni/src/main/native/NativeNormalizer.cpp
@@ -1,12 +1,12 @@
 /*
  * Copyright (C) 2010 The Android Open Source Project
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,7 +21,7 @@
 #include "ScopedJavaUnicodeString.h"
 #include "unicode/normlzr.h"
 
-static jstring normalizeImpl(JNIEnv* env, jclass, jstring s, jint intMode) {
+static jstring NativeNormalizer_normalizeImpl(JNIEnv* env, jclass, jstring s, jint intMode) {
     ScopedJavaUnicodeString src(env, s);
     UNormalizationMode mode = static_cast<UNormalizationMode>(intMode);
     UErrorCode errorCode = U_ZERO_ERROR;
@@ -31,7 +31,7 @@
     return dst.isBogus() ? NULL : env->NewString(dst.getBuffer(), dst.length());
 }
 
-static jboolean isNormalizedImpl(JNIEnv* env, jclass, jstring s, jint intMode) {
+static jboolean NativeNormalizer_isNormalizedImpl(JNIEnv* env, jclass, jstring s, jint intMode) {
     ScopedJavaUnicodeString src(env, s);
     UNormalizationMode mode = static_cast<UNormalizationMode>(intMode);
     UErrorCode errorCode = U_ZERO_ERROR;
@@ -41,10 +41,9 @@
 }
 
 static JNINativeMethod gMethods[] = {
-    {"normalizeImpl", "(Ljava/lang/String;I)Ljava/lang/String;", (void*) normalizeImpl},
-    {"isNormalizedImpl", "(Ljava/lang/String;I)Z", (void*) isNormalizedImpl},
+    {"normalizeImpl", "(Ljava/lang/String;I)Ljava/lang/String;", (void*) NativeNormalizer_normalizeImpl},
+    {"isNormalizedImpl", "(Ljava/lang/String;I)Z", (void*) NativeNormalizer_isNormalizedImpl},
 };
-int register_com_ibm_icu4jni_text_NativeNormalizer(JNIEnv* env) {
-    return jniRegisterNativeMethods(env, "com/ibm/icu4jni/text/NativeNormalizer",
-            gMethods, NELEM(gMethods));
+int register_libcore_icu_NativeNormalizer(JNIEnv* env) {
+    return jniRegisterNativeMethods(env, "libcore/icu/NativeNormalizer", gMethods, NELEM(gMethods));
 }
diff --git a/luni/src/main/native/NativePluralRules.cpp b/luni/src/main/native/NativePluralRules.cpp
index 887b90f..2e1c635 100644
--- a/luni/src/main/native/NativePluralRules.cpp
+++ b/luni/src/main/native/NativePluralRules.cpp
@@ -59,6 +59,6 @@
     {"forLocaleImpl", "(Ljava/lang/String;)I", (void*) NativePluralRules_forLocaleImpl},
     {"quantityForIntImpl", "(II)I", (void*) NativePluralRules_quantityForIntImpl},
 };
-int register_com_ibm_icu4jni_text_NativePluralRules(JNIEnv* env) {
-    return jniRegisterNativeMethods(env, "com/ibm/icu4jni/text/NativePluralRules", gMethods, NELEM(gMethods));
+int register_libcore_icu_NativePluralRules(JNIEnv* env) {
+    return jniRegisterNativeMethods(env, "libcore/icu/NativePluralRules", gMethods, NELEM(gMethods));
 }
diff --git a/luni/src/main/native/NativeRegEx.cpp b/luni/src/main/native/NativeRegEx.cpp
index 0f31204..5c94963 100644
--- a/luni/src/main/native/NativeRegEx.cpp
+++ b/luni/src/main/native/NativeRegEx.cpp
@@ -22,7 +22,9 @@
 
 #include "JNIHelp.h"
 #include "JniConstants.h"
+#include "ScopedJavaUnicodeString.h"
 #include "ScopedPrimitiveArray.h"
+#include "UniquePtr.h"
 #include "jni.h"
 #include "unicode/parseerr.h"
 #include "unicode/uregex.h"
@@ -36,6 +38,16 @@
  * manage memory properly.
  */
 struct RegExData {
+    RegExData() : regex(NULL), text(NULL) {
+    }
+
+    ~RegExData() {
+        uregex_close(regex);
+        if (text != &EMPTY_STRING) {
+            delete[] text;
+        }
+    }
+
     // A pointer to the ICU regular expression
     URegularExpression* regex;
     // A pointer to (a copy of) the input text that *we* manage
@@ -57,65 +69,43 @@
     jniThrowRuntimeException(env, u_errorName(status));
 }
 
-static void _close(JNIEnv*, jclass, RegExData* data)
-{
-    if (data->regex != NULL) {
-        uregex_close(data->regex);
-    }
-
-    if (data->text != &EMPTY_STRING) {
-        delete[] data->text;
-    }
-
-    free(data);
+static void NativeRegEx_close(JNIEnv*, jclass, RegExData* data) {
+    delete data;
 }
 
-static RegExData* open(JNIEnv* env, jclass clazz, jstring pattern, jint flags)
-{
+static RegExData* NativeRegEx_open(JNIEnv* env, jclass clazz, jstring javaPattern, jint flags) {
     flags = flags | UREGEX_ERROR_ON_UNKNOWN_ESCAPES;
 
-    RegExData* data = (RegExData*)calloc(sizeof(RegExData), 1);
-
     UErrorCode status = U_ZERO_ERROR;
     UParseError error;
     error.offset = -1;
 
-    int patternLen = env->GetStringLength(pattern);
-    if (patternLen == 0) {
-        data->regex = uregex_open(&EMPTY_STRING, -1, flags, &error, &status);
-    } else {
-        jchar const * patternRaw = env->GetStringChars(pattern, NULL);
-        data->regex = uregex_open(patternRaw, patternLen, flags, &error,
-                                  &status);
-        env->ReleaseStringChars(pattern, patternRaw);
-    }
-
+    ScopedJavaUnicodeString pattern(env, javaPattern);
+    UnicodeString& patternString(pattern.unicodeString());
+    UniquePtr<RegExData> data(new RegExData);
+    data->regex = uregex_open(patternString.getBuffer(), patternString.length(), flags, &error, &status);
     if (!U_SUCCESS(status)) {
-        _close(env, clazz, data);
-        throwPatternSyntaxException(env, status, pattern, error);
-        data = NULL;
+        throwPatternSyntaxException(env, status, javaPattern, error);
+        return NULL;
     }
 
-    return data;
+    return data.release();
 }
 
-static RegExData* _clone(JNIEnv* env, jclass, RegExData* data)
-{
+static RegExData* NativeRegEx_clone(JNIEnv* env, jclass, RegExData* data) {
     UErrorCode status = U_ZERO_ERROR;
-
     URegularExpression* clonedRegex = uregex_clone(data->regex, &status);
     if (!U_SUCCESS(status)) {
         throwRuntimeException(env, status);
+        return NULL;
     }
 
-    RegExData* result = (RegExData*)calloc(sizeof(RegExData), 1);
+    RegExData* result = new RegExData;
     result->regex = clonedRegex;
-
     return result;
 }
 
-static void setText(JNIEnv* env, jclass, RegExData* data, jstring text)
-{
+static void NativeRegEx_setText(JNIEnv* env, jclass, RegExData* data, jstring text) {
     UErrorCode status = U_ZERO_ERROR;
 
     uregex_setText(data->regex, &EMPTY_STRING, 0, &status);
@@ -144,70 +134,52 @@
     }
 }
 
-static jboolean matches(JNIEnv* env, jclass, RegExData* data,
-                        jint startIndex)
-{
+static jboolean NativeRegEx_matches(JNIEnv* env, jclass, RegExData* data, jint startIndex) {
     UErrorCode status = U_ZERO_ERROR;
-
     jboolean result = uregex_matches(data->regex, startIndex, &status);
     if (!U_SUCCESS(status)) {
         throwRuntimeException(env, status);
     }
-
     return result;
 }
 
-static jboolean lookingAt(JNIEnv* env, jclass, RegExData* data,
-                          jint startIndex)
-{
+static jboolean NativeRegEx_lookingAt(JNIEnv* env, jclass, RegExData* data, jint startIndex) {
     UErrorCode status = U_ZERO_ERROR;
-
     jboolean result = uregex_lookingAt(data->regex, startIndex, &status);
     if (!U_SUCCESS(status)) {
         throwRuntimeException(env, status);
     }
-
     return result;
 }
 
-static jboolean find(JNIEnv* env, jclass, RegExData* data,
-                     jint startIndex)
-{
+static jboolean NativeRegEx_find(JNIEnv* env, jclass, RegExData* data, jint startIndex) {
     UErrorCode status = U_ZERO_ERROR;
-
     jboolean result = uregex_find(data->regex, startIndex, &status);
     if (!U_SUCCESS(status)) {
         throwRuntimeException(env, status);
     }
-
     return result;
 }
 
-static jboolean findNext(JNIEnv* env, jclass, RegExData* data)
-{
+static jboolean NativeRegEx_findNext(JNIEnv* env, jclass, RegExData* data) {
     UErrorCode status = U_ZERO_ERROR;
-
     jboolean result = uregex_findNext(data->regex, &status);
     if (!U_SUCCESS(status)) {
         throwRuntimeException(env, status);
     }
-
     return result;
 }
 
-static jint groupCount(JNIEnv* env, jclass, RegExData* data)
-{
+static jint NativeRegEx_groupCount(JNIEnv* env, jclass, RegExData* data) {
     UErrorCode status = U_ZERO_ERROR;
-
     jint result = uregex_groupCount(data->regex, &status);
     if (!U_SUCCESS(status)) {
         throwRuntimeException(env, status);
     }
-
     return result;
 }
 
-static void startEnd(JNIEnv* env, jclass, RegExData* data, jintArray javaOffsets) {
+static void NativeRegEx_startEnd(JNIEnv* env, jclass, RegExData* data, jintArray javaOffsets) {
     UErrorCode status = U_ZERO_ERROR;
     ScopedIntArrayRW offsets(env, javaOffsets);
     int groupCount = uregex_groupCount(data->regex, &status);
@@ -220,7 +192,7 @@
     }
 }
 
-static void setRegion(JNIEnv* env, jclass, RegExData* data, jint start, jint end) {
+static void NativeRegEx_setRegion(JNIEnv* env, jclass, RegExData* data, jint start, jint end) {
     UErrorCode status = U_ZERO_ERROR;
     uregex_setRegion(data->regex, start, end, &status);
     if (!U_SUCCESS(status)) {
@@ -228,8 +200,7 @@
     }
 }
 
-static jint regionStart(JNIEnv* env, jclass, RegExData* data)
-{
+static jint NativeRegEx_regionStart(JNIEnv* env, jclass, RegExData* data) {
     UErrorCode status = U_ZERO_ERROR;
     int result = uregex_regionStart(data->regex, &status);
     if (!U_SUCCESS(status)) {
@@ -238,8 +209,7 @@
     return result;
 }
 
-static jint regionEnd(JNIEnv* env, jclass, RegExData* data)
-{
+static jint NativeRegEx_regionEnd(JNIEnv* env, jclass, RegExData* data) {
     UErrorCode status = U_ZERO_ERROR;
     int result = uregex_regionEnd(data->regex, &status);
     if (!U_SUCCESS(status)) {
@@ -248,9 +218,7 @@
     return result;
 }
 
-static void useTransparentBounds(JNIEnv* env, jclass, RegExData* data,
-                                 jboolean value)
-{
+static void NativeRegEx_useTransparentBounds(JNIEnv* env, jclass, RegExData* data, jboolean value) {
     UErrorCode status = U_ZERO_ERROR;
     uregex_useTransparentBounds(data->regex, value, &status);
     if (!U_SUCCESS(status)) {
@@ -258,8 +226,7 @@
     }
 }
 
-static jboolean hasTransparentBounds(JNIEnv* env, jclass, RegExData* data)
-{
+static jboolean NativeRegEx_hasTransparentBounds(JNIEnv* env, jclass, RegExData* data) {
     UErrorCode status = U_ZERO_ERROR;
     jboolean result = uregex_hasTransparentBounds(data->regex, &status);
     if (!U_SUCCESS(status)) {
@@ -268,9 +235,7 @@
     return result;
 }
 
-static void useAnchoringBounds(JNIEnv* env, jclass, RegExData* data,
-                               jboolean value)
-{
+static void NativeRegEx_useAnchoringBounds(JNIEnv* env, jclass, RegExData* data, jboolean value) {
     UErrorCode status = U_ZERO_ERROR;
     uregex_useAnchoringBounds(data->regex, value, &status);
     if (!U_SUCCESS(status)) {
@@ -278,8 +243,7 @@
     }
 }
 
-static jboolean hasAnchoringBounds(JNIEnv* env, jclass, RegExData* data)
-{
+static jboolean NativeRegEx_hasAnchoringBounds(JNIEnv* env, jclass, RegExData* data) {
     UErrorCode status = U_ZERO_ERROR;
     jboolean result = uregex_hasAnchoringBounds(data->regex, &status);
     if (!U_SUCCESS(status)) {
@@ -288,8 +252,7 @@
     return result;
 }
 
-static jboolean hitEnd(JNIEnv* env, jclass, RegExData* data)
-{
+static jboolean NativeRegEx_hitEnd(JNIEnv* env, jclass, RegExData* data) {
     UErrorCode status = U_ZERO_ERROR;
     jboolean result = uregex_hitEnd(data->regex, &status);
     if (!U_SUCCESS(status)) {
@@ -298,8 +261,7 @@
     return result;
 }
 
-static jboolean requireEnd(JNIEnv* env, jclass, RegExData* data)
-{
+static jboolean NativeRegEx_requireEnd(JNIEnv* env, jclass, RegExData* data) {
     UErrorCode status = U_ZERO_ERROR;
     jboolean result = uregex_requireEnd(data->regex, &status);
     if (!U_SUCCESS(status)) {
@@ -308,8 +270,7 @@
     return result;
 }
 
-static void reset(JNIEnv* env, jclass, RegExData* data, jint position)
-{
+static void NativeRegEx_reset(JNIEnv* env, jclass, RegExData* data, jint position) {
     UErrorCode status = U_ZERO_ERROR;
     uregex_reset(data->regex, position, &status);
     if (!U_SUCCESS(status)) {
@@ -318,26 +279,26 @@
 }
 
 static JNINativeMethod gMethods[] = {
-    { "open",                 "(Ljava/lang/String;I)I", (void*)open       },
-    { "clone",                "(I)I",                   (void*)_clone     },
-    { "close",                "(I)V",                   (void*)_close     },
-    { "setText",              "(ILjava/lang/String;)V", (void*)setText    },
-    { "matches",              "(II)Z",                  (void*)matches    },
-    { "lookingAt",            "(II)Z",                  (void*)lookingAt  },
-    { "find",                 "(II)Z",                  (void*)find       },
-    { "findNext",             "(I)Z",                   (void*)findNext   },
-    { "groupCount",           "(I)I",                   (void*)groupCount },
-    { "startEnd",             "(I[I)V",                 (void*)startEnd   },
-    { "setRegion",            "(III)V",                 (void*)setRegion  },
-    { "regionStart",          "(I)I",                   (void*)regionStart },
-    { "regionEnd",            "(I)I",                   (void*)regionEnd  },
-    { "useTransparentBounds", "(IZ)V",            (void*)useTransparentBounds },
-    { "hasTransparentBounds", "(I)Z",             (void*)hasTransparentBounds },
-    { "useAnchoringBounds",   "(IZ)V",            (void*)useAnchoringBounds },
-    { "hasAnchoringBounds",   "(I)Z",             (void*)hasAnchoringBounds },
-    { "hitEnd",               "(I)Z",                   (void*)hitEnd },
-    { "requireEnd",           "(I)Z",                   (void*)requireEnd },
-    { "reset",                "(II)V",                  (void*)reset },
+    { "open",                 "(Ljava/lang/String;I)I", (void*) NativeRegEx_open },
+    { "clone",                "(I)I",                   (void*) NativeRegEx_clone },
+    { "close",                "(I)V",                   (void*) NativeRegEx_close },
+    { "setText",              "(ILjava/lang/String;)V", (void*) NativeRegEx_setText },
+    { "matches",              "(II)Z",                  (void*) NativeRegEx_matches },
+    { "lookingAt",            "(II)Z",                  (void*) NativeRegEx_lookingAt },
+    { "find",                 "(II)Z",                  (void*) NativeRegEx_find },
+    { "findNext",             "(I)Z",                   (void*) NativeRegEx_findNext },
+    { "groupCount",           "(I)I",                   (void*) NativeRegEx_groupCount },
+    { "startEnd",             "(I[I)V",                 (void*) NativeRegEx_startEnd },
+    { "setRegion",            "(III)V",                 (void*) NativeRegEx_setRegion },
+    { "regionStart",          "(I)I",                   (void*) NativeRegEx_regionStart },
+    { "regionEnd",            "(I)I",                   (void*) NativeRegEx_regionEnd },
+    { "useTransparentBounds", "(IZ)V",                  (void*) NativeRegEx_useTransparentBounds },
+    { "hasTransparentBounds", "(I)Z",                   (void*) NativeRegEx_hasTransparentBounds },
+    { "useAnchoringBounds",   "(IZ)V",                  (void*) NativeRegEx_useAnchoringBounds },
+    { "hasAnchoringBounds",   "(I)Z",                   (void*) NativeRegEx_hasAnchoringBounds },
+    { "hitEnd",               "(I)Z",                   (void*) NativeRegEx_hitEnd },
+    { "requireEnd",           "(I)Z",                   (void*) NativeRegEx_requireEnd },
+    { "reset",                "(II)V",                  (void*) NativeRegEx_reset },
 };
 int register_com_ibm_icu4jni_regex_NativeRegEx(JNIEnv* env) {
     return jniRegisterNativeMethods(env, "com/ibm/icu4jni/regex/NativeRegEx",
diff --git a/luni/src/main/native/Register.cpp b/luni/src/main/native/Register.cpp
index 0bb7165..cd4f34d 100644
--- a/luni/src/main/native/Register.cpp
+++ b/luni/src/main/native/Register.cpp
@@ -27,10 +27,7 @@
 extern int register_com_ibm_icu4jni_text_NativeBreakIterator(JNIEnv* env);
 extern int register_com_ibm_icu4jni_text_NativeCollator(JNIEnv* env);
 extern int register_com_ibm_icu4jni_text_NativeDecimalFormat(JNIEnv* env);
-extern int register_com_ibm_icu4jni_text_NativeIDN(JNIEnv* env);
-extern int register_com_ibm_icu4jni_text_NativeNormalizer(JNIEnv* env);
-extern int register_com_ibm_icu4jni_text_NativePluralRules(JNIEnv* env);
-extern int register_com_ibm_icu4jni_util_Resources(JNIEnv* env);
+extern int register_com_ibm_icu4jni_util_ICU(JNIEnv* env);
 extern int register_java_io_Console(JNIEnv* env);
 extern int register_java_io_File(JNIEnv* env);
 extern int register_java_io_FileDescriptor(JNIEnv* env);
@@ -49,6 +46,10 @@
 extern int register_java_util_zip_CRC32(JNIEnv* env);
 extern int register_java_util_zip_Deflater(JNIEnv* env);
 extern int register_java_util_zip_Inflater(JNIEnv* env);
+extern int register_libcore_icu_NativeIDN(JNIEnv* env);
+extern int register_libcore_icu_NativeNormalizer(JNIEnv* env);
+extern int register_libcore_icu_NativePluralRules(JNIEnv* env);
+extern int register_libcore_icu_TimeZones(JNIEnv* env);
 extern int register_org_apache_harmony_dalvik_NativeTestTarget(JNIEnv* env);
 extern int register_org_apache_harmony_luni_platform_OSFileSystem(JNIEnv* env);
 extern int register_org_apache_harmony_luni_platform_OSMemory(JNIEnv* env);
@@ -73,10 +74,7 @@
             register_com_ibm_icu4jni_text_NativeBreakIterator(env) != -1 &&
             register_com_ibm_icu4jni_text_NativeCollator(env) != -1 &&
             register_com_ibm_icu4jni_text_NativeDecimalFormat(env) != -1 &&
-            register_com_ibm_icu4jni_text_NativeIDN(env) != -1 &&
-            register_com_ibm_icu4jni_text_NativeNormalizer(env) != -1 &&
-            register_com_ibm_icu4jni_text_NativePluralRules(env) != -1 &&
-            register_com_ibm_icu4jni_util_Resources(env) != -1 &&
+            register_com_ibm_icu4jni_util_ICU(env) != -1 &&
             register_java_io_Console(env) != -1 &&
             register_java_io_File(env) != -1 &&
             register_java_io_FileDescriptor(env) != -1 &&
@@ -95,6 +93,10 @@
             register_java_util_zip_CRC32(env) != -1 &&
             register_java_util_zip_Deflater(env) != -1 &&
             register_java_util_zip_Inflater(env) != -1 &&
+            register_libcore_icu_NativeIDN(env) != -1 &&
+            register_libcore_icu_NativeNormalizer(env) != -1 &&
+            register_libcore_icu_NativePluralRules(env) != -1 &&
+            register_libcore_icu_TimeZones(env) != -1 &&
             register_org_apache_harmony_luni_platform_OSFileSystem(env) != -1 &&
             register_org_apache_harmony_luni_platform_OSMemory(env) != -1 &&
             register_org_apache_harmony_luni_platform_OSNetworkSystem(env) != -1 &&
diff --git a/luni/src/main/native/TimeZones.cpp b/luni/src/main/native/TimeZones.cpp
new file mode 100644
index 0000000..2ca9988
--- /dev/null
+++ b/luni/src/main/native/TimeZones.cpp
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "TimeZones"
+
+#include "ErrorCode.h"
+#include "JNIHelp.h"
+#include "JniConstants.h"
+#include "ScopedJavaUnicodeString.h"
+#include "ScopedLocalRef.h"
+#include "ScopedUtfChars.h"
+#include "UniquePtr.h"
+#include "unicode/smpdtfmt.h"
+#include "unicode/timezone.h"
+
+extern Locale getLocale(JNIEnv* env, jstring localeName);
+
+static jstring formatDate(JNIEnv* env, const SimpleDateFormat& fmt, const UDate& when) {
+    UnicodeString str;
+    fmt.format(when, str);
+    return env->NewString(str.getBuffer(), str.length());
+}
+
+static TimeZone* timeZoneFromId(JNIEnv* env, jstring javaZoneId) {
+    ScopedJavaUnicodeString zoneID(env, javaZoneId);
+    return TimeZone::createTimeZone(zoneID.unicodeString());
+}
+
+static jobjectArray TimeZones_forCountryCode(JNIEnv* env, jclass, jstring countryCode) {
+    ScopedUtfChars countryChars(env, countryCode);
+    if (countryChars.c_str() == NULL) {
+        return NULL;
+    }
+
+    UniquePtr<StringEnumeration> ids(TimeZone::createEnumeration(countryChars.c_str()));
+    if (ids.get() == NULL) {
+        return NULL;
+    }
+    UErrorCode status = U_ZERO_ERROR;
+    int32_t idCount = ids->count(status);
+    if (U_FAILURE(status)) {
+        icu4jni_error(env, status);
+        return NULL;
+    }
+
+    jobjectArray result = env->NewObjectArray(idCount, JniConstants::stringClass, NULL);
+    for (int32_t i = 0; i < idCount; ++i) {
+        const UnicodeString* id = ids->snext(status);
+        if (U_FAILURE(status)) {
+            icu4jni_error(env, status);
+            return NULL;
+        }
+        ScopedLocalRef<jstring> idString(env, env->NewString(id->getBuffer(), id->length()));
+        env->SetObjectArrayElement(result, i, idString.get());
+    }
+    return result;
+}
+
+static jstring TimeZones_getDisplayNameImpl(JNIEnv* env, jclass, jstring zoneId, jboolean isDST, jint style, jstring localeId) {
+    UniquePtr<TimeZone> zone(timeZoneFromId(env, zoneId));
+    Locale locale = getLocale(env, localeId);
+    // Try to get the display name of the TimeZone according to the Locale
+    UnicodeString displayName;
+    zone->getDisplayName((UBool)isDST, (style == 0 ? TimeZone::SHORT : TimeZone::LONG), locale, displayName);
+    return env->NewString(displayName.getBuffer(), displayName.length());
+}
+
+static void TimeZones_getZoneStringsImpl(JNIEnv* env, jclass, jobjectArray outerArray, jstring localeName) {
+    Locale locale = getLocale(env, localeName);
+
+    // We could use TimeZone::getDisplayName, but that's way too slow.
+    // The cost of this method goes from 0.5s to 4.5s on a Nexus One.
+    // Much of the saving comes from caching SimpleDateFormat instances.
+    UErrorCode status = U_ZERO_ERROR;
+    UnicodeString longPattern("zzzz", "");
+    SimpleDateFormat longFormat(longPattern, locale, status);
+    UnicodeString shortPattern("z", "");
+    SimpleDateFormat shortFormat(shortPattern, locale, status);
+
+    jobjectArray longStdArray = (jobjectArray) env->GetObjectArrayElement(outerArray, 1);
+    jobjectArray shortStdArray = (jobjectArray) env->GetObjectArrayElement(outerArray, 2);
+    jobjectArray longDstArray = (jobjectArray) env->GetObjectArrayElement(outerArray, 3);
+    jobjectArray shortDstArray = (jobjectArray) env->GetObjectArrayElement(outerArray, 4);
+
+    // 15th January 2008
+    UDate date1 = 1203105600000.0;
+    // 15th July 2008
+    UDate date2 = 1218826800000.0;
+
+    jobjectArray zoneIds = (jobjectArray) env->GetObjectArrayElement(outerArray, 0);
+    int zoneIdCount = env->GetArrayLength(zoneIds);
+    for (int i = 0; i < zoneIdCount; ++i) {
+        ScopedLocalRef<jstring> id(env, reinterpret_cast<jstring>(env->GetObjectArrayElement(zoneIds, i)));
+        UniquePtr<TimeZone> tz(timeZoneFromId(env, id.get()));
+
+        longFormat.setTimeZone(*tz);
+        shortFormat.setTimeZone(*tz);
+
+        int32_t daylightOffset;
+        int32_t rawOffset;
+        tz->getOffset(date1, false, rawOffset, daylightOffset, status);
+        UDate standardDate;
+        UDate daylightSavingDate;
+        if (daylightOffset != 0) {
+            // The Timezone is reporting that we are in daylight time
+            // for the winter date.  The dates are for the wrong hemisphere,
+            // swap them.
+            standardDate = date2;
+            daylightSavingDate = date1;
+        } else {
+            standardDate = date1;
+            daylightSavingDate = date2;
+        }
+
+        ScopedLocalRef<jstring> shortStd(env, formatDate(env, shortFormat, standardDate));
+        env->SetObjectArrayElement(shortStdArray, i, shortStd.get());
+
+        ScopedLocalRef<jstring> longStd(env, formatDate(env, longFormat, standardDate));
+        env->SetObjectArrayElement(longStdArray, i, longStd.get());
+
+        if (tz->useDaylightTime()) {
+            ScopedLocalRef<jstring> shortDst(env, formatDate(env, shortFormat, daylightSavingDate));
+            env->SetObjectArrayElement(shortDstArray, i, shortDst.get());
+
+            ScopedLocalRef<jstring> longDst(env, formatDate(env, longFormat, daylightSavingDate));
+            env->SetObjectArrayElement(longDstArray, i, longDst.get());
+        } else {
+            env->SetObjectArrayElement(shortDstArray, i, shortStd.get());
+            env->SetObjectArrayElement(longDstArray, i, longStd.get());
+        }
+    }
+}
+
+static JNINativeMethod gMethods[] = {
+    {"getDisplayNameImpl", "(Ljava/lang/String;ZILjava/lang/String;)Ljava/lang/String;", (void*) TimeZones_getDisplayNameImpl},
+    {"forCountryCode", "(Ljava/lang/String;)[Ljava/lang/String;", (void*) TimeZones_forCountryCode},
+    {"getZoneStringsImpl", "([[Ljava/lang/String;Ljava/lang/String;)V", (void*) TimeZones_getZoneStringsImpl},
+};
+int register_libcore_icu_TimeZones(JNIEnv* env) {
+    return jniRegisterNativeMethods(env, "libcore/icu/TimeZones", gMethods, NELEM(gMethods));
+}
diff --git a/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp b/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
index 087f2da..b3980c7 100644
--- a/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
+++ b/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
@@ -19,6 +19,7 @@
 #include "JNIHelp.h"
 #include "JniConstants.h"
 #include "LocalArray.h"
+#include "ScopedJavaUnicodeString.h"
 #include "ScopedLocalRef.h"
 #include "ScopedPrimitiveArray.h"
 #include "ScopedUtfChars.h"
@@ -33,10 +34,20 @@
 
 #define BUCKET_COUNT 128
 
+static void throw_OutOfMemoryError(JNIEnv* env) {
+    jniThrowException(env, "java/lang/OutOfMemoryError", "Out of memory.");
+}
+
 /**
  * Wrapper around an interned string.
  */
 struct InternedString {
+    InternedString() : interned(NULL), bytes(NULL) {
+    }
+
+    ~InternedString() {
+        delete[] bytes;
+    }
 
     /** The interned string itself. */
     jstring interned;
@@ -51,7 +62,38 @@
 /**
  * Keeps track of strings between start and end events.
  */
-struct StringStack {
+class StringStack {
+public:
+    StringStack() : array(new jstring[DEFAULT_CAPACITY]), capacity(DEFAULT_CAPACITY), size(0) {
+    }
+
+    ~StringStack() {
+        delete[] array;
+    }
+
+    void push(JNIEnv* env, jstring s) {
+        if (size == capacity) {
+            int newCapacity = capacity * 2;
+            jstring* newArray = new jstring[newCapacity];
+            if (newArray == NULL) {
+                throw_OutOfMemoryError(env);
+                return;
+            }
+            memcpy(newArray, array, capacity * sizeof(jstring));
+
+            array = newArray;
+            capacity = newCapacity;
+        }
+
+        array[size++] = s;
+    }
+
+    jstring pop() {
+        return (size == 0) ? NULL : array[--size];
+    }
+
+private:
+    enum { DEFAULT_CAPACITY = 10 };
 
     jstring* array;
     int capacity;
@@ -62,7 +104,64 @@
  * Data passed to parser handler method by the parser.
  */
 struct ParsingContext {
+    ParsingContext(jobject object) : env(NULL), object(object), buffer(NULL), bufferSize(-1) {
+        for (int i = 0; i < BUCKET_COUNT; i++) {
+            internedStrings[i] = NULL;
+        }
+    }
 
+    // Warning: 'env' must be valid on entry.
+    ~ParsingContext() {
+        freeBuffer();
+
+        // Free interned string cache.
+        for (int i = 0; i < BUCKET_COUNT; i++) {
+            if (internedStrings[i]) {
+                InternedString** bucket = internedStrings[i];
+                InternedString* current;
+                while ((current = *(bucket++)) != NULL) {
+                    // Free the interned string reference.
+                    env->DeleteGlobalRef(current->interned);
+
+                    // Free the bucket.
+                    delete current;
+                }
+
+                // Free the buckets.
+                delete[] internedStrings[i];
+            }
+        }
+    }
+
+    jcharArray ensureCapacity(int length) {
+        if (bufferSize < length) {
+            // Free the existing char[].
+            freeBuffer();
+
+            // Allocate a new char[].
+            jcharArray javaBuffer = env->NewCharArray(length);
+            if (javaBuffer == NULL) return NULL;
+
+            // Create a global reference.
+            javaBuffer = (jcharArray) env->NewGlobalRef(javaBuffer);
+            if (javaBuffer == NULL) return NULL;
+
+            buffer = javaBuffer;
+            bufferSize = length;
+        }
+        return buffer;
+    }
+
+private:
+    void freeBuffer() {
+        if (buffer != NULL) {
+            env->DeleteGlobalRef(buffer);
+            buffer = NULL;
+            bufferSize = -1;
+        }
+    }
+
+public:
     /**
      * The JNI environment for the current thread. This should only be used
      * to keep a reference to the env for use in Expat callbacks.
@@ -75,9 +174,11 @@
     /** Buffer for text events. */
     jcharArray buffer;
 
+private:
     /** The size of our buffer in jchars. */
     int bufferSize;
 
+public:
     /** Current attributes. */
     const char** attributes;
 
@@ -112,13 +213,6 @@
 static jstring emptyString;
 
 /**
- * Throws OutOfMemoryError.
- */
-static void throw_OutOfMemoryError(JNIEnv* env) {
-    jniThrowException(env, "java/lang/OutOfMemoryError", "Out of memory.");
-}
-
-/**
  * Calculates a hash code for a null-terminated string. This is *not* equivalent
  * to Java's String.hashCode(). This hashes the bytes while String.hashCode()
  * hashes UTF-16 chars.
@@ -144,8 +238,7 @@
  * @param hash of bytes
  * @returns wrapper of interned Java string
  */
-static InternedString* newInternedString(JNIEnv* env,
-        ParsingContext* parsingContext, const char* bytes, int hash) {
+static InternedString* newInternedString(JNIEnv* env, const char* bytes, int hash) {
     // Allocate a new wrapper.
     UniquePtr<InternedString> wrapper(new InternedString);
     if (wrapper.get() == NULL) {
@@ -155,12 +248,13 @@
 
     // Create a copy of the UTF-8 bytes.
     // TODO: sometimes we already know the length. Reuse it if so.
-    char* copy = strdup(bytes);
-    wrapper->bytes = copy;
-    if (wrapper->bytes == NULL) {
+    char* copy = new char[strlen(bytes) + 1];
+    if (copy == NULL) {
         throw_OutOfMemoryError(env);
         return NULL;
     }
+    strcpy(copy, bytes);
+    wrapper->bytes = copy;
 
     // Save the hash.
     wrapper->hash = hash;
@@ -169,7 +263,6 @@
     // intern() on it. We then keep a global reference to the interned string.
     ScopedLocalRef<jstring> newString(env, env->NewStringUTF(bytes));
     if (env->ExceptionCheck()) {
-        free(copy);
         return NULL;
     }
 
@@ -177,14 +270,12 @@
     ScopedLocalRef<jstring> interned(env,
             reinterpret_cast<jstring>(env->CallObjectMethod(newString.get(), internMethod)));
     if (env->ExceptionCheck()) {
-        free(copy);
         return NULL;
     }
 
     // Create a global reference to the interned string.
     wrapper->interned = (jstring) env->NewGlobalRef(interned.get());
     if (env->ExceptionCheck()) {
-        free(copy);
         return NULL;
     }
 
@@ -198,12 +289,11 @@
  * @returns a reference to the bucket
  */
 static InternedString** newInternedStringBucket(InternedString* entry) {
-    InternedString** bucket
-        = (InternedString**) malloc(sizeof(InternedString*) * 2);
-    if (bucket == NULL) return NULL;
-
-    bucket[0] = entry;
-    bucket[1] = NULL;
+    InternedString** bucket = new InternedString*[2];
+    if (bucket != NULL) {
+        bucket[0] = entry;
+        bucket[1] = NULL;
+    }
     return bucket;
 }
 
@@ -223,10 +313,10 @@
 
     // Allocate the new bucket with enough space for one more entry and
     // a null terminator.
-    InternedString** newBucket = (InternedString**) realloc(existingBucket,
-            sizeof(InternedString*) * (size + 2));
+    InternedString** newBucket = new InternedString*[size + 2];
     if (newBucket == NULL) return NULL;
 
+    memcpy(newBucket, existingBucket, size * sizeof(InternedString*));
     newBucket[size] = entry;
     newBucket[size + 1] = NULL;
 
@@ -241,8 +331,7 @@
  * @param hash of s
  * @returns interned Java string equivalent of s or null if not found
  */
-static jstring findInternedString(InternedString** bucket, const char* s,
-        int hash) {
+static jstring findInternedString(InternedString** bucket, const char* s, int hash) {
     InternedString* current;
     while ((current = *(bucket++)) != NULL) {
         if (current->hash != hash) continue;
@@ -257,8 +346,7 @@
  * @param s null-terminated string to intern
  * @returns interned Java string equivelent of s or NULL if s is null
  */
-static jstring internString(JNIEnv* env, ParsingContext* parsingContext,
-        const char* s) {
+static jstring internString(JNIEnv* env, ParsingContext* parsingContext, const char* s) {
     if (s == NULL) return NULL;
 
     int hash = hashString(s);
@@ -278,7 +366,7 @@
 
         // We didn't find it. :(
         // Create a new entry.
-        internedString = newInternedString(env, parsingContext, s, hash);
+        internedString = newInternedString(env, s, hash);
         if (internedString == NULL) return NULL;
 
         // Expand the bucket.
@@ -293,7 +381,7 @@
         return internedString->interned;
     } else {
         // We don't even have a bucket yet. Create an entry.
-        internedString = newInternedString(env, parsingContext, s, hash);
+        internedString = newInternedString(env, s, hash);
         if (internedString == NULL) return NULL;
 
         // Create a new bucket with one entry.
@@ -314,70 +402,6 @@
     jniThrowException(env, "org/apache/harmony/xml/ExpatException", message);
 }
 
-static ParsingContext* newParsingContext(JNIEnv* env, jobject object) {
-    ParsingContext* result = (ParsingContext*) malloc(sizeof(ParsingContext));
-    if (result == NULL) {
-        throw_OutOfMemoryError(env);
-        return NULL;
-    }
-
-    result->env = NULL;
-    result->buffer = NULL;
-    result->bufferSize = -1;
-    result->object = object;
-
-    int stackSize = 10;
-    result->stringStack.capacity = stackSize;
-    result->stringStack.size = 0;
-    result->stringStack.array
-            = (jstring*) malloc(stackSize * sizeof(jstring));
-
-    for (int i = 0; i < BUCKET_COUNT; i++) {
-        result->internedStrings[i] = NULL;
-    }
-
-    return result;
-}
-
-/**
- * Frees the char[] buffer if it exists.
- */
-static void freeBuffer(JNIEnv* env, ParsingContext* parsingContext) {
-    if (parsingContext->buffer != NULL) {
-        env->DeleteGlobalRef(parsingContext->buffer);
-        parsingContext->buffer = NULL;
-        parsingContext->bufferSize = -1;
-    }
-}
-
-/**
- * Ensures our buffer is big enough.
- *
- * @param length in jchars
- * @returns a reference to the buffer
- */
-static jcharArray ensureCapacity(ParsingContext* parsingContext, int length) {
-    if (parsingContext->bufferSize < length) {
-        JNIEnv* env = parsingContext->env;
-
-        // Free the existing char[].
-        freeBuffer(env, parsingContext);
-
-        // Allocate a new char[].
-        jcharArray javaBuffer = env->NewCharArray(length);
-        if (javaBuffer == NULL) return NULL;
-
-        // Create a global reference.
-        javaBuffer = (jcharArray) env->NewGlobalRef(javaBuffer);
-        if (javaBuffer == NULL) return NULL;
-
-        parsingContext->buffer = javaBuffer;
-        parsingContext->bufferSize = length;
-    }
-
-    return parsingContext->buffer;
-}
-
 /**
  * Copies UTF-8 characters into the buffer. Returns the number of Java chars
  * which were buffered.
@@ -390,7 +414,7 @@
     JNIEnv* env = parsingContext->env;
 
     // Grow buffer if necessary.
-    jcharArray buffer = ensureCapacity(parsingContext, length);
+    jcharArray buffer = parsingContext->ensureCapacity(length);
     if (buffer == NULL) return -1;
 
     // Decode UTF-8 characters into our buffer.
@@ -409,8 +433,7 @@
  * @param text to copy into the buffer
  * @param length of text to copy (in bytes)
  */
-static void bufferAndInvoke(jmethodID method, void* data, const char* text,
-        size_t length) {
+static void bufferAndInvoke(jmethodID method, void* data, const char* text, size_t length) {
     ParsingContext* parsingContext = (ParsingContext*) data;
     JNIEnv* env = parsingContext->env;
 
@@ -552,42 +575,6 @@
 };
 
 /**
- * Pushes a string onto the stack.
- */
-static void stringStackPush(ParsingContext* parsingContext, jstring s) {
-    StringStack* stringStack = &parsingContext->stringStack;
-
-    // Expand if necessary.
-    if (stringStack->size == stringStack->capacity) {
-        int newCapacity = stringStack->capacity * 2;
-        stringStack->array = (jstring*) realloc(stringStack->array,
-            newCapacity * sizeof(jstring));
-
-        if (stringStack->array == NULL) {
-            throw_OutOfMemoryError(parsingContext->env);
-            return;
-        }
-
-        stringStack->capacity = newCapacity;
-    }
-
-    stringStack->array[stringStack->size++] = s;
-}
-
-/**
- * Pops a string off the stack.
- */
-static jstring stringStackPop(ParsingContext* parsingContext) {
-    StringStack* stringStack = &parsingContext->stringStack;
-
-    if (stringStack->size == 0) {
-        return NULL;
-    }
-
-    return stringStack->array[--stringStack->size];
-}
-
-/**
  * Called by Expat at the start of an element. Delegates to the same method
  * on the Java parser.
  *
@@ -596,8 +583,7 @@
  * @param attributes alternating attribute names and values. Like element
  * names, attribute names follow the format "uri|localName" or "localName".
  */
-static void startElement(void* data, const char* elementName,
-        const char** attributes) {
+static void startElement(void* data, const char* elementName, const char** attributes) {
     ParsingContext* parsingContext = (ParsingContext*) data;
     JNIEnv* env = parsingContext->env;
 
@@ -619,12 +605,11 @@
     jstring localName = parsingContext->processNamespaces ? e.localName() : emptyString;
     jstring qName = e.qName();
 
-    stringStackPush(parsingContext, qName);
-    stringStackPush(parsingContext, uri);
-    stringStackPush(parsingContext, localName);
+    parsingContext->stringStack.push(env, qName);
+    parsingContext->stringStack.push(env, uri);
+    parsingContext->stringStack.push(env, localName);
 
-    env->CallVoidMethod(javaParser, startElementMethod, uri, localName,
-            qName, attributes, count);
+    env->CallVoidMethod(javaParser, startElementMethod, uri, localName, qName, attributes, count);
 
     parsingContext->attributes = NULL;
     parsingContext->attributeCount = -1;
@@ -635,9 +620,10 @@
  * on the Java parser.
  *
  * @param data parsing context
- * @param elementName "uri|localName" or "localName" for the current element
+ * @param elementName "uri|localName" or "localName" for the current element;
+ *         we assume that this matches the last data on our stack.
  */
-static void endElement(void* data, const char* elementName) {
+static void endElement(void* data, const char* /*elementName*/) {
     ParsingContext* parsingContext = (ParsingContext*) data;
     JNIEnv* env = parsingContext->env;
 
@@ -646,9 +632,9 @@
 
     jobject javaParser = parsingContext->object;
 
-    jstring localName = stringStackPop(parsingContext);
-    jstring uri = stringStackPop(parsingContext);
-    jstring qName = stringStackPop(parsingContext);
+    jstring localName = parsingContext->stringStack.pop();
+    jstring uri = parsingContext->stringStack.pop();
+    jstring qName = parsingContext->stringStack.pop();
 
     env->CallVoidMethod(javaParser, endElementMethod, uri, localName, qName);
 }
@@ -703,27 +689,27 @@
         if (env->ExceptionCheck()) return;
     }
 
-    stringStackPush(parsingContext, internedPrefix);
+    parsingContext->stringStack.push(env, internedPrefix);
 
     jobject javaParser = parsingContext->object;
-    env->CallVoidMethod(javaParser, startNamespaceMethod, internedPrefix,
-        internedUri);
+    env->CallVoidMethod(javaParser, startNamespaceMethod, internedPrefix, internedUri);
 }
 
 /**
  * Called by Expat at the end of a namespace mapping.
  *
  * @param data parsing context
- * @param prefix null-terminated namespace prefix used in the XML
+ * @param prefix null-terminated namespace prefix used in the XML;
+ *         we assume this is the same as the last prefix on the stack.
  */
-static void endNamespace(void* data, const char* prefix) {
+static void endNamespace(void* data, const char* /*prefix*/) {
     ParsingContext* parsingContext = (ParsingContext*) data;
     JNIEnv* env = parsingContext->env;
 
     // Bail out if a previously called handler threw an exception.
     if (env->ExceptionCheck()) return;
 
-    jstring internedPrefix = stringStackPop(parsingContext);
+    jstring internedPrefix = parsingContext->stringStack.pop();
 
     jobject javaParser = parsingContext->object;
     env->CallVoidMethod(javaParser, endNamespaceMethod, internedPrefix);
@@ -763,9 +749,10 @@
 
 /**
  * Called by Expat at the beginning of a DOCTYPE section.
+ * Expat gives us 'hasInternalSubset', but the Java API doesn't expect it, so we don't need it.
  */
 static void startDtd(void* data, const char* name,
-        const char* systemId, const char* publicId, int hasInternalSubset) {
+        const char* systemId, const char* publicId, int /*hasInternalSubset*/) {
     ParsingContext* parsingContext = (ParsingContext*) data;
     JNIEnv* env = parsingContext->env;
 
@@ -835,7 +822,7 @@
  * @param javaContext that was provided to handleExternalEntity
  * @returns the pointer to the C Expat entity parser
  */
-static jint createEntityParser(JNIEnv* env, jobject, jint parentParser, jstring javaEncoding, jstring javaContext) {
+static jint createEntityParser(JNIEnv* env, jobject, jint parentParser, jstring javaContext) {
     ScopedUtfChars context(env, javaContext);
     if (context.c_str() == NULL) {
         return 0;
@@ -896,7 +883,10 @@
     return env->ExceptionCheck() ? XML_STATUS_ERROR : XML_STATUS_OK;
 }
 
-static void unparsedEntityDecl(void* data, const char* name, const char* base, const char* systemId, const char* publicId, const char* notationName) {
+/**
+ * Expat gives us 'base', but the Java API doesn't expect it, so we don't need it.
+ */
+static void unparsedEntityDecl(void* data, const char* name, const char* /*base*/, const char* systemId, const char* publicId, const char* notationName) {
     ParsingContext* parsingContext = reinterpret_cast<ParsingContext*>(data);
     jobject javaParser = parsingContext->object;
     JNIEnv* env = parsingContext->env;
@@ -916,7 +906,10 @@
     env->CallVoidMethod(javaParser, unparsedEntityDeclMethod, javaName.get(), javaPublicId.get(), javaSystemId.get(), javaNotationName.get());
 }
 
-static void notationDecl(void* data, const char* name, const char* base, const char* systemId, const char* publicId) {
+/**
+ * Expat gives us 'base', but the Java API doesn't expect it, so we don't need it.
+ */
+static void notationDecl(void* data, const char* name, const char* /*base*/, const char* systemId, const char* publicId) {
     ParsingContext* parsingContext = reinterpret_cast<ParsingContext*>(data);
     jobject javaParser = parsingContext->object;
     JNIEnv* env = parsingContext->env;
@@ -935,38 +928,6 @@
 }
 
 /**
- * Releases the parsing context.
- */
-static void releaseParsingContext(JNIEnv* env, ParsingContext* context) {
-    free(context->stringStack.array);
-
-    freeBuffer(env, context);
-
-    // Free interned string cache.
-    for (int i = 0; i < BUCKET_COUNT; i++) {
-        if (context->internedStrings[i]) {
-            InternedString** bucket = context->internedStrings[i];
-            InternedString* current;
-            while ((current = *(bucket++)) != NULL) {
-                // Free the UTF-8 bytes.
-                free((void*) (current->bytes));
-
-                // Free the interned string reference.
-                env->DeleteGlobalRef(current->interned);
-
-                // Free the bucket.
-                free(current);
-            }
-
-            // Free the buckets.
-            free(context->internedStrings[i]);
-        }
-    }
-
-    free(context);
-}
-
-/**
  * Creates a new Expat parser. Called from the Java ExpatParser constructor.
  *
  * @param object the Java ExpatParser instance
@@ -977,8 +938,9 @@
 static jint initialize(JNIEnv* env, jobject object, jstring javaEncoding,
         jboolean processNamespaces) {
     // Allocate parsing context.
-    ParsingContext* context = newParsingContext(env, object);
-    if (context == NULL) {
+    UniquePtr<ParsingContext> context(new ParsingContext(object));
+    if (context.get() == NULL) {
+        throw_OutOfMemoryError(env);
         return 0;
     }
 
@@ -1012,9 +974,8 @@
         XML_SetNotationDeclHandler(parser, notationDecl);
         XML_SetProcessingInstructionHandler(parser, processingInstruction);
         XML_SetUnparsedEntityDeclHandler(parser, unparsedEntityDecl);
-        XML_SetUserData(parser, context);
+        XML_SetUserData(parser, context.release());
     } else {
-        releaseParsingContext(env, context);
         throw_OutOfMemoryError(env);
         return 0;
     }
@@ -1056,12 +1017,12 @@
     append(env, object, pointer, bytes, byteOffset, byteCount, XML_FALSE);
 }
 
-static void appendString(JNIEnv* env, jobject object, jint pointer, jstring xml, jboolean isFinal) {
-    const jchar* chars = env->GetStringChars(xml, NULL);
-    const char* bytes = reinterpret_cast<const char*>(chars);
-    size_t byteCount = 2 * env->GetStringLength(xml);
+static void appendString(JNIEnv* env, jobject object, jint pointer,
+        jstring javaXml, jboolean isFinal) {
+    ScopedJavaUnicodeString xml(env, javaXml);
+    const char* bytes = reinterpret_cast<const char*>(xml.unicodeString().getBuffer());
+    size_t byteCount = 2 * xml.unicodeString().length();
     append(env, object, pointer, bytes, 0, byteCount, isFinal);
-    env->ReleaseStringChars(xml, chars);
 }
 
 /**
@@ -1085,7 +1046,8 @@
     XML_Parser parser = (XML_Parser) i;
 
     ParsingContext* context = (ParsingContext*) XML_GetUserData(parser);
-    releaseParsingContext(env, context);
+    context->env = env;
+    delete context;
 
     XML_ParserFree(parser);
 }
@@ -1267,8 +1229,14 @@
 /**
  * Clones an array of strings. Uses one contiguous block of memory so as to
  * maximize performance.
+ *
+ * @param address char** to clone
+ * @param count number of attributes
  */
-static char** cloneStrings(const char** source, int count) {
+static jint cloneAttributes(JNIEnv* env, jobject, jint address, jint count) {
+    const char** source = reinterpret_cast<const char**>(static_cast<uintptr_t>(address));
+    count <<= 1;
+
     // Figure out how big the buffer needs to be.
     int arraySize = (count + 1) * sizeof(char*);
     int totalSize = arraySize;
@@ -1279,8 +1247,9 @@
         totalSize += length + 1;
     }
 
-    char* buffer = (char*) malloc(totalSize);
+    char* buffer = new char[totalSize];
     if (buffer == NULL) {
+        throw_OutOfMemoryError(env);
         return NULL;
     }
 
@@ -1288,9 +1257,8 @@
     char** clonedArray = (char**) buffer;
     clonedArray[count] = NULL; // null terminate
 
-    // First string is immediately after.
+    // String data follows immediately after.
     char* destinationString = buffer + arraySize;
-
     for (int i = 0; i < count; i++) {
         const char* sourceString = source[i];
         int stringLength = stringLengths[i];
@@ -1299,25 +1267,14 @@
         destinationString += stringLength + 1;
     }
 
-    return clonedArray;
-}
-
-/**
- * Clones attributes.
- *
- * @param pointer to char** to clone
- * @param count number of attributes
- */
-static jint cloneAttributes(JNIEnv*, jobject,
-        jint pointer, jint count) {
-    return (int) cloneStrings((const char**) pointer, count << 1);
+    return static_cast<jint>(reinterpret_cast<uintptr_t>(buffer));
 }
 
 /**
  * Frees cloned attributes.
  */
 static void freeAttributes(JNIEnv*, jobject, jint pointer) {
-    free((void*) pointer);
+    delete[] reinterpret_cast<char*>(static_cast<uintptr_t>(pointer));
 }
 
 /**
@@ -1395,7 +1352,7 @@
     { "append", "(I[CII)V", (void*) appendCharacters },
     { "append", "(I[BII)V", (void*) appendBytes },
     { "initialize", "(Ljava/lang/String;Z)I", (void*) initialize},
-    { "createEntityParser", "(ILjava/lang/String;Ljava/lang/String;)I", (void*) createEntityParser},
+    { "createEntityParser", "(ILjava/lang/String;)I", (void*) createEntityParser},
     { "staticInitialize", "(Ljava/lang/String;)V", (void*) staticInitialize},
     { "cloneAttributes", "(II)I", (void*) cloneAttributes },
 };
diff --git a/luni/src/main/native/sub.mk b/luni/src/main/native/sub.mk
index 29dc721..12d5f23 100644
--- a/luni/src/main/native/sub.mk
+++ b/luni/src/main/native/sub.mk
@@ -17,6 +17,7 @@
 	NativeRegEx.cpp \
 	NetworkUtilities.cpp \
 	Register.cpp \
+	TimeZones.cpp \
 	UCharacter.cpp \
 	cbigint.cpp \
 	commonDblParce.cpp \
diff --git a/luni/src/test/java/com/ibm/icu4jni/util/ICUTest.java b/luni/src/test/java/com/ibm/icu4jni/util/ICUTest.java
index 0deaa68..c950e0a 100644
--- a/luni/src/test/java/com/ibm/icu4jni/util/ICUTest.java
+++ b/luni/src/test/java/com/ibm/icu4jni/util/ICUTest.java
@@ -40,24 +40,6 @@
         assertNotNull(ICU.getAvailableLocales()[0]);
     }
 
-    public void test_getKnownTimezones() throws Exception {
-        // Check that corrupting our array doesn't affect other callers.
-        assertNotNull(ICU.getKnownTimezones()[0]);
-        ICU.getKnownTimezones()[0] = null;
-        assertNotNull(ICU.getKnownTimezones()[0]);
-    }
-
-    public void test_getDisplayTimeZones() throws Exception {
-        // Check that corrupting our array doesn't affect other callers.
-        assertNotNull(ICU.getDisplayTimeZones(null)[0]);
-        ICU.getDisplayTimeZones(null)[0] = null;
-        assertNotNull(ICU.getDisplayTimeZones(null)[0]);
-        // getDisplayTimezones actually returns a String[][] rather than a String[].
-        assertNotNull(ICU.getDisplayTimeZones(null)[0][0]);
-        ICU.getDisplayTimeZones(null)[0][0] = null;
-        assertNotNull(ICU.getDisplayTimeZones(null)[0][0]);
-    }
-
     public void test_localeFromString() throws Exception {
         // localeFromString is pretty lenient. Some of these can't be round-tripped
         // through Locale.toString.
diff --git a/luni/src/test/java/java/lang/ProcessBuilderTest.java b/luni/src/test/java/java/lang/ProcessBuilderTest.java
index 95657ef..c367067 100644
--- a/luni/src/test/java/java/lang/ProcessBuilderTest.java
+++ b/luni/src/test/java/java/lang/ProcessBuilderTest.java
@@ -16,14 +16,10 @@
 
 package java.lang;
 
+import java.util.HashMap;
+import java.util.Map;
 import static tests.support.Support_Exec.execAndCheckOutput;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import java.io.InputStream;
-import java.util.Arrays;
-
 public class ProcessBuilderTest extends junit.framework.TestCase {
     private static String shell() {
         return "Dalvik".equals(System.getProperty("java.vm.name")) ? "/system/bin/sh" : "/bin/sh";
@@ -43,4 +39,27 @@
     public void test_redirectErrorStream_false() throws Exception {
         testRedirectErrorStream(false, "out\n", "err\n");
     }
+
+    public void testEnvironment() throws Exception {
+        ProcessBuilder pb = new ProcessBuilder(shell(), "-c", "echo $A");
+        pb.environment().put("A", "android");
+        execAndCheckOutput(pb, "android\n", "");
+    }
+
+    public void testEnvironmentMapForbidsNulls() throws Exception {
+        ProcessBuilder pb = new ProcessBuilder(shell(), "-c", "echo $A");
+        Map<String, String> environment = pb.environment();
+        Map<String, String> before = new HashMap<String, String>(environment);
+        try {
+            environment.put("A", null);
+            fail();
+        } catch (NullPointerException expected) {
+        }
+        try {
+            environment.put(null, "android");
+            fail();
+        } catch (NullPointerException expected) {
+        }
+        assertEquals(before, environment);
+    }
 }
diff --git a/luni/src/test/java/java/lang/ReflectionSecurityTest.java b/luni/src/test/java/java/lang/ReflectionSecurityTest.java
new file mode 100644
index 0000000..a43dc67
--- /dev/null
+++ b/luni/src/test/java/java/lang/ReflectionSecurityTest.java
@@ -0,0 +1,216 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.lang;
+
+import java.lang.reflect.Member;
+import java.security.Permission;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class ReflectionSecurityTest extends junit.framework.TestCase {
+    private Enforcer enforcer = new Enforcer();
+
+    private static class Enforcer extends SecurityManager {
+        /** whether to deny the next request */
+        private boolean deny;
+
+        public ArrayList<String> actions = new ArrayList<String>();
+
+        private Enforcer() {
+            deny = false;
+        }
+
+        /**
+         * Deny the next request.
+         */
+        public void denyNext() {
+            deny = true;
+        }
+
+        /**
+         * Throw an exception if the instance had been asked to deny a request.
+         */
+        private void denyIfAppropriate() {
+            if (deny) {
+                deny = false;
+                throw new SecurityException("Denied!");
+            }
+        }
+
+        @Override public void checkPackageAccess(String pkg) {
+            actions.add("checkPackageAccess: " + pkg);
+            denyIfAppropriate();
+            super.checkPackageAccess(pkg);
+        }
+
+        @Override public void checkMemberAccess(Class c, int which) {
+            String member;
+
+            switch (which) {
+            case Member.DECLARED: member = "DECLARED"; break;
+            case Member.PUBLIC:   member = "PUBLIC";   break;
+            default:              member = "<" + which + ">?"; break;
+            }
+
+            actions.add("checkMemberAccess: " + c.getName() + ", " + member);
+            denyIfAppropriate();
+            super.checkMemberAccess(c, which);
+        }
+
+        @Override public void checkPermission(Permission perm) {
+            actions.add("checkPermission: " + perm);
+            denyIfAppropriate();
+            super.checkPermission(perm);
+        }
+
+        @Override public void checkPermission(Permission perm, Object context) {
+            actions.add("checkPermission: " + perm + ", " + context);
+            denyIfAppropriate();
+            super.checkPermission(perm, context);
+        }
+    }
+
+    private static class Blort {
+        private int privateField;
+        /*package*/ int packageField;
+        protected int protectedField;
+        public int publicField;
+
+        private void privateMethod() {
+            // This space intentionally left blank.
+        }
+
+        /*package*/ void packageMethod() {
+            // This space intentionally left blank.
+        }
+
+        protected void protectedMethod() {
+            // This space intentionally left blank.
+        }
+
+        public void publicMethod() {
+            // This space intentionally left blank.
+        }
+    }
+
+    public void testReflectionSecurity() throws Exception {
+        System.setSecurityManager(enforcer);
+
+        Class c = Blort.class;
+
+        /*
+         * Note: We don't use reflection to factor out these tests,
+         * becuase reflection also calls into the SecurityManager, and
+         * we don't want to conflate the calls nor assume too much
+         * in general about what calls reflection will cause.
+         */
+
+        String blortPublic = "checkMemberAccess: java.lang.ReflectionSecurityTest$Blort, PUBLIC";
+        String blortDeclared =
+                "checkMemberAccess: java.lang.ReflectionSecurityTest$Blort, DECLARED";
+        String objectDeclared = "checkMemberAccess: java.lang.Object, DECLARED";
+
+        enforcer.actions.clear();
+        c.getFields();
+        assertEquals(Arrays.asList(blortPublic), enforcer.actions);
+
+        enforcer.denyNext();
+        try {
+            c.getFields();
+            fail();
+        } catch (SecurityException expected) {
+        }
+
+        enforcer.actions.clear();
+        c.getDeclaredFields();
+        assertEquals(Arrays.asList(blortDeclared), enforcer.actions);
+
+        enforcer.denyNext();
+        try {
+            c.getDeclaredFields();
+            fail();
+        } catch (SecurityException expected) {
+        }
+
+        enforcer.actions.clear();
+        c.getMethods();
+        assertEquals(Arrays.asList(blortPublic), enforcer.actions);
+
+        enforcer.denyNext();
+        try {
+            c.getMethods();
+            fail();
+        } catch (SecurityException expected) {
+        }
+
+        enforcer.actions.clear();
+        c.getDeclaredMethods();
+        assertEquals(Arrays.asList(blortDeclared), enforcer.actions);
+
+        enforcer.denyNext();
+        try {
+            c.getDeclaredMethods();
+            fail();
+        } catch (SecurityException expected) {
+        }
+
+        enforcer.actions.clear();
+        c.getConstructors();
+        assertEquals(Arrays.asList(blortPublic), enforcer.actions);
+
+        enforcer.denyNext();
+        try {
+            c.getConstructors();
+            fail();
+        } catch (SecurityException expected) {
+        }
+
+        enforcer.actions.clear();
+        c.getDeclaredConstructors();
+        assertEquals(Arrays.asList(blortDeclared), enforcer.actions);
+
+        enforcer.denyNext();
+        try {
+            c.getDeclaredConstructors();
+            fail();
+        } catch (SecurityException expected) {
+        }
+
+        enforcer.actions.clear();
+        c.getClasses();
+        assertEquals(Arrays.asList(blortPublic, blortDeclared, objectDeclared), enforcer.actions);
+
+        enforcer.denyNext();
+        try {
+            c.getClasses();
+            fail();
+        } catch (SecurityException expected) {
+        }
+
+        enforcer.actions.clear();
+        c.getDeclaredClasses();
+        assertEquals(Arrays.asList(blortDeclared), enforcer.actions);
+
+        enforcer.denyNext();
+        try {
+            c.getDeclaredClasses();
+            fail();
+        } catch (SecurityException expected) {
+        }
+    }
+}
diff --git a/luni/src/test/java/tests/api/java/lang/reflect/GenericReflectionCornerCases.java b/luni/src/test/java/java/lang/reflect/OldGenericReflectionCornerCases.java
similarity index 97%
rename from luni/src/test/java/tests/api/java/lang/reflect/GenericReflectionCornerCases.java
rename to luni/src/test/java/java/lang/reflect/OldGenericReflectionCornerCases.java
index f09d5cf..d26e5ff 100644
--- a/luni/src/test/java/tests/api/java/lang/reflect/GenericReflectionCornerCases.java
+++ b/luni/src/test/java/java/lang/reflect/OldGenericReflectionCornerCases.java
@@ -14,19 +14,14 @@
  * limitations under the License.
  */
 
-package tests.api.java.lang.reflect;
+package java.lang.reflect;
 
 import dalvik.annotation.KnownFailure;
-import dalvik.annotation.TestTargets;
 import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
 import dalvik.annotation.TestTargetClass;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.lang.reflect.WildcardType;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+import tests.api.java.lang.reflect.GenericReflectionTestsBase;
 
 /**
  * Tests generic reflection in more complicated cases. In particular: Scoping of
@@ -34,7 +29,7 @@
  * types and multiple bounds.
  */
 @TestTargetClass(Method.class)
-public class GenericReflectionCornerCases extends GenericReflectionTestsBase {
+public class OldGenericReflectionCornerCases extends GenericReflectionTestsBase {
 
     static class Pair<T, S> {}
 
diff --git a/luni/src/test/java/tests/api/java/lang/reflect/GenericTypesTest.java b/luni/src/test/java/java/lang/reflect/OldGenericTypesTest.java
similarity index 97%
rename from luni/src/test/java/tests/api/java/lang/reflect/GenericTypesTest.java
rename to luni/src/test/java/java/lang/reflect/OldGenericTypesTest.java
index 637e7f3..61111b0 100644
--- a/luni/src/test/java/tests/api/java/lang/reflect/GenericTypesTest.java
+++ b/luni/src/test/java/java/lang/reflect/OldGenericTypesTest.java
@@ -14,26 +14,20 @@
  * limitations under the License.
  */
 
-package tests.api.java.lang.reflect;
+package java.lang.reflect;
 
 import dalvik.annotation.KnownFailure;
-import dalvik.annotation.TestTargets;
 import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
 import dalvik.annotation.TestTargetClass;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
+import dalvik.annotation.TestTargetNew;
+import tests.api.java.lang.reflect.GenericReflectionTestsBase;
 
 
 /**
  * Tests type parameters declared on classes.
  */
 @TestTargetClass(Constructor.class)
-public class GenericTypesTest extends GenericReflectionTestsBase {
+public class OldGenericTypesTest extends GenericReflectionTestsBase {
 
     static class GenericType<T>{
         T methodGenericType(T t){ return t;}
diff --git a/luni/src/test/java/java/math/OldBigDecimalTest.java b/luni/src/test/java/java/math/OldBigDecimalTest.java
new file mode 100644
index 0000000..ab3d79a
--- /dev/null
+++ b/luni/src/test/java/java/math/OldBigDecimalTest.java
@@ -0,0 +1,199 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package java.math;
+
+public class OldBigDecimalTest extends junit.framework.TestCase {
+    BigInteger value = new BigInteger("12345908");
+
+    /**
+     * @tests java.math.BigDecimal#BigDecimal(double)
+     */
+    public void test_ConstructorD() {
+        //
+        // These numbers have an exact representation as doubles:
+        //
+        BigDecimal big = new BigDecimal(123E04);
+        assertTrue(
+                "the BigDecimal value taking a double argument is not initialized properly",
+                big.toString().equals("1230000"));
+        big = new BigDecimal(123.375);
+        assertTrue("init(D) failed for 123.375; became " + big,
+                big.toString().equals("123.375") );
+        big = new BigDecimal(Math.pow(2, -33));
+        assertTrue("init(D) failed for 2^(-33) = 1.16415321826934814453125E-10; became " + big,
+                big.toString().equals("1.16415321826934814453125E-10") );
+        big = new BigDecimal(123456 * Math.pow(2, -33));
+        assertTrue("init(D) failed for 123456 * 2^(-33) = 0.000014372169971466064453125; became " + big,
+                big.toString().equals("0.000014372169971466064453125") );
+        big = new BigDecimal(-123456 * Math.pow(2, -33));
+        assertTrue("init(D) failed for 123456 * 2^(-33) = -0.000014372169971466064453125; became " + big,
+                big.toString().equals("-0.000014372169971466064453125") );
+    }
+
+    /**
+     * @tests java.math.BigDecimal#BigDecimal(java.lang.String)
+     */
+    public void test_constructor_String_plus_exp() {
+        /*
+         * BigDecimal does not support a + sign in the exponent when converting
+         * from a String.
+         *
+         * mc 081106: who says so?!?
+         */
+        BigDecimal bd;
+        bd = new BigDecimal("+23e-0");
+        assertEquals("incorrect value",  "23", bd.toString());
+        bd = new BigDecimal("-23e+0");
+        assertEquals("incorrect value",  "-23", bd.toString());
+    }
+
+    /**
+     * @tests java.math.BigDecimal#setScale(int, java.math.RoundingMode)
+     */
+    public void test_setScaleILjava_math_RoundingMode() {
+        BigDecimal setScale1 = new BigDecimal(2.323E102);
+        BigDecimal setScale2 = setScale1.setScale(4);
+        assertTrue("the number 2.323E102 after setting scale is wrong",
+                setScale2.scale() == 4);
+        assertTrue("the representation of the number 2.323E102 is wrong",
+                setScale2.doubleValue() == 2.323E102);
+
+        setScale1 = new BigDecimal("-1.253E-12");
+        setScale2 = setScale1.setScale(17, RoundingMode.CEILING);
+        assertTrue("the scale of the number -1.253E-12 after setting scale is wrong",
+                setScale2.scale() == 17);
+        assertTrue(
+                "the representation of the number -1.253E-12 after setting scale is wrong, " + setScale2.toString(),
+                setScale2.toString().equals("-1.25300E-12"));
+
+        // testing rounding Mode RoundingMode.CEILING
+        setScale1 = new BigDecimal(value, 4);
+        setScale2 = setScale1.setScale(1, RoundingMode.CEILING);
+        assertTrue(
+                "the number 1234.5908 after setting scale to 1/RoundingMode.CEILING is wrong",
+                setScale2.toString().equals("1234.6") && setScale2.scale() == 1);
+        BigDecimal setNeg = new BigDecimal(value.negate(), 4);
+        setScale2 = setNeg.setScale(1, RoundingMode.CEILING);
+        assertTrue(
+                "the number -1234.5908 after setting scale to 1/RoundingMode.CEILING is wrong",
+                setScale2.toString().equals("-1234.5")
+                        && setScale2.scale() == 1);
+
+        // testing rounding Mode RoundingMode.DOWN
+        setScale2 = setNeg.setScale(1, RoundingMode.DOWN);
+        assertTrue(
+                "the number -1234.5908 after setting scale to 1/RoundingMode.DOWN is wrong",
+                setScale2.toString().equals("-1234.5")
+                        && setScale2.scale() == 1);
+        setScale1 = new BigDecimal(value, 4);
+        setScale2 = setScale1.setScale(1, RoundingMode.DOWN);
+        assertTrue(
+                "the number 1234.5908 after setting scale to 1/RoundingMode.DOWN is wrong",
+                setScale2.toString().equals("1234.5") && setScale2.scale() == 1);
+
+        // testing rounding Mode RoundingMode.FLOOR
+        setScale2 = setScale1.setScale(1, RoundingMode.FLOOR);
+        assertTrue(
+                "the number 1234.5908 after setting scale to 1/RoundingMode.FLOOR is wrong",
+                setScale2.toString().equals("1234.5") && setScale2.scale() == 1);
+        setScale2 = setNeg.setScale(1, RoundingMode.FLOOR);
+        assertTrue(
+                "the number -1234.5908 after setting scale to 1/RoundingMode.FLOOR is wrong",
+                setScale2.toString().equals("-1234.6")
+                        && setScale2.scale() == 1);
+
+        // testing rounding Mode RoundingMode.HALF_DOWN
+        setScale2 = setScale1.setScale(3, RoundingMode.HALF_DOWN);
+        assertTrue(
+                "the number 1234.5908 after setting scale to 3/RoundingMode.HALF_DOWN is wrong",
+                setScale2.toString().equals("1234.591")
+                        && setScale2.scale() == 3);
+        setScale1 = new BigDecimal(new BigInteger("12345000"), 5);
+        setScale2 = setScale1.setScale(1, RoundingMode.HALF_DOWN);
+        assertTrue(
+                "the number 123.45908 after setting scale to 1/RoundingMode.HALF_DOWN is wrong",
+                setScale2.toString().equals("123.4") && setScale2.scale() == 1);
+        setScale2 = new BigDecimal("-1234.5000").setScale(0,
+                RoundingMode.HALF_DOWN);
+        assertTrue(
+                "the number -1234.5908 after setting scale to 0/RoundingMode.HALF_DOWN is wrong",
+                setScale2.toString().equals("-1234") && setScale2.scale() == 0);
+
+        // testing rounding Mode RoundingMode.HALF_EVEN
+        setScale1 = new BigDecimal(1.2345789D);
+        setScale2 = setScale1.setScale(4, RoundingMode.HALF_EVEN);
+        assertTrue(
+                "the number 1.2345789 after setting scale to 4/RoundingMode.HALF_EVEN is wrong",
+                setScale2.doubleValue() == 1.2346D && setScale2.scale() == 4);
+        setNeg = new BigDecimal(-1.2335789D);
+        setScale2 = setNeg.setScale(2, RoundingMode.HALF_EVEN);
+        assertTrue(
+                "the number -1.2335789 after setting scale to 2/RoundingMode.HALF_EVEN is wrong",
+                setScale2.doubleValue() == -1.23D && setScale2.scale() == 2);
+        setScale2 = new BigDecimal("1.2345000").setScale(3,
+                RoundingMode.HALF_EVEN);
+        assertTrue(
+                "the number 1.2345789 after setting scale to 3/RoundingMode.HALF_EVEN is wrong",
+                setScale2.doubleValue() == 1.234D && setScale2.scale() == 3);
+        setScale2 = new BigDecimal("-1.2345000").setScale(3,
+                RoundingMode.HALF_EVEN);
+        assertTrue(
+                "the number -1.2335789 after setting scale to 3/RoundingMode.HALF_EVEN is wrong",
+                setScale2.doubleValue() == -1.234D && setScale2.scale() == 3);
+
+        // testing rounding Mode RoundingMode.HALF_UP
+        setScale1 = new BigDecimal("134567.34650");
+        setScale2 = setScale1.setScale(3, RoundingMode.HALF_UP);
+        assertTrue(
+                "the number 134567.34658 after setting scale to 3/RoundingMode.HALF_UP is wrong",
+                setScale2.toString().equals("134567.347")
+                        && setScale2.scale() == 3);
+        setNeg = new BigDecimal("-1234.4567");
+        setScale2 = setNeg.setScale(0, RoundingMode.HALF_UP);
+        assertTrue(
+                "the number -1234.4567 after setting scale to 0/RoundingMode.HALF_UP is wrong",
+                setScale2.toString().equals("-1234") && setScale2.scale() == 0);
+
+        // testing rounding Mode RoundingMode.UNNECESSARY
+        try {
+            setScale1.setScale(3, RoundingMode.UNNECESSARY);
+            fail("arithmetic Exception not caught for round unnecessary");
+        } catch (ArithmeticException e) {
+        }
+
+        // testing rounding Mode RoundingMode.UP
+        setScale1 = new BigDecimal("100000.374");
+        setScale2 = setScale1.setScale(2, RoundingMode.UP);
+        assertTrue(
+                "the number 100000.374 after setting scale to 2/RoundingMode.UP is wrong",
+                setScale2.toString().equals("100000.38")
+                        && setScale2.scale() == 2);
+        setNeg = new BigDecimal(-134.34589D);
+        setScale2 = setNeg.setScale(2, RoundingMode.UP);
+        assertTrue(
+                "the number -134.34589 after setting scale to 2/RoundingMode.UP is wrong",
+                setScale2.doubleValue() == -134.35D && setScale2.scale() == 2);
+
+        // testing invalid rounding modes
+        try {
+            setScale2 = setScale1.setScale(0, -123);
+            fail("IllegalArgumentException is not caught for wrong rounding mode");
+        } catch (IllegalArgumentException e) {
+        }
+    }
+}
diff --git a/luni/src/test/java/java/net/OldURLClassLoaderTest.java b/luni/src/test/java/java/net/OldURLClassLoaderTest.java
new file mode 100644
index 0000000..7fa137c
--- /dev/null
+++ b/luni/src/test/java/java/net/OldURLClassLoaderTest.java
@@ -0,0 +1,361 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package java.net;
+
+import dalvik.annotation.SideEffect;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.cert.Certificate;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.jar.Manifest;
+import org.apache.harmony.security.tests.support.TestCertUtils;
+import tests.support.Support_Configuration;
+import tests.support.Support_PortManager;
+import tests.support.Support_TestWebData;
+import tests.support.Support_TestWebServer;
+import tests.support.resource.Support_Resources;
+
+@TestTargetClass(
+    value = URLClassLoader.class,
+    untestedMethods = {
+        @TestTargetNew(
+            level = TestLevel.NOT_NECESSARY,
+            notes = "findClass uses defineClass which is not implemented",
+            method = "findClass",
+            args = {java.lang.String.class}
+        )
+    }
+)
+public class OldURLClassLoaderTest extends junit.framework.TestCase {
+
+    URLClassLoader ucl;
+    SecurityManager sm = new SecurityManager() {
+
+        public void checkPermission(Permission perm) {
+        }
+
+        public void checkCreateClassLoader() {
+            throw new SecurityException();
+        }
+    };
+
+    /**
+     * @tests java.net.URLClassLoader#URLClassLoader(java.net.URL[])
+     */
+    public void test_Constructor$Ljava_net_URL() throws MalformedURLException {
+        URL[] u = new URL[0];
+        ucl = new URLClassLoader(u);
+        assertTrue("Failed to set parent", ucl != null
+                && ucl.getParent() == URLClassLoader.getSystemClassLoader());
+
+
+        URL [] urls = {new URL("http://foo.com/foo"),
+                       new URL("jar:file://foo.jar!/foo.c"),
+                       new URL("ftp://foo1/foo2/foo.c")};
+
+        URLClassLoader ucl1 = new URLClassLoader(urls);
+        assertTrue(urls.length == ucl1.getURLs().length);
+
+        try {
+            Class.forName("test", false, ucl);
+            fail("Should throw ClassNotFoundException");
+        } catch (ClassNotFoundException e) {
+            // expected
+        }
+
+        SecurityManager oldSm = System.getSecurityManager();
+        System.setSecurityManager(sm);
+        try {
+            new URLClassLoader(u);
+            fail("SecurityException should be thrown.");
+        } catch (SecurityException e) {
+            // expected
+        } finally {
+            System.setSecurityManager(oldSm);
+        }
+
+        try {
+            new URLClassLoader(new URL[] { null });
+        } catch(Exception e) {
+            fail("Unexpected exception was thrown: " + e.getMessage());
+        }
+    }
+
+    /**
+     * @tests java.net.URLClassLoader#findResources(java.lang.String)
+     */
+    public void test_findResourcesLjava_lang_String() throws Exception {
+        Enumeration<URL> res = null;
+        String[] resValues = { "This is a test resource file.",
+                "This is a resource from a subdir"};
+
+        String tmp = System.getProperty("java.io.tmpdir") + "/";
+
+        File tmpDir = new File(tmp);
+        File test1 = new File(tmp + "test0");
+        test1.deleteOnExit();
+        FileOutputStream out = new FileOutputStream(test1);
+        out.write(resValues[0].getBytes());
+        out.flush();
+        out.close();
+
+        File subDir = new File(tmp + "subdir/");
+        subDir.mkdir();
+        File test2 = new File(tmp + "subdir/test0");
+        test2.deleteOnExit();
+        out = new FileOutputStream(test2);
+        out.write(resValues[1].getBytes());
+        out.flush();
+        out.close();
+
+        URL[] urls = new URL[2];
+        urls[0] = new URL("file://" + tmpDir.getAbsolutePath() + "/");
+        urls[1] = new URL("file://" + subDir.getAbsolutePath() + "/");
+
+        ucl = new URLClassLoader(urls);
+        res = ucl.findResources("test0");
+        assertNotNull("Failed to locate resources", res);
+
+        int i = 0;
+        while (res.hasMoreElements()) {
+            StringBuffer sb = getResContent(res.nextElement());
+            assertEquals("Returned incorrect resource/or in wrong order",
+                    resValues[i++], sb.toString());
+        }
+        assertEquals("Incorrect number of resources returned", 2, i);
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "",
+        method = "addURL",
+        args = { URL.class }
+    )
+    public void test_addURLLjava_net_URL() throws MalformedURLException {
+        URL[] u = new URL[0];
+
+        URL [] urls = {new URL("http://foo.com/foo"),
+                       new URL("jar:file://foo.jar!/foo.c"),
+                       new URL("ftp://foo1/foo2/foo.c"), null};
+
+        TestURLClassLoader tucl = new TestURLClassLoader(u);
+
+        for(int i = 0; i < urls.length;) {
+            tucl.addURL(urls[i]);
+            i++;
+            URL [] result = tucl.getURLs();
+            assertEquals("Result array length is incorrect: " + i,
+                                                            i, result.length);
+            for(int j = 0; j < result.length; j++) {
+                assertEquals("Result array item is incorrect: " + j,
+                                                            urls[j], result[j]);
+            }
+        }
+    }
+
+    public void test_getPermissions() throws MalformedURLException {
+        URL url = new URL("http://" + Support_Configuration.SpecialInetTestAddress);
+        Certificate[] chain = TestCertUtils.getCertChain();
+        CodeSource cs = new CodeSource(url, chain);
+        TestURLClassLoader cl = new TestURLClassLoader(new URL[] {url});
+        PermissionCollection permCol = cl.getPermissions(cs);
+        assertNotNull(permCol);
+
+        URL url1 = new URL("file://foo/foo.c");
+        TestURLClassLoader cl1 = new TestURLClassLoader(new URL[] {url});
+        CodeSource cs1 = new CodeSource(url1, chain);
+        PermissionCollection permCol1 = cl1.getPermissions(cs1);
+        assertNotNull(permCol1);
+    }
+
+    public void test_definePackage() throws MalformedURLException {
+        Manifest manifest = new Manifest();
+        URL[] u = new URL[0];
+        TestURLClassLoader tucl = new TestURLClassLoader(u);
+
+        URL [] urls = {new URL("http://foo.com/foo"),
+                new URL("jar:file://foo.jar!/foo.c"),
+                new URL("ftp://foo1/foo2/foo.c"),
+                new URL("file://new/package/name/"),
+                null};
+
+        String packageName = "new.package.name";
+
+        for(int i = 0; i < urls.length; i++) {
+            Package pack = tucl.definePackage(packageName + i, manifest, urls[i]);
+            assertEquals(packageName + i, pack.getName());
+            assertNull("Implementation Title is not null",
+                    pack.getImplementationTitle());
+            assertNull("Implementation Vendor is not null",
+                    pack.getImplementationVendor());
+            assertNull("Implementation Version is not null.",
+                    pack.getImplementationVersion());
+        }
+
+        try {
+            tucl.definePackage(packageName + "0", manifest, null);
+            fail("IllegalArgumentException was not thrown.");
+        } catch(IllegalArgumentException iae) {
+            //expected
+        }
+    }
+
+    class TestURLClassLoader extends URLClassLoader {
+        public TestURLClassLoader(URL[] urls) {
+            super(urls);
+        }
+
+        public void addURL(URL url) {
+            super.addURL(url);
+        }
+
+        public Package definePackage(String name,
+                                     Manifest man,
+                                     URL url)
+                                     throws IllegalArgumentException {
+            return super.definePackage(name, man, url);
+        }
+
+        public Class<?> findClass(String name)
+                                        throws ClassNotFoundException {
+            return super.findClass(name);
+        }
+
+        protected PermissionCollection getPermissions(CodeSource codesource) {
+            return super.getPermissions(codesource);
+        }
+    }
+
+    /**
+     * @tests java.net.URLClassLoader#findResource(java.lang.String)
+     */
+    @TestTargetNew(
+        level = TestLevel.PARTIAL_COMPLETE,
+        notes = "",
+        method = "findResource",
+        args = {java.lang.String.class}
+    )
+    @SideEffect("Support_TestWebServer requires isolation.")
+    public void test_findResourceLjava_lang_String() throws Exception {
+        int port = Support_PortManager.getNextPort();
+        File tmp = File.createTempFile("test", ".txt");
+
+        Support_TestWebServer server = new Support_TestWebServer();
+        try {
+
+            server.initServer(port, tmp.getAbsolutePath(), "text/html");
+
+            URL[] urls = { new URL("http://localhost:" + port + "/") };
+            ucl = new URLClassLoader(urls);
+            URL res = ucl.findResource("test1");
+            assertNotNull("Failed to locate resource", res);
+
+            StringBuffer sb = getResContent(res);
+            assertEquals("Returned incorrect resource", new String(Support_TestWebData.test1),
+                    sb.toString());
+        } finally {
+            server.close();
+        }
+    }
+
+    /**
+     * Regression for Harmony-2237
+     */
+    @TestTargetNew(
+        level = TestLevel.PARTIAL_COMPLETE,
+        notes = "Regression test",
+        method = "findResource",
+        args = {java.lang.String.class}
+    )
+    @SideEffect("Support_TestWebServer requires isolation.")
+    public void test_findResource_String() throws Exception {
+        File tempFile1 = File.createTempFile("textFile", ".txt");
+        tempFile1.createNewFile();
+        tempFile1.deleteOnExit();
+        File tempFile2 = File.createTempFile("jarFile", ".jar");
+        tempFile2.delete();
+        tempFile2.deleteOnExit();
+
+        Support_TestWebServer server = new Support_TestWebServer();
+        int port = Support_PortManager.getNextPort();
+        try {
+            server.initServer(port, false);
+
+            String tempPath1 = tempFile1.getParentFile().getAbsolutePath() + "/";
+            InputStream is = getClass().getResourceAsStream(
+                    "/tests/resources/hyts_patch.jar");
+            Support_Resources.copyLocalFileto(tempFile2, is);
+            String tempPath2 = tempFile2.getAbsolutePath();
+            String tempPath3 = "http://localhost:" + port + "/";
+            URLClassLoader urlLoader = getURLClassLoader(tempPath1, tempPath2);
+            assertNull("Found inexistant resource",
+                    urlLoader.findResource("XXX"));
+            assertNotNull("Couldn't find resource from directory",
+                    urlLoader.findResource(tempFile1.getName()));
+            assertNotNull("Couldn't find resource from jar",
+                    urlLoader.findResource("Blah.txt"));
+            urlLoader = getURLClassLoader(tempPath1, tempPath2, tempPath3);
+            assertNotNull("Couldn't find resource from web",
+                    urlLoader.findResource("test1"));
+            assertNull("Found inexistant resource from web",
+                    urlLoader.findResource("test3"));
+        } finally {
+            server.close();
+        }
+    }
+
+    private static URLClassLoader getURLClassLoader(String... classPath)
+            throws MalformedURLException {
+        List<URL> urlList = new ArrayList<URL>();
+        for (String path : classPath) {
+            String url;
+            File f = new File(path);
+            if (f.isDirectory()) {
+                url = "file:" + path;
+            } else if (path.startsWith("http")) {
+                url = path;
+            } else {
+                url = "jar:file:" + path + "!/";
+            }
+            urlList.add(new URL(url));
+        }
+        return new URLClassLoader(urlList.toArray(new URL[urlList.size()]));
+    }
+
+    private StringBuffer getResContent(URL res) throws IOException {
+        StringBuffer sb = new StringBuffer();
+        InputStream is = res.openStream();
+
+        int c;
+        while ((c = is.read()) != -1) {
+            sb.append((char) c);
+        }
+        is.close();
+        return sb;
+    }
+}
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/net/URLTest.java b/luni/src/test/java/java/net/OldURLTest.java
similarity index 85%
rename from luni/src/test/java/org/apache/harmony/luni/tests/java/net/URLTest.java
rename to luni/src/test/java/java/net/OldURLTest.java
index 9edeac5..8863429 100644
--- a/luni/src/test/java/org/apache/harmony/luni/tests/java/net/URLTest.java
+++ b/luni/src/test/java/java/net/OldURLTest.java
@@ -14,21 +14,12 @@
  * limitations under the License.
  */
 
-package org.apache.harmony.luni.tests.java.net;
+package java.net;
 
 import dalvik.annotation.BrokenTest;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargets;
 import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
 import dalvik.annotation.TestTargetNew;
-
-import junit.framework.TestCase;
-
-import tests.support.Support_Configuration;
-import tests.support.Support_PortManager;
-import tests.support.resource.Support_Resources;
-import tests.util.TestEnvironment;
-
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.File;
@@ -38,27 +29,17 @@
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.lang.reflect.Field;
-import java.net.HttpURLConnection;
-import java.net.InetSocketAddress;
-import java.net.MalformedURLException;
-import java.net.Proxy;
-import java.net.ProxySelector;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.SocketAddress;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-import java.net.URLStreamHandlerFactory;
 import java.security.Permission;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import junit.framework.TestCase;
+import tests.support.Support_Configuration;
+import tests.support.resource.Support_Resources;
+import tests.util.TestEnvironment;
 
 @TestTargetClass(URL.class)
-public class URLTest extends TestCase {
+public class OldURLTest extends TestCase {
 
     private static final String helloWorldString = "Hello World";
 
@@ -73,22 +54,6 @@
     }
 
     /**
-     * @tests java.net.URL#getHost()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "Regression test.",
-        method = "getHost",
-        args = {}
-    )
-    public void test_getHost() throws MalformedURLException {
-        // Regression for HARMONY-60
-        String ipv6Host = "FEDC:BA98:7654:3210:FEDC:BA98:7654:3210";
-        URL url = new URL("http", ipv6Host, -1, "myfile");
-        assertEquals(("[" + ipv6Host + "]"), url.getHost());
-    }
-
-    /**
      * @tests java.net.URL#URL(java.lang.String, java.lang.String, int, java.lang.String)
      */
     @TestTargetNew(
@@ -315,19 +280,6 @@
     }
 
     /**
-     * Test method for {@link java.net.URL#set(java.lang.String, java.lang.String, int, java.lang.String, java.lang.String)}.
-     */
-    @TestTargetNew(
-        level = TestLevel.NOT_FEASIBLE,
-        notes = "final class protected method",
-        method = "set",
-        args = {java.lang.String.class, java.lang.String.class, int.class, java.lang.String.class, java.lang.String.class}
-    )
-    public void testSetStringStringIntStringString() {
-
-    }
-
-    /**
      * Test method for {@link java.net.URL#equals(java.lang.Object)}.
      */
     @TestTargetNew(
@@ -585,88 +537,6 @@
     }
 
     /**
-     * Test method for {@link java.net.URL#openConnection(java.net.Proxy)}.
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "See ExcludedProxyTest.",
-        method = "openConnection",
-        args = {java.net.Proxy.class}
-    )
-    @BrokenTest("the host address isn't working anymore")
-    public void testOpenConnectionProxy() throws IOException {
-
-        // create Proxy
-
-        System.setProperty("http.proxyHost",
-                Support_Configuration.ProxyServerTestHost);
-        System.setProperty("http.proxyPort", "80");
-
-        URL u2 = new URL("http://"
-                + Support_Configuration.ProxyServerTestHost
-                + "/cgi-bin/test.pl");
-
-        SocketAddress addr1 = new InetSocketAddress(Support_Configuration.ProxyServerTestHost, 80);
-        Proxy proxy1 = new Proxy(Proxy.Type.HTTP, addr1);
-
-        // create test input
-        String posted = "just a test";
-
-        // perform test
-        java.net.HttpURLConnection conn = (java.net.HttpURLConnection) u2
-                .openConnection(proxy1);
-        conn.setDoOutput(true);
-        conn.setRequestMethod("POST");
-        conn.setConnectTimeout(3000);
-
-        OutputStream out = conn.getOutputStream();
-        out.write(posted.getBytes());
-        out.close();
-
-
-        /*
-        InputStream in = conn.getErrorStream();
-        if (in != null ){
-        BufferedReader r = new BufferedReader(new InputStreamReader(in), 200);
-        String line;
-        while((line = r.readLine())!= null) {
-            System.err.println(line);
-        }
-        }
-        */
-
-        conn.getResponseCode();
-        InputStream is = conn.getInputStream();
-        String response = "";
-        byte[] b = new byte[1024];
-        int count = 0;
-        while ((count = is.read(b)) > 0) {
-            response += new String(b, 0, count);
-        }
-        assertTrue("Response to POST method invalid", response
-                .equals(posted));
-
-        // Exception test
-        URL httpUrl = new URL("http://abc.com");
-        URL jarUrl = new URL("jar:"
-                 + Support_Resources.getResourceURL("/JUC/lf.jar!/plus.bmp"));
-        URL ftpUrl = new URL("ftp://" + Support_Configuration.FTPTestAddress
-                + "/nettest.txt");
-        URL fileUrl = new URL("file://abc");
-        URL[] urlList = { httpUrl, jarUrl, ftpUrl, fileUrl };
-        for (int i = 0; i < urlList.length; ++i) {
-            try {
-                urlList[i].openConnection(null);
-            } catch (IllegalArgumentException iae) {
-                // expected
-            }
-        }
-        // should not throw exception too
-        fileUrl.openConnection(Proxy.NO_PROXY);
-
-    }
-
-    /**
      * Test method for {@link java.net.URL#toString()}.
      */
     @TestTargetNew(
@@ -877,19 +747,6 @@
     }
 
     /**
-     * Test method for {@link java.net.URL#set(java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)}.
-     */
-    @TestTargetNew(
-        level = TestLevel.NOT_FEASIBLE,
-        notes = "final class protected method",
-        method = "set",
-        args = {java.lang.String.class, java.lang.String.class, int.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class}
-    )
-    public void testSetStringStringIntStringStringStringStringString() {
-
-    }
-
-    /**
      * Test method for {@link java.net.URL#getDefaultPort()}.
      */
     @TestTargetNew(
@@ -1065,29 +922,10 @@
         assertTrue("SSISH2 returns a wrong anchor: " + u.getRef(), u.getRef()
                 .equals("foo"));
 
-        byte[] ba;
-        InputStream is;
-        String s;
-
-        // Cannot make this test fail if no exception is thrown: Debatable
-        /*
-        try {
-            u = new URL("http", "www.yahoo.com", 8080, "test.html#foo",
-                    null);
-            fail("No error occurred");
-        } catch (MalformedURLException e) {
-            // ok
-        } catch (NullPointerException e) {
-            // ok
-        }
-        */
-
         TestURLStreamHandler lh = new TestURLStreamHandler();
-
         u = new URL("http", "www.yahoo.com", 8080, "test.html#foo",
                 lh);
 
-
         try {
             new URL(null, "1", 0, "file", lh);
             fail("Exception expected, but nothing was thrown!");
@@ -1242,49 +1080,4 @@
         url = new URL(strURL);
         assertEquals(strURL, url.toExternalForm());
     }
-
-
-    ServerSocket ss;
-
-    Socket s;
-
-    Thread t;
-
-
-
-    protected void startServer(String name, int port) {
-        try {
-            ss = new ServerSocket(port, 5);
-        } catch (IOException e) {
-            fail(name + ": " + e);
-        }
-    }
-
-    class SServer extends Thread implements Runnable {
-        Socket s1 = null;
-
-        public void run() {
-            try {
-                ss.setSoTimeout(5000);
-                s1 = ss.accept();
-                ss.close();
-                Thread.sleep(4000);
-            } catch (java.io.InterruptedIOException x) {
-                System.out.println(Thread.currentThread()
-                        + ", accept() timeout fired: " + x);
-            } catch (InterruptedException x) {
-            } catch (Exception e) {
-                System.out.println("Unable to accept: " + e.toString());
-            } finally {
-                try {
-                    if (s1 != null)
-                        s1.close();
-                } catch (java.io.IOException e) {
-                }
-            }
-        }
-    }
-
-
-
 }
diff --git a/luni/src/test/java/java/nio/channels/OldServerSocketChannelTest.java b/luni/src/test/java/java/nio/channels/OldServerSocketChannelTest.java
new file mode 100644
index 0000000..e24a604
--- /dev/null
+++ b/luni/src/test/java/java/nio/channels/OldServerSocketChannelTest.java
@@ -0,0 +1,140 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package java.nio.channels;
+
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.nio.channels.spi.SelectorProvider;
+import junit.framework.TestCase;
+import tests.support.Support_PortManager;
+
+/*
+ * test for ServerSocketChannel
+ */
+@TestTargetClass(ServerSocketChannel.class)
+public class OldServerSocketChannelTest extends TestCase {
+
+    private static final int TIME_UNIT = 200;
+
+    private InetSocketAddress localAddr1;
+
+    private ServerSocketChannel serverChannel;
+
+    private SocketChannel clientChannel;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        this.localAddr1 = new InetSocketAddress(
+                "127.0.0.1", Support_PortManager
+                        .getNextPort());
+        this.serverChannel = ServerSocketChannel.open();
+        this.clientChannel = SocketChannel.open();
+    }
+
+    protected void tearDown() throws Exception {
+        if (null != this.serverChannel) {
+            try {
+                this.serverChannel.close();
+            } catch (Exception e) {
+                //ignore
+            }
+
+        }
+        if (null != this.clientChannel) {
+            try {
+                this.clientChannel.close();
+            } catch (Exception e) {
+                //ignore
+            }
+        }
+        super.tearDown();
+    }
+
+    // -------------------------------------------------------------------
+    // Test for methods in abstract class.
+    // -------------------------------------------------------------------
+    /*
+     * Test method for 'java.nio.channels.ServerSocketChannel()'
+     */
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "",
+        method = "ServerSocketChannel",
+        args = {java.nio.channels.spi.SelectorProvider.class}
+    )
+    public void testConstructor() throws IOException {
+        ServerSocketChannel channel =
+                SelectorProvider.provider().openServerSocketChannel();
+        assertNotNull(channel);
+        assertSame(SelectorProvider.provider(),channel.provider());
+    }
+
+    @TestTargetNew(
+        level = TestLevel.PARTIAL_COMPLETE,
+        notes = "",
+        method = "isOpen",
+        args = {}
+    )
+    public void testIsOpen() throws Exception {
+        assertTrue(this.serverChannel.isOpen());
+        this.serverChannel.close();
+        assertFalse(this.serverChannel.isOpen());
+    }
+
+    @TestTargetNew(
+        level = TestLevel.PARTIAL_COMPLETE,
+        notes = "Verifies ClosedByInterruptException.",
+        method = "accept",
+        args = {}
+    )
+    public void test_accept_Block_NoConnect_interrupt() throws IOException {
+        assertTrue(this.serverChannel.isBlocking());
+        ServerSocket gotSocket = this.serverChannel.socket();
+        gotSocket.bind(localAddr1);
+
+        class MyThread extends Thread {
+            public String errMsg = null;
+            public void run() {
+                try {
+                    serverChannel.accept();
+                    errMsg = "should throw ClosedByInterruptException";
+                } catch (ClosedByInterruptException e) {
+                    // expected
+                } catch (Exception e) {
+                    errMsg = "caught wrong Exception: " + e.getClass() + ": " +
+                            e.getMessage();
+                }
+            }
+        }
+        MyThread thread = new MyThread();
+        thread.start();
+        try {
+            Thread.currentThread().sleep(TIME_UNIT);
+            thread.interrupt();
+        } catch (InterruptedException e) {
+            fail("Should not throw a InterruptedException");
+        }
+        if (thread.errMsg != null) {
+            fail(thread.errMsg);
+        }
+    }
+}
diff --git a/luni/src/test/java/java/nio/channels/OldSocketChannelTest.java b/luni/src/test/java/java/nio/channels/OldSocketChannelTest.java
new file mode 100644
index 0000000..d692062
--- /dev/null
+++ b/luni/src/test/java/java/nio/channels/OldSocketChannelTest.java
@@ -0,0 +1,449 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package java.nio.channels;
+
+import dalvik.annotation.BrokenTest;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.net.SocketException;
+import java.nio.ByteBuffer;
+import java.nio.channels.spi.SelectorProvider;
+import junit.framework.TestCase;
+import tests.support.Support_PortManager;
+
+@TestTargetClass(SocketChannel.class)
+/**
+ * Tests for SocketChannel and its default implementation.
+ */
+public class OldSocketChannelTest extends TestCase {
+
+    private static final int CAPACITY_NORMAL = 200;
+
+    private static final int CAPACITY_HUGE = 512 * 1024;
+
+    private InetSocketAddress localAddr1;
+
+    private SocketChannel channel1;
+
+    private SocketChannel channel2;
+
+    private ServerSocket server1;
+
+    private final static int TIMEOUT = 60000;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        this.localAddr1 = new InetSocketAddress("127.0.0.1",
+                Support_PortManager.getNextPort());
+        this.channel1 = SocketChannel.open();
+        this.channel2 = SocketChannel.open();
+        this.server1 = new ServerSocket(localAddr1.getPort());
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        if (null != this.channel1) {
+            try {
+                this.channel1.close();
+            } catch (Exception e) {
+                // ignore
+            }
+        }
+        if (null != this.channel2) {
+            try {
+                this.channel2.close();
+            } catch (Exception e) {
+                // ignore
+            }
+        }
+        if (null != this.server1) {
+            try {
+                this.server1.close();
+            } catch (Exception e) {
+                // ignore
+            }
+        }
+    }
+
+    // -------------------------------------------------------------------
+    // Test for methods in abstract class.
+    // -------------------------------------------------------------------
+    public void testConstructor() throws IOException {
+        SocketChannel channel =
+                SelectorProvider.provider().openSocketChannel();
+        assertNotNull(channel);
+        assertSame(SelectorProvider.provider(), channel.provider());
+        channel = SocketChannel.open();
+        assertNotNull(channel);
+        assertSame(SelectorProvider.provider(), channel.provider());
+        MockSocketChannel chan = new MockSocketChannel(
+                SelectorProvider.provider());
+        assertTrue(chan.isConstructorCalled);
+    }
+
+    public void testValidOps() {
+        MockSocketChannel testMSChannel = new MockSocketChannel(null);
+        assertEquals(13, this.channel1.validOps());
+        assertEquals(13, testMSChannel.validOps());
+    }
+
+    public void testOpen() throws IOException {
+        java.nio.ByteBuffer[] buf = new java.nio.ByteBuffer[1];
+        buf[0] = java.nio.ByteBuffer.allocateDirect(CAPACITY_NORMAL);
+        MockSocketChannel testMSChannel = new MockSocketChannel(null);
+        MockSocketChannel testMSChannelnotnull = new MockSocketChannel(
+                SelectorProvider.provider());
+        SocketChannel testSChannel = MockSocketChannel.open();
+        assertTrue(testSChannel.isOpen());
+        assertNull(testMSChannel.provider());
+        assertNotNull(testSChannel.provider());
+        assertEquals(SelectorProvider.provider(), testSChannel.provider());
+        assertNotNull(testMSChannelnotnull.provider());
+        assertEquals(this.channel1.provider(), testMSChannelnotnull.provider());
+        try {
+            this.channel1.write(buf);
+            fail("Should throw NotYetConnectedException");
+        } catch (NotYetConnectedException e) {
+            // correct
+        }
+    }
+
+    public void testIsOpen() throws Exception {
+        assertTrue(this.channel1.isOpen());
+        this.channel1.close();
+        assertFalse(this.channel1.isOpen());
+    }
+
+    public void testIsConnected() throws Exception {
+        assertFalse(this.channel1.isConnected());// not connected
+        this.channel1.configureBlocking(false);
+        assertFalse(this.channel1.connect(localAddr1));
+        assertFalse(this.channel1.isConnected());
+        assertTrue(this.channel1.isConnectionPending());
+        assertTrue(tryFinish());
+        assertTrue(this.channel1.isConnected());
+        this.channel1.close();
+        assertFalse(this.channel1.isConnected());
+    }
+
+    public void testIsConnectionPending() throws Exception {
+        // ensure
+        ensureServerClosed();
+        this.channel1.configureBlocking(false);
+        assertFalse(this.channel1.isConnectionPending());
+        // finish
+        try {
+            this.channel1.finishConnect();
+            fail("Should throw NoConnectionPendingException");
+        } catch (NoConnectionPendingException e) {
+            // OK.
+        }
+        assertFalse(this.channel1.isConnectionPending());
+        // connect
+        assertFalse(this.channel1.connect(localAddr1));
+        assertTrue(this.channel1.isConnectionPending());
+        this.channel1.close();
+
+        assertFalse(this.channel1.isConnectionPending());
+    }
+
+    public void testChannelBasicStatus() {
+        Socket gotSocket = this.channel1.socket();
+        assertFalse(gotSocket.isClosed());
+        assertTrue(this.channel1.isBlocking());
+        assertFalse(this.channel1.isRegistered());
+        assertEquals((SelectionKey.OP_CONNECT | SelectionKey.OP_READ |
+                SelectionKey.OP_WRITE), this.channel1.validOps());
+        assertEquals(SelectorProvider.provider(), this.channel1.provider());
+    }
+
+    public void testOpenSocketAddress() throws IOException {
+        this.channel1 = SocketChannel.open(localAddr1);
+        assertTrue(this.channel1.isConnected());
+
+        SocketAddress newTypeAddress = new SubSocketAddress();
+        try {
+            this.channel1 = SocketChannel.open(newTypeAddress);
+            fail("Should throw UnexpectedAddressTypeException");
+        } catch (UnsupportedAddressTypeException e) {
+            // expected
+        }
+
+        SocketAddress unresolvedAddress =
+                InetSocketAddress.createUnresolved("127.0.0.1", 8080);
+        try {
+            this.channel1 = SocketChannel.open(unresolvedAddress);
+            fail("Should throw UnresolvedAddressException");
+        } catch (UnresolvedAddressException e) {
+            // expected
+        }
+
+        SocketChannel channel1IP = null;
+        try {
+            channel1IP = SocketChannel.open(null);
+            fail("Should throw an IllegalArgumentException");
+        } catch (IllegalArgumentException e) {
+            // correct
+        }
+        assertNull(channel1IP);
+    }
+
+    private void ensureServerClosed() throws IOException {
+        if (null != this.server1) {
+            this.server1.close();
+            assertTrue(this.server1.isClosed());
+        }
+    }
+
+    private void statusConnected_NotPending() {
+        assertTrue(this.channel1.isConnected());
+        assertFalse(this.channel1.isConnectionPending());
+        assertTrue(this.channel1.isOpen());
+    }
+
+    private boolean tryFinish() throws IOException {
+        /*
+         * the result of finish will be asserted in multi-thread tests.
+         */
+        boolean connected = false;
+        assertTrue(this.channel1.isOpen());
+        try {
+            connected = this.channel1.finishConnect();
+        } catch (SocketException e) {
+            // Finish connection failed, probably due to reset by peer error.
+        }
+        if (connected) {
+            statusConnected_NotPending();
+        }
+        return connected;
+    }
+
+    /**
+     * @tests java.nio.channels.SocketChannel#read(ByteBuffer)
+     */
+    @TestTargetNew(
+        level = TestLevel.PARTIAL_COMPLETE,
+        notes = "",
+        method = "write",
+        args = {java.nio.ByteBuffer.class}
+    )
+    @BrokenTest("Occasionally fail in CTS, but works in CoreTestRunner")
+    public void test_writeLjava_nio_ByteBuffer_Nonblocking_HugeData() throws IOException {
+        // initialize write content
+        ByteBuffer writeContent = ByteBuffer.allocate(CAPACITY_HUGE);
+        for (int i = 0; i < CAPACITY_HUGE; i++) {
+            writeContent.put((byte) i);
+        }
+        writeContent.flip();
+
+        // establish connection
+        channel1.connect(localAddr1);
+        Socket acceptedSocket = server1.accept();
+
+        channel1.configureBlocking(false);
+        int writtenTotalCount = 0;
+        int writtenCount = 1;
+        long startTime = System.currentTimeMillis();
+        // use SocketChannel.write(ByteBuffer) to try to write CAPACITY_HUGE bytes
+        while (writtenTotalCount < CAPACITY_HUGE && writtenCount > 0) {
+            writtenCount = channel1.write(writeContent);
+            if (writtenCount == 0 && writtenTotalCount < CAPACITY_HUGE) {
+                assertEquals(0, channel1.write(writeContent));
+                break;
+            }
+            writtenTotalCount += writtenCount;
+            // if the channel could not finish writing in TIMEOUT ms, the
+            // test fails. It is used to guarantee the test never hangs even
+            // if there are bugs of SocketChannel implementation.
+            assertTimeout(startTime, TIMEOUT);
+        }
+    }
+
+    /*
+     * Fails if the difference between current time and start time is greater
+     * than timeout.
+     */
+    private void assertTimeout(long startTime, long timeout) {
+        long currentTime = System.currentTimeMillis();
+        if ((currentTime - startTime) > timeout) {
+            fail("Timeout");
+        }
+    }
+
+    /**
+     * @throws IOException
+     * @tests java.nio.channels.SocketChannel#read(ByteBuffer)
+     */
+    @TestTargetNew(
+        level = TestLevel.PARTIAL_COMPLETE,
+        notes = "",
+        method = "read",
+        args = {java.nio.ByteBuffer[].class}
+    )
+    public void test_socketChannel_read_DirectByteBuffer() throws InterruptedException, IOException {
+
+        ServerThread server = new ServerThread();
+        server.start();
+        Thread.currentThread().sleep(1000);
+
+        InetSocketAddress address = new InetSocketAddress(InetAddress
+                .getByName("localhost"), port);
+
+        // First test with array based byte buffer
+        SocketChannel sc = SocketChannel.open();
+        sc.connect(address);
+
+        ByteBuffer buf = ByteBuffer.allocate(data.length);
+        buf.limit(data.length / 2);
+        sc.read(buf);
+
+        buf.limit(buf.capacity());
+        sc.read(buf);
+        sc.close();
+
+        // Make sure the buffer is filled correctly
+        buf.rewind();
+        assertSameContent(data, buf);
+
+        // Now test with direct byte buffer
+        sc = SocketChannel.open();
+        sc.connect(address);
+
+        buf = ByteBuffer.allocateDirect(data.length);
+        buf.limit(data.length / 2);
+        sc.read(buf);
+
+        buf.limit(buf.capacity());
+        sc.read(buf);
+        sc.close();
+
+        // Make sure the buffer is filled correctly
+        buf.rewind();
+        assertSameContent(data, buf);
+    }
+
+    private void assertSameContent(byte[] data, ByteBuffer buf) {
+        for (byte b : data) {
+            if (b != buf.get()) {
+                int pos = buf.position() - 1;
+                fail("Content not equal. Buffer position: " +
+                        (pos) + " expected: " + b + " was: " + buf.get(pos));
+            }
+        }
+    }
+
+    public static boolean done = false;
+    public static int port = Support_PortManager.getNextPort();
+    public static byte[] data = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
+
+    static class ServerThread extends Thread {
+        @Override
+        public void run() {
+            try {
+                ServerSocketChannel ssc = ServerSocketChannel.open();
+                InetSocketAddress addr = new InetSocketAddress(InetAddress
+                        .getByAddress(new byte[] {0, 0, 0, 0}), port);
+                ssc.socket().bind(addr, 0);
+
+                ByteBuffer buf = ByteBuffer.allocate(10);
+                buf.put(data);
+
+                while (!done) {
+                    SocketChannel sc = ssc.accept();
+                    buf.rewind();
+                    sc.write(buf);
+                }
+            } catch (Exception e) {
+                // ignore
+            }
+        }
+    }
+
+    class MockSocketChannel extends SocketChannel {
+
+        private boolean isConstructorCalled = false;
+
+        public MockSocketChannel(SelectorProvider provider) {
+            super(provider);
+            isConstructorCalled = true;
+        }
+
+        public Socket socket() {
+            return null;
+        }
+
+        public boolean isConnected() {
+            return false;
+        }
+
+        public boolean isConnectionPending() {
+            return false;
+        }
+
+        public boolean connect(SocketAddress address) throws IOException {
+            return false;
+        }
+
+        public boolean finishConnect() throws IOException {
+            return false;
+        }
+
+        public int read(ByteBuffer target) throws IOException {
+            return 0;
+        }
+
+        public long read(ByteBuffer[] targets, int offset, int length)
+                throws IOException {
+            return 0;
+        }
+
+        public int write(ByteBuffer source) throws IOException {
+            return 0;
+        }
+
+        public long write(ByteBuffer[] sources, int offset, int length)
+                throws IOException {
+            return 0;
+        }
+
+        protected void implCloseSelectableChannel() throws IOException {
+            // empty
+        }
+
+        protected void implConfigureBlocking(boolean blockingMode)
+                throws IOException {
+            // empty
+        }
+    }
+
+    class SubSocketAddress extends SocketAddress {
+        private static final long serialVersionUID = 1L;
+
+        // empty
+        public SubSocketAddress() {
+            super();
+        }
+    }
+}
diff --git a/luni/src/test/java/java/security/OldAlgorithmParameterGeneratorTest.java b/luni/src/test/java/java/security/OldAlgorithmParameterGeneratorTest.java
new file mode 100644
index 0000000..81111a7
--- /dev/null
+++ b/luni/src/test/java/java/security/OldAlgorithmParameterGeneratorTest.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.security;
+
+import dalvik.annotation.TestTargetClass;
+
+@TestTargetClass(AlgorithmParameterGenerator.class)
+public class OldAlgorithmParameterGeneratorTest extends junit.framework.TestCase {
+
+    public void test_initI() throws Exception {
+        // Test for method void
+        // java.security.AlgorithmParameterGenerator.init(int)
+            // checks that no exception is thrown
+        int[] valid = {512, 576, 640, 960, 1024};
+        AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
+                .getInstance("DSA");
+
+        for (int i = 0; i < valid.length; i++) {
+            try {
+                gen.init(valid[i]);
+            } catch (Exception e) {
+                fail("Exception should not be thrown for valid parameter" + valid[i]);
+            }
+        }
+    }
+
+    public void test_initILjava_security_SecureRandom() throws Exception {
+        // Test for method void
+        // java.security.AlgorithmParameterGenerator.init(int,
+        // java.security.SecureRandom)
+            // checks that no exception is thrown
+        int[] valid = {512, 576, 640, 960, 1024};
+        AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
+                .getInstance("DSA");
+
+        for (int i = 0; i < valid.length; i++) {
+            try {
+                gen.init(valid[i], new SecureRandom());
+                gen.init(valid[i], null);
+            } catch (Exception e) {
+                fail("Exception should not be thrown for valid parameter" + valid[i]);
+            }
+        }
+    }
+}
diff --git a/luni/src/test/java/tests/targets/security/DHTest.java b/luni/src/test/java/java/security/OldDHTest.java
similarity index 82%
rename from luni/src/test/java/tests/targets/security/DHTest.java
rename to luni/src/test/java/java/security/OldDHTest.java
index 9a30a76..c257d09 100644
--- a/luni/src/test/java/tests/targets/security/DHTest.java
+++ b/luni/src/test/java/java/security/OldDHTest.java
@@ -13,25 +13,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
+package java.security;
 
 import dalvik.annotation.BrokenTest;
 import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
 import dalvik.annotation.TestTargetNew;
-
+import javax.crypto.spec.DHParameterSpec;
 import junit.framework.TestCase;
 
-import java.security.AlgorithmParameterGenerator;
-import java.security.AlgorithmParameters;
-import java.security.KeyPair;
-import java.security.KeyPairGenerator;
-import java.security.NoSuchAlgorithmException;
-import java.security.SecureRandom;
-
-import javax.crypto.spec.DHParameterSpec;
-
-public class DHTest extends TestCase {
+public class OldDHTest extends TestCase {
 
     @TestTargetNew(
         level = TestLevel.ADDITIONAL,
diff --git a/luni/src/test/java/java/security/OldKeyPairGeneratorTestDH.java b/luni/src/test/java/java/security/OldKeyPairGeneratorTestDH.java
new file mode 100644
index 0000000..7c8a5e5
--- /dev/null
+++ b/luni/src/test/java/java/security/OldKeyPairGeneratorTestDH.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package java.security;
+
+import dalvik.annotation.BrokenTest;
+import junit.framework.TestCase;
+import tests.security.KeyAgreementHelper;
+
+public class OldKeyPairGeneratorTestDH extends TestCase {
+
+    @BrokenTest("Takes ages due to DH computations. Disabling for now.")
+    public void testKeyPairGenerator() throws NoSuchAlgorithmException {
+        KeyPairGenerator generator = KeyPairGenerator.getInstance("DH");
+
+        generator.initialize(1024);
+
+        KeyPair keyPair = generator.generateKeyPair();
+
+        assertNotNull("no keypair generated", keyPair);
+        assertNotNull("no public key generated", keyPair.getPublic());
+        assertNotNull("no private key generated", keyPair.getPrivate());
+
+        new KeyAgreementHelper("DH").test(keyPair);
+    }
+}
diff --git a/luni/src/test/java/java/security/ProviderTest.java b/luni/src/test/java/java/security/ProviderTest.java
index fec0a68..a0753dd 100644
--- a/luni/src/test/java/java/security/ProviderTest.java
+++ b/luni/src/test/java/java/security/ProviderTest.java
@@ -25,8 +25,8 @@
 import java.util.Map.Entry;
 import java.util.Map;
 import java.util.Set;
-import javax.net.ssl.StandardNames;
-import javax.net.ssl.TestSSLContext;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
 import junit.framework.TestCase;
 
 public class ProviderTest extends TestCase {
@@ -47,7 +47,7 @@
         for (Provider provider : providers) {
             String providerName = provider.getName();
             // ignore BouncyCastle provider if it is installed on the RI
-            if (TestSSLContext.IS_RI && providerName.equals("BC")) {
+            if (StandardNames.IS_RI && providerName.equals("BC")) {
                 continue;
             }
             Set<Provider.Service> services = provider.getServices();
@@ -104,4 +104,79 @@
         Collections.sort(missing); // sort it for readability
         assertEquals(Collections.EMPTY_LIST, missing);
     }
+
+    private static final Pattern alias = Pattern.compile("Alg\\.Alias\\.([^.]*)\\.(.*)");
+
+    public void test_Provider_Properties() throws Exception {
+        /*
+         * A useful reference on Provider properties
+         * <a href="http://java.sun.com/javase/6/docs/technotes/guides/security/crypto/HowToImplAProvider.html>
+         * How to Implement a Provider in the Java &trade; Cryptography Architecture
+         * </a>
+         */
+
+        Provider[] providers = Security.getProviders();
+        for (Provider provider : providers) {
+            // check Provider.id proprieties
+            assertEquals(provider.getName(),
+                         provider.get("Provider.id name"));
+            assertEquals(String.valueOf(provider.getVersion()),
+                         provider.get("Provider.id version"));
+            assertEquals(provider.getInfo(),
+                         provider.get("Provider.id info"));
+            assertEquals(provider.getClass().getName(),
+                         provider.get("Provider.id className"));
+
+            // build map of all known aliases and implementations
+            Map<String,String> aliases = new HashMap<String,String>();
+            Map<String,String> implementations = new HashMap<String,String>();
+            for (Entry<Object,Object> entry : provider.entrySet()) {
+                Object k = entry.getKey();
+                Object v = entry.getValue();
+                assertEquals(String.class, k.getClass());
+                assertEquals(String.class, v.getClass());
+                String key = (String)k;
+                String value = (String)v;
+
+                // skip Provider.id keys, we check well known ones values above
+                if (key.startsWith("Provider.id ")) {
+                    continue;
+                }
+
+                // skip property settings such as: "Signature.SHA1withDSA ImplementedIn" "Software"
+                if (key.indexOf(' ') != -1) {
+                    continue;
+                }
+
+                Matcher m = alias.matcher(key);
+                if (m.find()) {
+                    String type = m.group(1);
+                    aliases.put(key, type + "." + value);
+                } else {
+                    implementations.put(key, value);
+                }
+            }
+
+            // verify implementation classes are available
+            for (Entry<String,String> entry : implementations.entrySet()) {
+                String typeAndAlgorithm = entry.getKey();
+                String className = entry.getValue();
+                try {
+                    assertNotNull(Class.forName(className,
+                                                true,
+                                                provider.getClass().getClassLoader()));
+                } catch (ClassNotFoundException e) {
+                    fail("Could not find class " + className + " for " + typeAndAlgorithm);
+                }
+            }
+
+            // make sure all aliases point to some known implementation
+            for (Entry<String,String> entry : aliases.entrySet()) {
+                String alias  = entry.getKey();
+                String actual = entry.getValue();
+                assertTrue("Could not find implementation " + actual + " for alias " + alias,
+                           implementations.containsKey(actual));
+            }
+        }
+    }
 }
diff --git a/luni/src/test/java/java/security/cert/OldPKIXParametersTest.java b/luni/src/test/java/java/security/cert/OldPKIXParametersTest.java
new file mode 100644
index 0000000..d1cdd3b
--- /dev/null
+++ b/luni/src/test/java/java/security/cert/OldPKIXParametersTest.java
@@ -0,0 +1,246 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+ * @author Vladimir N. Molotkov
+ * @version $Revision$
+ */
+
+package java.security.cert;
+
+import dalvik.annotation.BrokenTest;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import java.io.ByteArrayInputStream;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Set;
+import junit.framework.TestCase;
+import org.apache.harmony.security.tests.support.cert.TestUtils;
+import tests.targets.security.KeyStoreTestPKCS12;
+
+/**
+ * Tests for <code>PKIXParameters</code> fields and methods
+ */
+@TestTargetClass(PKIXParameters.class)
+public class OldPKIXParametersTest extends TestCase {
+
+    /**
+     * Test for <code>clone()</code> method<br>
+     */
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "",
+        method = "clone",
+        args = {}
+    )
+    public final void testClone() throws InvalidAlgorithmParameterException {
+        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
+        if (taSet == null) {
+            fail(getName()
+                    + ": not performed (could not create test TrustAnchor set)");
+        }
+
+        PKIXParameters cpp = new PKIXParameters(taSet);
+        PKIXParameters cppc = (PKIXParameters) cpp.clone();
+
+        assertEquals(cpp.getPolicyQualifiersRejected(), cppc
+                .getPolicyQualifiersRejected());
+        assertEquals(cpp.getCertPathCheckers(), cppc.getCertPathCheckers());
+        assertEquals(cpp.getCertStores(), cppc.getCertStores());
+        assertEquals(cpp.getDate(), cppc.getDate());
+        assertEquals(cpp.getInitialPolicies(), cppc.getInitialPolicies());
+        assertEquals(cpp.getSigProvider(), cppc.getSigProvider());
+        assertEquals(cpp.getTargetCertConstraints(), cppc
+                .getTargetCertConstraints());
+        assertEquals(cpp.getTrustAnchors(), cppc.getTrustAnchors());
+
+        assertEquals(cpp.isAnyPolicyInhibited(), cppc.isAnyPolicyInhibited());
+        assertEquals(cpp.isExplicitPolicyRequired(), cppc
+                .isExplicitPolicyRequired());
+        assertEquals(cpp.isPolicyMappingInhibited(), cppc
+                .isPolicyMappingInhibited());
+        assertEquals(cpp.isRevocationEnabled(), cppc.isRevocationEnabled());
+
+        cpp.setDate(Calendar.getInstance().getTime());
+        cpp.setPolicyQualifiersRejected(!cppc.getPolicyQualifiersRejected());
+        assertFalse(cpp.getDate().equals(cppc.getDate()));
+        assertFalse(cpp.getPolicyQualifiersRejected() == cppc
+                .getPolicyQualifiersRejected());
+
+        cppc.setExplicitPolicyRequired(!cpp.isExplicitPolicyRequired());
+        cppc.setRevocationEnabled(!cpp.isRevocationEnabled());
+
+        assertFalse(cpp.isExplicitPolicyRequired() == cppc
+                .isExplicitPolicyRequired());
+        assertFalse(cpp.isRevocationEnabled() == cppc.isRevocationEnabled());
+
+        PKIXParameters cpp1 = null;
+        try {
+            cpp1.clone();
+        } catch (NullPointerException e) {
+            // expected
+        }
+    }
+
+    /**
+     * Test for <code>isPolicyMappingInhibited()</code> method<br>
+     * Assertion: returns true if policy mapping is inhibited, false otherwise
+     * Assertion: by default, policy mapping is not inhibited (the flag is
+     * false)
+     *
+     * @throws InvalidAlgorithmParameterException
+     */
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "",
+        method = "isPolicyMappingInhibited",
+        args = {}
+    )
+    public final void testIsPolicyMappingInhibited() throws Exception {
+        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
+        if (taSet == null) {
+            fail(getName() + ": not performed (could not create test TrustAnchor set)");
+        }
+
+        PKIXParameters p = new PKIXParameters(taSet);
+        assertFalse(p.isPolicyMappingInhibited());
+
+        CertificateFactory cf = CertificateFactory.getInstance("X.509");
+        TestUtils.initCertPathSSCertChain();
+        Set<TrustAnchor> taSet2 = Collections.singleton(new TrustAnchor(
+               TestUtils.rootCertificateSS, null));
+        p = new PKIXParameters(taSet2);
+
+        assertFalse(p.isPolicyMappingInhibited());
+        p.setPolicyMappingInhibited(true);
+        assertTrue(p.isRevocationEnabled());
+    }
+
+    /**
+     * Test for <code>isPolicyMappingInhibited()</code> method<br>
+     * Assertion: returns the current value of the RevocationEnabled flag
+     * Assertion: when a <code>PKIXParameters</code> object is created, this
+     * flag is set to true
+     *
+     * @throws InvalidAlgorithmParameterException
+     */
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "",
+        method = "isRevocationEnabled",
+        args = {}
+    )
+    public final void testIsRevocationEnabled() throws Exception {
+        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
+        if (taSet == null) {
+            fail(getName()
+                    + ": not performed (could not create test TrustAnchor set)");
+        }
+
+        PKIXParameters p = new PKIXParameters(taSet);
+        assertTrue(p.isRevocationEnabled());
+
+        CertificateFactory cf = CertificateFactory.getInstance("X.509");
+       TestUtils.initCertPathSSCertChain();
+       Set<TrustAnchor> taSet2 = Collections.singleton(new TrustAnchor(
+              TestUtils.rootCertificateSS, null));
+       p = new PKIXParameters(taSet2);
+
+       assertTrue(p.isRevocationEnabled());
+       p.setRevocationEnabled(false);
+       assertFalse(p.isRevocationEnabled());
+    }
+
+    /**
+     * Test for <code>toString</code> method<br>
+     */
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "",
+        method = "toString",
+        args = {}
+    )
+    public final void testToString() throws Exception {
+        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
+        if (taSet == null) {
+            fail(getName()
+                    + ": not performed (could not create test TrustAnchor set)");
+        }
+
+        PKIXParameters p = new PKIXParameters(taSet);
+        assertNotNull(p.toString());
+
+        PKIXParameters p1 = null;
+        try {
+            p1.toString();
+            fail("NullPointerException expected");
+        } catch (NullPointerException e) {
+            // expected
+        }
+    }
+
+    /**
+     * Test #4 for <code>PKIXParameters(KeyStore)</code> constructor<br>
+     *
+     * @throws InvalidAlgorithmParameterException
+     * @throws KeyStoreException
+     */
+    @TestTargetNew(
+        level = TestLevel.PARTIAL_COMPLETE,
+        notes = "Verifies everything except null argument",
+        method = "PKIXParameters",
+        args = {java.security.KeyStore.class}
+    )
+    @BrokenTest("Fails in CTS environment, but passes in CoreTestRunner")
+    public final void testPKIXParametersKeyStore04() throws Exception {
+
+
+        KeyStore store = KeyStore.getInstance("PKCS12");
+        KeyStoreTestPKCS12 k = new KeyStoreTestPKCS12();
+        ByteArrayInputStream stream = new ByteArrayInputStream(k.keyStoreData);
+
+        try {
+            PKIXParameters p = new PKIXParameters(store);
+        } catch (KeyStoreException e) {
+            // ok
+        }
+
+        store = KeyStore.getInstance("PKCS12");
+        store.load(stream, new String(KeyStoreTestPKCS12.keyStorePassword)
+                .toCharArray());
+        stream.close();
+
+        try {
+              PKIXParameters p = new PKIXParameters(store);
+        } catch (InvalidAlgorithmParameterException e) {
+            // ok
+        }
+
+
+        KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
+        keystore.load(null,null);
+        keystore.setCertificateEntry("test", TestUtils.rootCertificateSS);
+
+
+        PKIXParameters p = new PKIXParameters(keystore);
+    }
+}
diff --git a/luni/src/test/java/java/text/OldDecimalFormatTest.java b/luni/src/test/java/java/text/OldDecimalFormatTest.java
new file mode 100644
index 0000000..9823ed1
--- /dev/null
+++ b/luni/src/test/java/java/text/OldDecimalFormatTest.java
@@ -0,0 +1,1267 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.text;
+
+import dalvik.annotation.AndroidOnly;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.BitSet;
+import java.util.Locale;
+import junit.framework.TestCase;
+import tests.support.Support_DecimalFormat;
+
+
+@TestTargetClass(DecimalFormat.class)
+public class OldDecimalFormatTest extends TestCase {
+
+    @TestTargetNew(
+        level = TestLevel.PARTIAL_COMPLETE,
+        notes = "",
+        method = "formatToCharacterIterator",
+        args = {java.lang.Object.class}
+    )
+    public void test_formatToCharacterIterator() throws Exception {
+        AttributedCharacterIterator iterator;
+        int[] runStarts;
+        int[] runLimits;
+        String result;
+        char current;
+
+        // For BigDecimal with multiplier test.
+        DecimalFormat df = new DecimalFormat();
+        df.setMultiplier(10);
+        iterator = df.formatToCharacterIterator(new BigDecimal("12345678901234567890"));
+        result = "123,456,789,012,345,678,900";
+        current = iterator.current();
+        for (int i = 0; i < result.length(); i++) {
+            assertEquals("wrong char @" + i, result.charAt(i), current);
+            current = iterator.next();
+        }
+
+        // For BigDecimal with multiplier test.
+        df = new DecimalFormat();
+        df.setMultiplier(-1);
+        df.setMaximumFractionDigits(20);
+        iterator = df.formatToCharacterIterator(new BigDecimal("1.23456789012345678901"));
+        result = "-1.23456789012345678901";
+        current = iterator.current();
+        for (int i = 0; i < result.length(); i++) {
+            assertEquals("wrong char @" + i, result.charAt(i), current);
+            current = iterator.next();
+        }
+
+        iterator = new DecimalFormat()
+                .formatToCharacterIterator(new BigDecimal("1.23456789E1234"));
+        runStarts = new int[] {0, 0, 2, 3, 3, 3, 6, 7, 7, 7, 10, 11, 11, 11, 14};
+        runLimits = new int[] {2, 2, 3, 6, 6, 6, 7, 10, 10, 10, 11, 14, 14, 14, 15};
+        result = "12,345,678,900,"; // 000,000,000,000....
+        current = iterator.current();
+        for (int i = 0; i < runStarts.length; i++) {
+            assertEquals("wrong start @" + i, runStarts[i], iterator.getRunStart());
+            assertEquals("wrong limit @" + i, runLimits[i], iterator.getRunLimit());
+            assertEquals("wrong char @" + i, result.charAt(i), current);
+            current = iterator.next();
+        }
+        assertEquals(0, iterator.getBeginIndex());
+        assertEquals(1646, iterator.getEndIndex());
+
+        iterator = new DecimalFormat()
+                .formatToCharacterIterator(new BigDecimal("1.23456789E301"));
+        runStarts = new int[] {0, 0, 2, 3, 3, 3, 6, 7, 7, 7, 10, 11, 11, 11, 14};
+        runLimits = new int[] {2, 2, 3, 6, 6, 6, 7, 10, 10, 10, 11, 14, 14, 14, 15};
+        result = "12,345,678,900,"; // 000,000,000,000....
+        current = iterator.current();
+        for (int i = 0; i < runStarts.length; i++) {
+            assertEquals("wrong start @" + i, runStarts[i], iterator.getRunStart());
+            assertEquals("wrong limit @" + i, runLimits[i], iterator.getRunLimit());
+            assertEquals("wrong char @" + i, result.charAt(i), current);
+            current = iterator.next();
+        }
+        assertEquals(0, iterator.getBeginIndex());
+        assertEquals(402, iterator.getEndIndex());
+
+        iterator = new DecimalFormat()
+                .formatToCharacterIterator(new BigDecimal("1.2345678E4"));
+        runStarts = new int[] {0, 0, 2, 3, 3, 3, 6, 7, 7, 7};
+        runLimits = new int[] {2, 2, 3, 6, 6, 6, 7, 10, 10, 10};
+        result = "12,345.678";
+        current = iterator.current();
+        for (int i = 0; i < runStarts.length; i++) {
+            assertEquals("wrong start @" + i, runStarts[i], iterator.getRunStart());
+            assertEquals("wrong limit @" + i, runLimits[i], iterator.getRunLimit());
+            assertEquals("wrong char @" + i, result.charAt(i), current);
+            current = iterator.next();
+        }
+        assertEquals(0, iterator.getBeginIndex());
+        assertEquals(10, iterator.getEndIndex());
+
+        iterator = new DecimalFormat()
+                .formatToCharacterIterator(new BigInteger("123456789"));
+        runStarts = new int[] {0, 0, 0, 3, 4, 4, 4, 7, 8, 8, 8};
+        runLimits = new int[] {3, 3, 3, 4, 7, 7, 7, 8, 11, 11, 11};
+        result = "123,456,789";
+        current = iterator.current();
+        for (int i = 0; i < runStarts.length; i++) {
+            assertEquals("wrong start @" + i, runStarts[i], iterator.getRunStart());
+            assertEquals("wrong limit @" + i, runLimits[i], iterator.getRunLimit());
+            assertEquals("wrong char @" + i, result.charAt(i), current);
+            current = iterator.next();
+        }
+        assertEquals(0, iterator.getBeginIndex());
+        assertEquals(11, iterator.getEndIndex());
+    }
+
+    /*
+     * Test the getter and setter of parseBigDecimal and parseIntegerOnly and
+     * test the default value of them.
+     */
+    @TestTargets({
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            notes = "",
+            method = "isParseBigDecimal",
+            args = {}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            notes = "",
+            method = "setParseBigDecimal",
+            args = {boolean.class}
+        )
+    })
+    public void test_isParseBigDecimalLjava_lang_Boolean_isParseIntegerOnlyLjava_lang_Boolean() {
+
+        // parseBigDecimal default to false
+        DecimalFormat form = (DecimalFormat) DecimalFormat
+                .getInstance(Locale.US);
+        assertFalse(form.isParseBigDecimal());
+        form.setParseBigDecimal(true);
+        assertTrue(form.isParseBigDecimal());
+
+        try {
+            Number result = form.parse("123.123");
+            assertEquals(new BigDecimal("123.123"), result);
+        } catch (ParseException e) {
+            fail("ParseException was thrown.");
+        }
+
+        form.setParseBigDecimal(false);
+        assertFalse(form.isParseBigDecimal());
+
+        try {
+            Number result = form.parse("123.123");
+            assertFalse(result instanceof BigDecimal);
+        } catch (ParseException e) {
+            fail("ParseException was thrown.");
+        }
+
+        // parseIntegerOnly default to false
+        assertFalse(form.isParseIntegerOnly());
+    }
+
+    @TestTargets({
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            notes = "",
+            method = "isParseIntegerOnly",
+            args = {}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            notes = "",
+            method = "setParseIntegerOnly",
+            args = {boolean.class}
+        )
+    })
+    public void test_isParseIntegerOnly() {
+
+            DecimalFormat format = new DecimalFormat();
+            assertFalse("Default value of isParseIntegerOnly is true",
+                    format.isParseIntegerOnly());
+
+            format.setParseIntegerOnly(true);
+            assertTrue(format.isParseIntegerOnly());
+            try {
+                Number result = format.parse("123.123");
+                assertEquals(new Long("123"), result);
+            } catch (ParseException e) {
+                fail("ParseException was thrown.");
+            }
+
+            format.setParseIntegerOnly(false);
+            assertFalse(format.isParseIntegerOnly());
+            try {
+                Number result = format.parse("123.123");
+                assertEquals(new Double("123.123"), result);
+            } catch (ParseException e) {
+                fail("ParseException was thrown.");
+            }
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "",
+        method = "isGroupingUsed",
+        args = {}
+    )
+    public void test_isGroupingUsed() {
+        String [] patterns = {"####.##", "######.######", "000000.000000",
+                "######.000000", "000000.######", " ###.###", "$#####.######",
+                "$$####.######"};
+
+        for(String pattern:patterns) {
+            DecimalFormat format = new DecimalFormat(pattern);
+            assertFalse(format.isGroupingUsed());
+        }
+
+        DecimalFormat format = new DecimalFormat("###,####");
+        assertTrue(format.isGroupingUsed());
+    }
+
+    // Test the type of the returned object
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "",
+        method = "parse",
+        args = {java.lang.String.class, java.text.ParsePosition.class}
+    )
+    public void test_parseLjava_lang_String_Ljava_text_ParsePosition() {
+        DecimalFormat form = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
+        form.setParseIntegerOnly(true);
+        form.setParseBigDecimal(true);
+
+        final String doubleMax2 = "359,538,626,972,463,141,629,054,847,463,408,"
+            + "713,596,141,135,051,689,993,197,834,953,606,314,521,560,057,077,"
+            + "521,179,117,265,533,756,343,080,917,907,028,764,928,468,642,653,"
+            + "778,928,365,536,935,093,407,075,033,972,099,821,153,102,564,152,"
+            + "490,980,180,778,657,888,151,737,016,910,267,884,609,166,473,806,"
+            + "445,896,331,617,118,664,246,696,549,595,652,408,289,446,337,476,"
+            + "354,361,838,599,762,500,808,052,368,249,716,736";
+        Number number = form.parse(doubleMax2, new ParsePosition(0));
+        assertTrue(number instanceof BigDecimal);
+        BigDecimal result = (BigDecimal)number;
+        assertEquals(new BigDecimal(Double.MAX_VALUE).add(new BigDecimal(
+                Double.MAX_VALUE)), result);
+    }
+
+    @TestTargetNew(
+        level = TestLevel.PARTIAL_COMPLETE,
+        method = "getMinimumIntegerDigits",
+        args = {}
+    )
+    @AndroidOnly("Difference to RI")
+    public void test_getMaximumIntegerDigits_AndroidOnly() {
+        final int maxIntDigit = 309;
+
+        // When use default locale, in this case zh_CN
+        // the returned instance of NumberFormat is a DecimalFormat
+        DecimalFormat form = new DecimalFormat("00.###E0");
+        NumberFormat nform = DecimalFormat.getInstance(Locale.US);
+        nform = DecimalFormat.getInstance(Locale.US);
+        form = null;
+        if (nform instanceof DecimalFormat) {
+            form = (DecimalFormat) nform;
+        }
+        // getMaximumIntegerDigits from NumberFormat default to 309
+        // getMaximumIntegerDigits from DecimalFormat default to 309
+        // the following 2 assertions will fail on RI implementation, since the
+        // implementation of ICU and RI are not identical. RI does not give
+        // DecimalFormat an initial bound about its maximumIntegerDigits
+        // (default to Integer.MAX_VALUE: 2147483647 )
+        assertEquals(maxIntDigit, nform.getMaximumIntegerDigits());
+        assertEquals(maxIntDigit, form.getMaximumIntegerDigits());
+    }
+
+    @TestTargetNew(
+        level = TestLevel.PARTIAL_COMPLETE,
+        method = "getMinimumIntegerDigits",
+        args = {}
+    )
+    @AndroidOnly("second 0 needs to be quoted in icu." +
+            "(quoting special characters in prefix and suffix necessary)")
+    public void test_getMaximumIntegerDigits2() {
+        // regression test for HARMONY-878
+        assertTrue(new DecimalFormat("0\t'0'").getMaximumIntegerDigits() > 0);
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "",
+        method = "setPositivePrefix",
+        args = {java.lang.String.class}
+    )
+    public void test_setPositivePrefixLjava_lang_String() {
+        DecimalFormat format = new DecimalFormat();
+        assertEquals("", format.getPositivePrefix());
+
+        format.setPositivePrefix("PosPrf");
+        assertEquals("PosPrf", format.getPositivePrefix());
+        try {
+            assertTrue(format.parse("PosPrf123.45").doubleValue() == 123.45);
+        } catch(java.text.ParseException pe) {
+            fail("ParseException was thrown.");
+        }
+
+        format.setPositivePrefix("");
+        assertEquals("", format.getPositivePrefix());
+
+        format.setPositivePrefix(null);
+        assertNull(format.getPositivePrefix());
+    }
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "",
+        method = "setPositiveSuffix",
+        args = {java.lang.String.class}
+    )
+    public void test_setPositiveSuffixLjava_lang_String() {
+        DecimalFormat format = new DecimalFormat();
+        assertEquals("", format.getPositiveSuffix());
+
+        format.setPositiveSuffix("PosSfx");
+        assertEquals("PosSfx", format.getPositiveSuffix());
+        try {
+            assertTrue(format.parse("123.45PosSfx").doubleValue() == 123.45);
+        } catch(java.text.ParseException pe) {
+            fail("ParseException was thrown.");
+        }
+
+        format.setPositiveSuffix("");
+        assertEquals("", format.getPositiveSuffix());
+
+        format.setPositiveSuffix(null);
+        assertNull(format.getPositiveSuffix());
+    }
+    @TestTargets({
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            notes = "",
+            method = "setNegativePrefix",
+            args = {java.lang.String.class}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            notes = "",
+            method = "getNegativePrefix",
+            args = {}
+        )
+    })
+    public void test_setNegativePrefixLjava_lang_String() {
+        DecimalFormat format = new DecimalFormat();
+        assertEquals("-", format.getNegativePrefix());
+
+        format.setNegativePrefix("NegPrf");
+        assertEquals("NegPrf", format.getNegativePrefix());
+        try {
+            assertTrue(format.parse("NegPrf123.45").doubleValue() == -123.45);
+        } catch(java.text.ParseException pe) {
+            fail("ParseException was thrown.");
+        }
+        format.setNegativePrefix("");
+        assertEquals("", format.getNegativePrefix());
+
+        format.setNegativePrefix(null);
+        assertNull(format.getNegativePrefix());
+    }
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "",
+        method = "setNegativeSuffix",
+        args = {java.lang.String.class}
+    )
+    public void test_setNegativeSuffixLjava_lang_String() {
+        DecimalFormat format = new DecimalFormat();
+        assertEquals("", format.getNegativeSuffix());
+
+        format.setNegativeSuffix("NegSfx");
+        assertEquals("NegSfx", format.getNegativeSuffix());
+        try {
+            assertTrue(format.parse("123.45NegPfx").doubleValue() == 123.45);
+        } catch(java.text.ParseException pe) {
+            fail("ParseException was thrown.");
+        }
+
+        format.setNegativeSuffix("");
+        assertEquals("", format.getNegativeSuffix());
+
+        format.setNegativeSuffix(null);
+        assertNull(format.getNegativeSuffix());
+    }
+
+    /**
+     * @tests java.text.DecimalFormat#toLocalizedPattern() Test of method
+     *        java.text.DecimalFormat#toLocalizedPattern().
+     */
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "",
+        method = "toLocalizedPattern",
+        args = {}
+    )
+    public void test_toLocalizedPattern() {
+        DecimalFormat format = new DecimalFormat();
+        format.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US));
+        try {
+            format.applyLocalizedPattern("#.#");
+            assertEquals("Wrong pattern 1", "#0.#", format.toLocalizedPattern());
+            format.applyLocalizedPattern("#.");
+            assertEquals("Wrong pattern 2", "#0.", format.toLocalizedPattern());
+            format.applyLocalizedPattern("#");
+            assertEquals("Wrong pattern 3", "#", format.toLocalizedPattern());
+            format.applyLocalizedPattern(".#");
+            assertEquals("Wrong pattern 4", "#.0", format.toLocalizedPattern());
+        } catch (Exception e) {
+            fail("Unexpected exception " + e.toString());
+        }
+    }
+
+    /**
+     * @tests java.text.DecimalFormat#toPattern() Test of method
+     *        java.text.DecimalFormat#toPattern().
+     */
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "",
+        method = "toPattern",
+        args = {}
+    )
+    public void test_toPattern() {
+        DecimalFormat format = new DecimalFormat();
+        try {
+            format.applyPattern("#.#");
+            assertEquals("Wrong pattern 1", "#0.#", format.toPattern());
+            format.applyPattern("#.");
+            assertEquals("Wrong pattern 2", "#0.", format.toPattern());
+            format.applyPattern("#");
+            assertEquals("Wrong pattern 3", "#", format.toPattern());
+            format.applyPattern(".#");
+            assertEquals("Wrong pattern 4", "#.0", format.toPattern());
+        } catch (Exception e) {
+            fail("Unexpected exception " + e.toString());
+        }
+    }
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "",
+        method = "setGroupingUsed",
+        args = {boolean.class}
+    )
+    public void test_setGroupingUse() {
+        DecimalFormat format = new DecimalFormat();
+
+        StringBuffer buf = new StringBuffer();
+        format.setGroupingUsed(false);
+        format.format(new Long(1970), buf, new FieldPosition(0));
+        assertEquals("1970", buf.toString());
+        assertFalse(format.isGroupingUsed());
+        format.format(new Long(1970), buf, new FieldPosition(0));
+        assertEquals("19701970", buf.toString());
+        assertFalse(format.isGroupingUsed());
+
+        format.setGroupingUsed(true);
+        format.format(new Long(1970), buf, new FieldPosition(0));
+        assertEquals("197019701,970", buf.toString());
+        assertTrue(format.isGroupingUsed());
+    }
+
+    /**
+     * @tests java.text.DecimalFormat#DecimalFormat() Test of method
+     *        java.text.DecimalFormat#DecimalFormat().
+     */
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "",
+        method = "DecimalFormat",
+        args = {}
+    )
+    public void test_Constructor() {
+        // Test for method java.text.DecimalFormat()
+        // the constructor form that specifies a pattern is equal to the form
+        // constructed with no pattern and applying that pattern using the
+        // applyPattern call
+        try {
+            DecimalFormat format1 = new DecimalFormat();
+            format1.applyPattern("'$'1000.0000");
+            DecimalFormat format2 = new DecimalFormat();
+            format2.applyPattern("'$'1000.0000");
+            assertTrue(
+                    "Constructed format did not match applied format object",
+                    format2.equals(format1));
+            DecimalFormat format3 = new DecimalFormat("'$'1000.0000");
+            assertTrue(
+                    "Constructed format did not match applied format object",
+                    format3.equals(format1));
+            DecimalFormat format4 = new DecimalFormat("'$'8000.0000");
+            assertTrue(
+                    "Constructed format did not match applied format object",
+                    !format4.equals(format1));
+        } catch (Exception e) {
+            fail("Unexpected exception " + e.toString());
+        }
+    }
+
+    /**
+     * @tests java.text.DecimalFormat#DecimalFormat(java.lang.String)
+     */
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "",
+        method = "DecimalFormat",
+        args = {java.lang.String.class}
+    )
+    public void test_ConstructorLjava_lang_String() {
+        // Test for method java.text.DecimalFormat(java.lang.String)
+        // the constructor form that specifies a pattern is equal to the form
+        // constructed with no pattern and applying that pattern using the
+        // applyPattern call
+        DecimalFormat format = new DecimalFormat("'$'0000.0000");
+        DecimalFormat format1 = new DecimalFormat();
+        format1.applyPattern("'$'0000.0000");
+        assertTrue("Constructed format did not match applied format object",
+                format.equals(format1));
+
+        String [] patterns = {"####.##", "######.######", "000000.000000",
+                "######.000000", "000000.######", " ###.###", "$#####.######",
+                "$$####.######", "%#,##,###,####", "#,##0.00;(#,##0.00)"};
+
+        for(String str:patterns) {
+            new DecimalFormat(str);
+        }
+
+        try {
+            new DecimalFormat(null);
+            fail("NullPointerException wasn't thrown.");
+        } catch(NullPointerException npe){
+            //expected
+        }
+
+        String [] incPatterns = {"%#,##,###,####'", "#.##0.00"};
+        for(String str:incPatterns) {
+            try {
+                new DecimalFormat(str);
+                fail("IllegalArgumentException wasn't thrown for pattern: " + str);
+            } catch(IllegalArgumentException iae){
+                //expected
+            }
+        }
+    }
+
+    /**
+     * @tests java.text.DecimalFormat#DecimalFormat(java.lang.String,
+     *        java.text.DecimalFormatSymbols) Test of method
+     *        java.text.DecimalFormat#DecimalFormat(java.lang.String,
+     *        java.text.DecimalFormatSymbols). Case 1: Try to construct object
+     *        using correct pattern and fromat symbols. Case 2: Try to construct
+     *        object using null arguments. Case 3: Try to construct object using
+     *        incorrect pattern.
+     */
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "",
+        method = "DecimalFormat",
+        args = {java.lang.String.class, java.text.DecimalFormatSymbols.class}
+    )
+    public void test_ConstructorLjava_lang_StringLjava_text_DecimalFormatSymbols() {
+        try {
+            // case 1: Try to construct object using correct pattern and fromat
+            // symbols.
+            DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.CANADA);
+            DecimalFormat format1 = new DecimalFormat("'$'1000.0000", dfs);
+            DecimalFormat format2 = new DecimalFormat();
+            format2.applyPattern("'$'1000.0000");
+            format2.setDecimalFormatSymbols(dfs);
+            assertTrue(
+                    "Constructed format did not match applied format object",
+                    format2.equals(format1));
+            assertTrue(
+                    "Constructed format did not match applied format object",
+                    !format1.equals(new DecimalFormat("'$'1000.0000",
+                            new DecimalFormatSymbols(Locale.CHINA))));
+
+            // case 2: Try to construct object using null arguments.
+            try {
+                new DecimalFormat("'$'1000.0000", (DecimalFormatSymbols) null);
+                fail("Expected NullPointerException was not thrown");
+            } catch (NullPointerException e) {
+                // expected
+            }
+            try {
+                new DecimalFormat(null, new DecimalFormatSymbols());
+                fail("Expected NullPointerException was not thrown");
+            } catch (NullPointerException e) {
+                // expected
+            }
+            try {
+                new DecimalFormat(null, (DecimalFormatSymbols) null);
+                fail("Expected NullPointerException was not thrown");
+            } catch (NullPointerException e) {
+                // expected
+            }
+
+            // case 3: Try to construct object using incorrect pattern.
+            try {
+                new DecimalFormat("$'", new DecimalFormatSymbols());
+                fail("Expected IllegalArgumentException was not thrown");
+            } catch (IllegalArgumentException e) {
+                // expected
+            }
+        } catch (Exception e) {
+            fail("Unexpected exception " + e.toString());
+        }
+    }
+
+    /**
+     * @tests java.text.DecimalFormat#applyLocalizedPattern(java.lang.String)
+     *        Test of method
+     *        java.text.DecimalFormat#applyLocalizedPattern(java.lang.String).
+     *        Case 1: Try to apply correct variants of pattern. Case 2: Try to
+     *        apply malformed patten. Case 3: Try to apply null patern.
+     */
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "",
+        method = "applyLocalizedPattern",
+        args = {java.lang.String.class}
+    )
+    public void test_applyLocalizedPatternLjava_lang_String() {
+        DecimalFormat format = new DecimalFormat();
+        try {
+            // case 1: Try to apply correct variants of pattern.
+            format.applyLocalizedPattern("#.#");
+            assertEquals("Wrong pattern 1", "#0.#", format.toLocalizedPattern());
+            format.applyLocalizedPattern("#.");
+            assertEquals("Wrong pattern 2", "#0.", format.toLocalizedPattern());
+            format.applyLocalizedPattern("#");
+            assertEquals("Wrong pattern 3", "#", format.toLocalizedPattern());
+            format.applyLocalizedPattern(".#");
+            assertEquals("Wrong pattern 4", "#.0", format.toLocalizedPattern());
+
+            // case 2: Try to apply malformed patten.
+            try {
+                format.applyLocalizedPattern("'#,#:#0.0#;(#)");
+                fail("Expected IllegalArgumentException was not thrown");
+            } catch (IllegalArgumentException e) {
+                // expected
+            }
+
+            // case 3: Try to apply null patern.
+            try {
+                format.applyLocalizedPattern((String) null);
+                fail("Expected NullPointerException was not thrown");
+            } catch (NullPointerException e) {
+                // expected
+            }
+        } catch (Exception e) {
+            fail("Unexpected exception " + e.toString());
+        }
+    }
+
+    /**
+     * @tests java.text.DecimalFormat#applyPattern(java.lang.String)
+     */
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "applyPattern",
+        args = {java.lang.String.class}
+    )
+    public void test_applyPatternLjava_lang_String() {
+        DecimalFormat format = new DecimalFormat("#.#");
+        assertEquals("Wrong pattern 1", "#0.#", format.toPattern());
+        format = new DecimalFormat("#.");
+        assertEquals("Wrong pattern 2", "#0.", format.toPattern());
+        format = new DecimalFormat("#");
+        assertEquals("Wrong pattern 3", "#", format.toPattern());
+        format = new DecimalFormat(".#");
+        assertEquals("Wrong pattern 4", "#.0", format.toPattern());
+
+        DecimalFormat decFormat = new DecimalFormat("#.#");
+
+        try {
+            decFormat.applyPattern(null);
+            fail("NullPointerException was not thrown.");
+        } catch(NullPointerException npe) {
+            //expected
+        }
+
+        String [] incPatterns = {"%#,##,###,####'", "#.##0.00"};
+        for(String str:incPatterns) {
+            try {
+                decFormat.applyPattern(str);
+                fail("IllegalArgumentException was not thrown for pattern: " +
+                        str);
+            } catch(IllegalArgumentException  iae) {
+                //expected
+            }
+        }
+    }
+
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "applyPattern",
+        args = {java.lang.String.class}
+    )
+    @AndroidOnly("icu supports 2 grouping sizes.")
+    public void test_applyPatternLjava_lang_String2() {
+        DecimalFormat decFormat = new DecimalFormat("#.#");
+        String [] patterns = {"####.##", "######.######", "000000.000000",
+                "######.000000", "000000.######", " ###.###", "$#####.######",
+                "$$####.######", "%#,##,###,####", "#,##0.00;(#,##0.00)",
+                 "##.##-E"};
+
+        String [] expResult = {"#0.##", "#0.######", "#000000.000000",
+                "#.000000", "#000000.######", " #0.###", "$#0.######",
+                "$$#0.######",
+                "%#,###,####", // icu only. icu supports two grouping sizes
+                "#,##0.00;(#,##0.00)",
+                "#0.##-'E'"}; // icu only. E in the suffix does not need to be
+                              // quoted. This is done automatically.
+
+        for (int i = 0; i < patterns.length; i++) {
+            decFormat.applyPattern(patterns[i]);
+            String result = decFormat.toPattern();
+            assertEquals("Failed to apply following pattern: " + patterns[i] +
+                    " expected: " + expResult[i] + " returned: " + result,
+                    expResult[i], result);
+        }
+    }
+
+    /**
+     * @tests java.text.DecimalFormat#clone()
+     */
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "",
+        method = "clone",
+        args = {}
+    )
+    public void test_clone() {
+        DecimalFormat format = (DecimalFormat) DecimalFormat
+                .getInstance(Locale.US);
+        DecimalFormat cloned = (DecimalFormat) format.clone();
+        assertEquals(cloned.getDecimalFormatSymbols(), format
+                .getDecimalFormatSymbols());
+
+        format = new DecimalFormat("'$'0000.0000");
+        DecimalFormat format1 = (DecimalFormat) (format.clone());
+        // make sure the objects are equal
+        assertTrue("Object's clone isn't equal!", format.equals(format1));
+        // change the content of the clone and make sure it's not equal anymore
+        // verifies that it's data is now distinct from the original
+        format1.applyPattern("'$'0000.####");
+        assertTrue("Object's changed clone should not be equal!", !format
+                .equals(format1));
+    }
+
+    private void compare(String testName, String format, String expected) {
+        assertTrue(testName + " got: " + format + " expected: " + expected,
+                format.equals(expected));
+    }
+
+    private boolean compare(int count, String format, String expected) {
+        boolean result = format.equals(expected);
+        if (!result)
+            System.out.println("Failure test: " + count + " got: " + format
+                    + " expected: " + expected);
+        return result;
+    }
+
+    /**
+     * @tests java.text.DecimalFormat#format(double, java.lang.StringBuffer,
+     *        java.text.FieldPosition)
+     */
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "format",
+        args = {double.class, java.lang.StringBuffer.class, java.text.FieldPosition.class}
+    )
+    public void test_formatDLjava_lang_StringBufferLjava_text_FieldPosition() {
+        new Support_DecimalFormat(
+                "test_formatDLjava_lang_StringBufferLjava_text_FieldPosition")
+                .t_format_with_FieldPosition();
+
+        int failCount = 0;
+        BitSet failures = new BitSet();
+
+        final DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.US);
+
+        DecimalFormat df = new DecimalFormat("00.0#E0", dfs);
+        compare("00.0#E0: 0.0", df.format(0.0), "00.0E0");
+        compare("00.0#E0: 1.0", df.format(1.0), "10.0E-1");
+        compare("00.0#E0: 12.0", df.format(12.0), "12.0E0");
+        compare("00.0#E0: 123.0", df.format(123.0), "12.3E1");
+        compare("00.0#E0: 1234.0", df.format(1234.0), "12.34E2");
+        compare("00.0#E0: 12346.0", df.format(12346.0), "12.35E3");
+        compare("00.0#E0: 99999.0", df.format(99999.0), "10.0E4");
+        compare("00.0#E0: 1.2", df.format(1.2), "12.0E-1");
+        compare("00.0#E0: 12.3", df.format(12.3), "12.3E0");
+        compare("00.0#E0: 123.4", df.format(123.4), "12.34E1");
+        compare("00.0#E0: 1234.6", df.format(1234.6), "12.35E2");
+        compare("00.0#E0: 9999.9", df.format(9999.9), "10.0E3");
+        compare("00.0#E0: 0.1", df.format(0.1), "10.0E-2");
+        compare("00.0#E0: 0.12", df.format(0.12), "12.0E-2");
+        compare("00.0#E0: 0.123", df.format(0.123), "12.3E-2");
+        compare("00.0#E0: 0.1234", df.format(0.1234), "12.34E-2");
+        compare("00.0#E0: 0.12346", df.format(0.12346), "12.35E-2");
+        compare("00.0#E0: 0.99999", df.format(0.99999), "10.0E-1");
+        compare("00.0#E0: -0.0", df.format(-0.0), "-00.0E0");
+        compare("00.0#E0: -1.0", df.format(-1.0), "-10.0E-1");
+        compare("00.0#E0: -12.0", df.format(-12.0), "-12.0E0");
+        compare("00.0#E0: -123.0", df.format(-123.0), "-12.3E1");
+        compare("00.0#E0: -1234.0", df.format(-1234.0), "-12.34E2");
+        compare("00.0#E0: -12346.0", df.format(-12346.0), "-12.35E3");
+        compare("00.0#E0: -99999.0", df.format(-99999.0), "-10.0E4");
+
+        df = new DecimalFormat("##0.0E0", dfs);
+        compare("##0.0E0: -0.0", df.format(-0.0), "-0.0E0");
+        compare("##0.0E0: 0.0", df.format(0.0), "0.0E0");
+        compare("##0.0E0: 1.0", df.format(1.0), "1.0E0");
+        compare("##0.0E0: 12.0", df.format(12.0), "12E0");
+        compare("##0.0E0: 123.0", df.format(123.0), "123E0");  // Android fails, here!
+        compare("##0.0E0: 1234.0", df.format(1234.0), "1.234E3");
+        compare("##0.0E0: 12346.0", df.format(12346.0), "12.35E3");
+        // Fails in JDK 1.2.2
+        if (!compare(failCount, df.format(99999.0), "100E3"))
+            failures.set(failCount);
+        failCount++;
+        compare("##0.0E0: 999999.0", df.format(999999.0), "1.0E6");
+
+        df = new DecimalFormat("#00.0##E0", dfs);
+        compare("#00.0##E0: 0.1", df.format(0.1), "100E-3");
+        compare("#00.0##E0: 0.12", df.format(0.12), "120E-3");
+        compare("#00.0##E0: 0.123", df.format(0.123), "123E-3");
+        compare("#00.0##E0: 0.1234", df.format(0.1234), "123.4E-3");
+        compare("#00.0##E0: 0.1234567", df.format(0.1234567), "123.457E-3");
+        compare("#00.0##E0: 0.01", df.format(0.01), "10.0E-3");
+        compare("#00.0##E0: 0.012", df.format(0.012), "12.0E-3");
+        compare("#00.0##E0: 0.0123", df.format(0.0123), "12.3E-3");
+        compare("#00.0##E0: 0.01234", df.format(0.01234), "12.34E-3");
+        compare("#00.0##E0: 0.01234567", df.format(0.01234567), "12.3457E-3");
+        compare("#00.0##E0: 0.001", df.format(0.001), "1.00E-3");
+        compare("#00.0##E0: 0.0012", df.format(0.0012), "1.20E-3");
+        compare("#00.0##E0: 0.00123", df.format(0.00123), "1.23E-3");
+        compare("#00.0##E0: 0.001234", df.format(0.001234), "1.234E-3");
+        compare("#00.0##E0: 0.001234567", df.format(0.001234567), "1.23457E-3");
+        compare("#00.0##E0: 0.0001", df.format(0.0001), "100E-6");
+        compare("#00.0##E0: 0.00012", df.format(0.00012), "120E-6");
+        compare("#00.0##E0: 0.000123", df.format(0.000123), "123E-6");
+        compare("#00.0##E0: 0.0001234", df.format(0.0001234), "123.4E-6");
+        compare("#00.0##E0: 0.0001234567", df.format(0.0001234567),
+                "123.457E-6");
+
+        // Fails in JDK 1.2.2
+        if (!compare(failCount, df.format(0.0), "0.00E0"))
+            failures.set(failCount);
+        failCount++;
+        compare("#00.0##E0: 1.0", df.format(1.0), "1.00E0");
+        compare("#00.0##E0: 12.0", df.format(12.0), "12.0E0");
+        compare("#00.0##E0: 123.0", df.format(123.0), "123E0");
+        compare("#00.0##E0: 1234.0", df.format(1234.0), "1.234E3");
+        compare("#00.0##E0: 12345.0", df.format(12345.0), "12.345E3");
+        compare("#00.0##E0: 123456.0", df.format(123456.0), "123.456E3");
+        compare("#00.0##E0: 1234567.0", df.format(1234567.0), "1.23457E6");
+        compare("#00.0##E0: 12345678.0", df.format(12345678.0), "12.3457E6");
+        compare("#00.0##E0: 99999999.0", df.format(99999999.0), "100E6");
+
+        df = new DecimalFormat("#.0E0", dfs);
+        compare("#.0E0: -0.0", df.format(-0.0), "-.0E0");
+        compare("#.0E0: 0.0", df.format(0.0), ".0E0");
+        compare("#.0E0: 1.0", df.format(1.0), ".1E1");
+        compare("#.0E0: 12.0", df.format(12.0), ".12E2");
+        compare("#.0E0: 123.0", df.format(123.0), ".12E3");
+        compare("#.0E0: 1234.0", df.format(1234.0), ".12E4");
+        compare("#.0E0: 9999.0", df.format(9999.0), ".1E5");
+
+        df = new DecimalFormat("0.#E0", dfs);
+        compare("0.#E0: -0.0", df.format(-0.0), "-0E0");
+        compare("0.#E0: 0.0", df.format(0.0), "0E0");
+        compare("0.#E0: 1.0", df.format(1.0), "1E0");
+        compare("0.#E0: 12.0", df.format(12.0), "1.2E1");
+        compare("0.#E0: 123.0", df.format(123.0), "1.2E2");
+        compare("0.#E0: 1234.0", df.format(1234.0), "1.2E3");
+        compare("0.#E0: 9999.0", df.format(9999.0), "1E4");
+
+        df = new DecimalFormat(".0E0", dfs);
+        compare(".0E0: -0.0", df.format(-0.0), "-.0E0");
+        compare(".0E0: 0.0", df.format(0.0), ".0E0");
+        compare(".0E0: 1.0", df.format(1.0), ".1E1");
+        compare(".0E0: 12.0", df.format(12.0), ".1E2");
+        compare(".0E0: 123.0", df.format(123.0), ".1E3");
+        compare(".0E0: 1234.0", df.format(1234.0), ".1E4");
+        compare(".0E0: 9999.0", df.format(9999.0), ".1E5");
+
+        df = new DecimalFormat("0.E0", dfs);
+        // Fails in JDK 1.2.2
+        if (!compare(failCount, df.format(0.0), "0.E0"))
+            failures.set(failCount);
+        failCount++;
+        if (!compare(failCount, df.format(1.0), "1.E0"))
+            failures.set(failCount);
+        failCount++;
+        if (!compare(failCount, df.format(12.0), "1.E1"))
+            failures.set(failCount);
+        failCount++;
+        if (!compare(failCount, df.format(123.0), "1.E2"))
+            failures.set(failCount);
+        failCount++;
+        if (!compare(failCount, df.format(1234.0), "1.E3"))
+            failures.set(failCount);
+        failCount++;
+        if (!compare(failCount, df.format(9999.0), "1.E4"))
+            failures.set(failCount);
+        failCount++;
+
+        df = new DecimalFormat("##0.00#E0", dfs);
+        compare("##0.00#E0: 0.1", df.format(0.1), "100E-3");
+        compare("##0.00#E0: 0.1234567", df.format(0.1234567), "123.457E-3");
+        compare("##0.00#E0: 0.9999999", df.format(0.9999999), "1.00E0");
+        compare("##0.00#E0: 0.01", df.format(0.01), "10.0E-3");
+        compare("##0.00#E0: 0.01234567", df.format(0.01234567), "12.3457E-3");
+        compare("##0.00#E0: 0.09999999", df.format(0.09999999), "100E-3");
+        compare("##0.00#E0: 0.001", df.format(0.001), "1.00E-3");
+        compare("##0.00#E0: 0.001234567", df.format(0.001234567), "1.23457E-3");
+        compare("##0.00#E0: 0.009999999", df.format(0.009999999), "10.0E-3");
+        compare("##0.00#E0: 0.0001", df.format(0.0001), "100E-6");
+        compare("##0.00#E0: 0.0001234567", df.format(0.0001234567),
+                "123.457E-6");
+        compare("##0.00#E0: 0.0009999999", df.format(0.0009999999), "1.00E-3");
+
+        df = new DecimalFormat("###0.00#E0", dfs);
+        compare("###0.00#E0: 0.1", df.format(0.1), "1000E-4");
+        compare("###0.00#E0: 0.12345678", df.format(0.12345678), "1234.568E-4");
+        compare("###0.00#E0: 0.99999999", df.format(0.99999999), "1.00E0");
+        compare("###0.00#E0: 0.01", df.format(0.01), "100E-4");
+        compare("###0.00#E0: 0.012345678", df.format(0.012345678),
+                "123.4568E-4");
+        compare("###0.00#E0: 0.099999999", df.format(0.099999999), "1000E-4");
+        compare("###0.00#E0: 0.001", df.format(0.001), "10.0E-4");
+        compare("###0.00#E0: 0.0012345678", df.format(0.0012345678),
+                "12.34568E-4");
+        compare("###0.00#E0: 0.0099999999", df.format(0.0099999999), "100E-4");
+        compare("###0.00#E0: 0.0001", df.format(0.0001), "1.00E-4");
+        compare("###0.00#E0: 0.00012345678", df.format(0.00012345678),
+                "1.234568E-4");
+        compare("###0.00#E0: 0.00099999999", df.format(0.00099999999),
+                "10.0E-4");
+        // Fails in JDK 1.2.2
+        if (!compare(failCount, df.format(0.00001), "1000E-8"))
+            failures.set(failCount);
+        failCount++;
+        compare("###0.00#E0: 0.000012345678", df.format(0.000012345678),
+                "1234.568E-8");
+        compare("###0.00#E0: 0.000099999999", df.format(0.000099999999),
+                "1.00E-4");
+
+        df = new DecimalFormat("###0.0#E0", dfs);
+        compare("###0.0#E0: 0.1", df.format(0.1), "1000E-4");
+        compare("###0.0#E0: 0.1234567", df.format(0.1234567), "1234.57E-4");
+        compare("###0.0#E0: 0.9999999", df.format(0.9999999), "1.0E0");
+        // Fails in JDK 1.2.2
+        if (!compare(failCount, df.format(0.01), "100E-4"))
+            failures.set(failCount);
+        failCount++;
+        compare("###0.0#E0: 0.01234567", df.format(0.01234567), "123.457E-4");
+        compare("###0.0#E0: 0.09999999", df.format(0.09999999), "1000E-4");
+        compare("###0.0#E0: 0.001", df.format(0.001), "10E-4");
+        compare("###0.0#E0: 0.001234567", df.format(0.001234567), "12.3457E-4");
+        // Fails in JDK 1.2.2
+        if (!compare(failCount, df.format(0.009999999), "100E-4"))
+            failures.set(failCount);
+        failCount++;
+        compare("###0.0#E0: 0.0001", df.format(0.0001), "1.0E-4");
+        compare("###0.0#E0: 0.0001234567", df.format(0.0001234567),
+                "1.23457E-4");
+        compare("###0.0#E0: 0.0009999999", df.format(0.0009999999), "10E-4");
+        // Fails in JDK 1.2.2
+        if (!compare(failCount, df.format(0.00001), "1000E-8"))
+            failures.set(failCount);
+        failCount++;
+        compare("###0.0#E0: 0.00001234567", df.format(0.00001234567),
+                "1234.57E-8");
+        compare("###0.0#E0: 0.00009999999", df.format(0.00009999999), "1.0E-4");
+
+        assertTrue("Failed " + failures + " of " + failCount,
+                failures.length() == 0);
+
+        String formatString = "##0.#";
+        df = new DecimalFormat(formatString, dfs);
+        df.setMinimumFractionDigits(30);
+        compare(formatString + ": 0.000000000000000000000000000000", df
+                .format(0.0), "0.000000000000000000000000000000");
+        compare(formatString + ": -0.000000000000000000000000000000", df
+                .format(-0.0), "-0.000000000000000000000000000000");
+        compare(formatString + ": 1.000000000000000000000000000000", df
+                .format(1.0), "1.000000000000000000000000000000");
+        compare(formatString + ": -1.000000000000000000000000000000", df
+                .format(-1.0), "-1.000000000000000000000000000000");
+
+        df = new DecimalFormat(formatString);
+        df.setMaximumFractionDigits(30);
+        compare(formatString + ": 0", df.format(0.0), "0");
+        compare(formatString + ": -0", df.format(-0.0), "-0");
+        compare(formatString + ": 1", df.format(1.0), "1");
+        compare(formatString + ": -1", df.format(-1.0), "-1");
+    }
+
+    /**
+     * @tests java.text.DecimalFormat#format(double)
+     */
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        method = "format",
+        args = {double.class}
+    )
+    public void test_formatD() {
+        DecimalFormat format = (DecimalFormat) NumberFormat
+                .getInstance(Locale.ENGLISH);
+        format.setGroupingUsed(false);
+        format.setMaximumFractionDigits(400);
+        assertEquals("123456789012345", format.format(123456789012345.));
+        assertEquals("1", "12345678901234.5", format.format(12345678901234.5));
+        assertEquals("2", "1234567890123.25", format.format(1234567890123.25));
+        assertEquals("3", "999999999999.375", format.format(999999999999.375));
+        assertEquals("4", "99999999999.0625", format.format(99999999999.0625));
+        assertEquals("5", "9999999999.03125", format.format(9999999999.03125));
+        assertEquals("6", "999999999.015625", format.format(999999999.015625));
+        assertEquals("7", "99999999.0078125", format.format(99999999.0078125));
+        assertEquals("8", "9999999.00390625", format.format(9999999.00390625));
+        assertEquals("9", "999999.001953125", format.format(999999.001953125));
+        assertEquals("10", "9999.00048828125", format.format(9999.00048828125));
+        assertEquals("11", "999.000244140625", format.format(999.000244140625));
+        assertEquals("12", "99.0001220703125", format.format(99.0001220703125));
+        assertEquals("13", "9.00006103515625", format.format(9.00006103515625));
+        assertEquals("14", "0.000030517578125", format.format(0.000030517578125));
+    }
+
+
+    /**
+     * @tests java.text.DecimalFormat#getNegativePrefix() Test of method
+     *        java.text.DecimalFormat#getNegativePrefix().
+     */
+    @TestTargets({
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            notes = "",
+            method = "getNegativePrefix",
+            args = {}
+        ),
+        @TestTargetNew(
+            level = TestLevel.COMPLETE,
+            notes = "",
+            method = "setNegativePrefix",
+            args = {java.lang.String.class}
+        )
+    })
+    public void test_getNegativePrefix() {
+        DecimalFormat df = new DecimalFormat();
+        try {
+            df.setNegativePrefix("--");
+            assertTrue("Incorrect negative prefix", df.getNegativePrefix()
+                    .equals("--"));
+        } catch (Exception e) {
+            fail("Unexpected exception " + e.toString());
+        }
+    }
+
+    /**
+     * @tests java.text.DecimalFormat#getNegativeSuffix() Test of method
+     *        java.text.DecimalFormat#getNegativeSuffix().
+     */
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "",
+        method = "getNegativeSuffix",
+        args = {}
+    )
+    public void test_getNegativeSuffix() {
+        DecimalFormat df = new DecimalFormat();
+        try {
+            df.setNegativeSuffix("&");
+            assertTrue("Incorrect negative suffix", df.getNegativeSuffix()
+                    .equals("&"));
+        } catch (Exception e) {
+            fail("Unexpected exception " + e.toString());
+        }
+    }
+
+    /**
+     * @tests java.text.DecimalFormat#getPositivePrefix() Test of method
+     *        java.text.DecimalFormat#getPositivePrefix().
+     */
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "",
+        method = "getPositivePrefix",
+        args = {}
+    )
+    public void test_getPositivePrefix() {
+        DecimalFormat df = new DecimalFormat();
+        try {
+            df.setPositivePrefix("++");
+            assertTrue("Incorrect positive prefix", df.getPositivePrefix()
+                    .equals("++"));
+        } catch (Exception e) {
+            fail("Unexpected exception " + e.toString());
+        }
+    }
+
+    /**
+     * @tests java.text.DecimalFormat#getPositiveSuffix() Test of method
+     *        java.text.DecimalFormat#getPositiveSuffix().
+     */
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "",
+        method = "getPositiveSuffix",
+        args = {}
+    )
+    public void test_getPositiveSuffix() {
+        DecimalFormat df = new DecimalFormat();
+        try {
+            df.setPositiveSuffix("%");
+            assertTrue("Incorrect positive prefix", df.getPositiveSuffix()
+                    .equals("%"));
+        } catch (Exception e) {
+            fail("Unexpected exception " + e.toString());
+        }
+    }
+
+    /**
+     * @tests java.text.DecimalFormat#hashCode() Test of method
+     *        java.text.DecimalFormat#hashCode().
+     */
+    @TestTargetNew(
+        level = TestLevel.COMPLETE,
+        notes = "",
+        method = "hashCode",
+        args = {}
+    )
+    public void test_hashCode() {
+        try {
+            DecimalFormat df1 = new DecimalFormat();
+            DecimalFormat df2 = (DecimalFormat) df1.clone();
+            assertTrue("Hash codes of equals object are not equal", df2
+                    .hashCode() == df1.hashCode());
+        } catch (Exception e) {
+            fail("Unexpected exception " + e.toString());
+        }
+    }
+
+    /**
+     * @tests java.text.DecimalFormat#parse(java.lang.String,
+     *        java.text.ParsePosition)
+     */
+    @TestTargetNew(
+        level = TestLevel.PARTIAL,
+        notes = "Vrifies boundary values.",
+        method = "parse",
+        args = {java.lang.String.class, java.text.ParsePosition.class}
+    )
+    public void test_parseLjava_lang_StringLjava_text_ParsePosition() {
+        DecimalFormat format = (DecimalFormat) NumberFormat
+                .getNumberInstance(Locale.ENGLISH);
+        ParsePosition pos = new ParsePosition(0);
+        Number result = format.parse("9223372036854775807", pos);
+        assertTrue("Wrong result type for Long.MAX_VALUE",
+                result.getClass() == Long.class);
+        assertEquals("Wrong result Long.MAX_VALUE",
+                Long.MAX_VALUE, result.longValue());
+        pos = new ParsePosition(0);
+        result = format.parse("-9223372036854775808", pos);
+        assertTrue("Wrong result type for Long.MIN_VALUE",
+                result.getClass() == Long.class);
+        assertTrue("Wrong result Long.MIN_VALUE: " + result.longValue(), result
+                .longValue() == Long.MIN_VALUE);
+        pos = new ParsePosition(0);
+        result = format.parse("9223372036854775808", pos);
+        assertTrue("Wrong result type for Long.MAX_VALUE+1",
+                result.getClass() == Double.class);
+        assertEquals("Wrong result Long.MAX_VALUE + 1",
+                (double) Long.MAX_VALUE + 1, result.doubleValue());
+        pos = new ParsePosition(0);
+        result = format.parse("-9223372036854775809", pos);
+        assertTrue("Wrong result type for Long.MIN_VALUE - 1",
+                result.getClass() == Double.class);
+        assertEquals("Wrong result Long.MIN_VALUE - 1",
+                (double) Long.MIN_VALUE - 1, result.doubleValue());
+
+        pos = new ParsePosition(0);
+        result = format.parse("18446744073709551629", pos);
+        assertTrue("Wrong result type for overflow",
+                result.getClass() == Double.class);
+        assertEquals("Wrong result for overflow",
+                18446744073709551629d, result.doubleValue());
+
+        pos = new ParsePosition(0);
+        result = format.parse("42325917317067571199", pos);
+        assertTrue("Wrong result type for overflow a: " + result, result
+                .getClass() == Double.class);
+        assertTrue("Wrong result for overflow a: " + result, result
+                .doubleValue() == 42325917317067571199d);
+        pos = new ParsePosition(0);
+        result = format.parse("4232591731706757119E1", pos);
+        assertTrue("Wrong result type for overflow b: " + result, result
+                .getClass() == Double.class);
+        assertEquals("Wrong result for overflow b: " + result,
+                42325917317067571190d, result.doubleValue());
+        pos = new ParsePosition(0);
+        result = format.parse(".42325917317067571199E20", pos);
+        assertTrue("Wrong result type for overflow c: " + result, result
+                .getClass() == Double.class);
+        assertTrue("Wrong result for overflow c: " + result, result
+                .doubleValue() == 42325917317067571199d);
+        pos = new ParsePosition(0);
+        result = format.parse("922337203685477580.9E1", pos);
+        assertTrue("Wrong result type for overflow d: " + result, result
+                .getClass() == Double.class);
+        assertTrue("Wrong result for overflow d: " + result, result
+                .doubleValue() == 9223372036854775809d);
+        pos = new ParsePosition(0);
+        result = format.parse("9.223372036854775809E18", pos);
+        assertTrue("Wrong result type for overflow e: " + result, result
+                .getClass() == Double.class);
+        assertTrue("Wrong result for overflow e: " + result, result
+                .doubleValue() == 9223372036854775809d);
+
+        // test parse with multipliers
+        format.setMultiplier(100);
+        result = format.parse("9223372036854775807", new ParsePosition(0));
+        assertTrue("Wrong result type multiplier 100: " + result, result
+                .getClass() == Long.class);
+        // RI on windows and linux both answer with a slightly rounded result
+        assertTrue("Wrong result for multiplier 100: " + result, result
+                .longValue() == 92233720368547760L);
+        format.setMultiplier(1000);
+        result = format.parse("9223372036854775807", new ParsePosition(0));
+        assertTrue("Wrong result type multiplier 1000: " + result, result
+                .getClass() == Long.class);
+        assertTrue("Wrong result for multiplier 1000: " + result, result
+                .longValue() == 9223372036854776L);
+
+        format.setMultiplier(10000);
+        result = format.parse("9223372036854775807", new ParsePosition(0));
+        assertTrue("Wrong result type multiplier 10000: " + result, result
+                .getClass() == Double.class);
+        assertTrue("Wrong result for multiplier 10000: " + result, result
+                .doubleValue() == 922337203685477.5807d);
+
+    }
+}
diff --git a/luni/src/test/java/org/apache/harmony/text/tests/java/text/NumberFormatTest.java b/luni/src/test/java/java/text/OldNumberFormatTest.java
similarity index 90%
rename from luni/src/test/java/org/apache/harmony/text/tests/java/text/NumberFormatTest.java
rename to luni/src/test/java/java/text/OldNumberFormatTest.java
index 4da671b..8609fe1 100644
--- a/luni/src/test/java/org/apache/harmony/text/tests/java/text/NumberFormatTest.java
+++ b/luni/src/test/java/java/text/OldNumberFormatTest.java
@@ -14,125 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.harmony.text.tests.java.text;
+package java.text;
 
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
 import dalvik.annotation.BrokenTest;
-import tests.support.Support_Locale;
-
-import junit.framework.TestCase;
-
-import java.text.ChoiceFormat;
-import java.text.DecimalFormat;
-import java.text.FieldPosition;
-import java.text.NumberFormat;
-import java.text.ParseException;
-import java.text.ParsePosition;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
 import java.util.Currency;
 import java.util.Locale;
+import junit.framework.TestCase;
+import tests.support.Support_Locale;
 
 @TestTargetClass(NumberFormat.class)
-public class NumberFormatTest extends TestCase {
-
-    /**
-     * @tests java.text.NumberFormat#format(java.lang.Object,
-     *        java.lang.StringBuffer, java.text.FieldPosition)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "format",
-        args = {java.lang.Object.class, java.lang.StringBuffer.class, java.text.FieldPosition.class}
-    )
-    public void test_formatLjava_lang_ObjectLjava_lang_StringBufferLjava_text_FieldPosition() {
-        FieldPosition pos;
-        StringBuffer out;
-        DecimalFormat format = (DecimalFormat) NumberFormat
-                .getInstance(Locale.US);
-
-        pos = new FieldPosition(0);
-        out = format.format(new Long(Long.MAX_VALUE), new StringBuffer(), pos);
-        assertEquals("Wrong result L1: " + out, "9,223,372,036,854,775,807",
-                out.toString());
-
-        pos = new FieldPosition(0);
-        out = format.format(new Long(Long.MIN_VALUE), new StringBuffer(), pos);
-        assertEquals("Wrong result L2: " + out, "-9,223,372,036,854,775,808",
-                out.toString());
-
-        pos = new FieldPosition(0);
-        out = format.format(new java.math.BigInteger(String
-                .valueOf(Long.MAX_VALUE)), new StringBuffer(), pos);
-        assertEquals("Wrong result BI1: " + out, "9,223,372,036,854,775,807",
-                out.toString());
-
-        pos = new FieldPosition(0);
-        out = format.format(new java.math.BigInteger(String
-                .valueOf(Long.MIN_VALUE)), new StringBuffer(), pos);
-        assertEquals("Wrong result BI2: " + out, "-9,223,372,036,854,775,808",
-                out.toString());
-
-        java.math.BigInteger big;
-        pos = new FieldPosition(0);
-        big = new java.math.BigInteger(String.valueOf(Long.MAX_VALUE))
-                .add(new java.math.BigInteger("1"));
-        out = format.format(big, new StringBuffer(), pos);
-        assertEquals("Wrong result BI3: " + out, "9,223,372,036,854,775,808",
-                out.toString());
-
-        pos = new FieldPosition(0);
-        big = new java.math.BigInteger(String.valueOf(Long.MIN_VALUE))
-                .add(new java.math.BigInteger("-1"));
-        out = format.format(big, new StringBuffer(), pos);
-        assertEquals("Wrong result BI4: " + out, "-9,223,372,036,854,775,809",
-                out.toString());
-
-        pos = new FieldPosition(0);
-        out = format.format(new java.math.BigDecimal("51.348"),
-                new StringBuffer(), pos);
-        assertEquals("Wrong result BD1: " + out, "51.348", out.toString());
-
-        pos = new FieldPosition(0);
-        out = format.format(new java.math.BigDecimal("51"), new StringBuffer(),
-                pos);
-        assertEquals("Wrong result BD2: " + out, "51", out.toString());
-
-    }
-
-    /**
-     * @tests java.text.NumberFormat#getIntegerInstance()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getIntegerInstance",
-        args = {}
-    )
-    public void test_getIntegerInstance() throws ParseException {
-        // Test for method java.text.NumberFormat getIntegerInstance()
-        Locale origLocale = Locale.getDefault();
-        Locale.setDefault(Locale.US);
-
-        DecimalFormat format = (DecimalFormat) NumberFormat
-                .getIntegerInstance();
-
-        assertEquals(
-                "Test1: NumberFormat.getIntegerInstance().toPattern() returned wrong pattern",
-                "#,##0", format.toPattern());
-        assertEquals(
-                "Test2: NumberFormat.getIntegerInstance().format(35.76) returned wrong value",
-                "36", format.format(35.76));
-        assertEquals(
-                "Test3: NumberFormat.getIntegerInstance().parse(\"35.76\") returned wrong number",
-                new Long(35), format.parse("35.76"));
-        assertEquals(
-                "Test4: NumberFormat.getIntegerInstance().parseObject(\"35.76\") returned wrong number",
-                new Long(35), format.parseObject("35.76"));
-        Locale.setDefault(origLocale);
-    }
+public class OldNumberFormatTest extends TestCase {
 
     /**
      * @tests java.text.NumberFormat#getIntegerInstance(java.util.Locale)
@@ -226,33 +120,6 @@
     }
 
     /**
-     * @tests java.text.NumberFormat#getCurrency()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getCurrency",
-        args = {}
-    )
-    public void test_getCurrency() {
-        // Test for method java.util.Currency getCurrency()
-
-        // a subclass that supports currency formatting
-        Currency currH = Currency.getInstance("HUF");
-        NumberFormat format = NumberFormat.getInstance(new Locale("hu", "HU"));
-        assertSame("Returned incorrect currency", currH, format.getCurrency());
-
-        // a subclass that doesn't support currency formatting
-        ChoiceFormat cformat = new ChoiceFormat(
-                "0#Less than one|1#one|1<Between one and two|2<Greater than two");
-        try {
-            ((NumberFormat) cformat).getCurrency();
-            fail("Expected UnsupportedOperationException");
-        } catch (UnsupportedOperationException e) {
-        }
-    }
-
-    /**
      * @tests java.text.NumberFormat#setMaximumIntegerDigits()
      */
     @TestTargetNew(
diff --git a/luni/src/test/java/java/text/OldSimpleDateFormatTest.java b/luni/src/test/java/java/text/OldSimpleDateFormatTest.java
new file mode 100644
index 0000000..5356ddf
--- /dev/null
+++ b/luni/src/test/java/java/text/OldSimpleDateFormatTest.java
@@ -0,0 +1,526 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package java.text;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Locale;
+import java.util.SimpleTimeZone;
+import java.util.TimeZone;
+
+public class OldSimpleDateFormatTest extends junit.framework.TestCase {
+
+    static SimpleDateFormat format = new SimpleDateFormat("", Locale.ENGLISH);
+
+    static SimpleDateFormat pFormat = new SimpleDateFormat("", Locale.ENGLISH);
+
+    static class TestFormat extends junit.framework.TestCase {
+        boolean testsFailed = false;
+
+        public TestFormat(String name) {
+            super(name);
+        }
+
+        public void test(String pattern, Calendar cal, String expected,
+                int field) {
+            StringBuffer buffer = new StringBuffer();
+            FieldPosition position = new FieldPosition(field);
+            format.applyPattern(pattern);
+            format.format(cal.getTime(), buffer, position);
+            String result = buffer.toString();
+            if (!System.getProperty("java.vendor", "None").substring(0, 3)
+                    .equals("Sun")) {
+                assertTrue("Wrong format: \"" + pattern + "\" expected: "
+                        + expected + " result: " + result, result
+                        .equals(expected));
+                assertTrue("Wrong begin position: " + pattern + " expected: "
+                        + expected + " field: " + field, position
+                        .getBeginIndex() == 1);
+                assertTrue("Wrong end position: " + pattern + " expected: "
+                        + expected + " field: " + field,
+                        position.getEndIndex() == result.length());
+            } else {
+                // Print the failure but don't use assert as this
+                // will stop subsequent tests from running
+                if (!result.equals(expected)) {
+                    System.out
+                            .println("Wrong format: \"" + pattern
+                                    + "\" expected: " + expected + " result: "
+                                    + result);
+                    testsFailed = true;
+                }
+            }
+        }
+
+        public void parse(String pattern, String input, Date expected,
+                int start, int end) {
+            pFormat.applyPattern(pattern);
+            ParsePosition position = new ParsePosition(start);
+            Date result = pFormat.parse(input, position);
+            assertTrue("Wrong result: " + pattern + " input: " + input
+                    + " expected: " + expected + " result: " + result, expected
+                    .equals(result));
+            assertTrue("Wrong end position: " + pattern + " input: " + input,
+                    position.getIndex() == end);
+        }
+
+        public void verifyFormatTimezone(String timeZoneId, String expected1,
+                String expected2, Date date) {
+            format.setTimeZone(SimpleTimeZone.getTimeZone(timeZoneId));
+            format.applyPattern("z, zzzz");
+            assertEquals("Test z for TimeZone : " + timeZoneId, expected1,
+                    format.format(date));
+
+            format.applyPattern("Z, ZZZZ");
+            assertEquals("Test Z for TimeZone : " + timeZoneId, expected2,
+                    format.format(date));
+        }
+    }
+
+    /**
+     * @tests java.text.SimpleDateFormat#SimpleDateFormat(java.lang.String,
+     *        java.text.DateFormatSymbols)
+     */
+    public void test_ConstructorLjava_lang_StringLjava_text_DateFormatSymbols() {
+        // Test for method java.text.SimpleDateFormat(java.lang.String,
+        // java.text.DateFormatSymbols)
+        DateFormatSymbols symbols = new DateFormatSymbols(Locale.ENGLISH);
+        symbols.setEras(new String[] { "Before", "After" });
+        SimpleDateFormat f2 = new SimpleDateFormat("y'y'yy", symbols);
+        assertTrue("Wrong class", f2.getClass() == SimpleDateFormat.class);
+        assertEquals("Wrong pattern", "y'y'yy", f2.toPattern());
+        assertTrue("Wrong symbols", f2.getDateFormatSymbols().equals(symbols));
+        assertTrue("Doesn't work",
+                f2.format(new Date()).getClass() == String.class);
+
+        try {
+            new SimpleDateFormat(null, symbols);
+            fail("NullPointerException was not thrown.");
+        } catch(NullPointerException npe) {
+            //expected
+        }
+
+        try {
+            new SimpleDateFormat("eee", symbols);
+            fail("IllegalArgumentException was not thrown.");
+        } catch(IllegalArgumentException iae) {
+            //expected
+        }
+    }
+
+    public void test_ConstructorLjava_lang_StringLjava_util_Locale() {
+        // Test for method java.text.SimpleDateFormat(java.lang.String,
+        // java.util.Locale)
+        SimpleDateFormat f2 = new SimpleDateFormat("'yyyy' MM yy",
+                Locale.GERMAN);
+        assertTrue("Wrong class", f2.getClass() == SimpleDateFormat.class);
+        assertEquals("Wrong pattern", "'yyyy' MM yy", f2.toPattern());
+        assertTrue("Wrong symbols", f2.getDateFormatSymbols().equals(
+                new DateFormatSymbols(Locale.GERMAN)));
+        assertTrue("Doesn't work",
+                f2.format(new Date()).getClass() == String.class);
+
+        try {
+            new SimpleDateFormat(null, Locale.GERMAN);
+            fail("NullPointerException was not thrown.");
+        } catch(NullPointerException npe) {
+            //expected
+        }
+        try {
+            new SimpleDateFormat("eee", Locale.GERMAN);
+            fail("IllegalArgumentException was not thrown.");
+        } catch(IllegalArgumentException iae) {
+            //expected
+        }
+    }
+
+    public void test_applyLocalizedPatternLjava_lang_String() {
+        // Test for method void
+        // java.text.SimpleDateFormat.applyLocalizedPattern(java.lang.String)
+        SimpleDateFormat f2 = new SimpleDateFormat("y", new Locale("de", "CH"));
+        // BEGIN android-removed
+        // This test doesn't work like this. The cause lies inside of icu
+        // that doesn't support localized pattern characters anymore. So this
+        // test fails because the pattern template contains characters that are
+        // not part of the standard pattern returned for every locale.
+        // The default pattern characters are: GyMdkHmsSEDFwWahKzZ
+        //
+        // f2.applyLocalizedPattern("GuMtkHmsSEDFwWahKz");
+        // String pattern = f2.toPattern();
+        // assertTrue("Wrong pattern: " + pattern, pattern
+        //         .equals("GyMdkHmsSEDFwWahKz"));
+        //
+        // test the new "Z" pattern char
+        // f2 = new SimpleDateFormat("y", new Locale("de", "CH"));
+        // f2.applyLocalizedPattern("G u M t Z");
+        // pattern = f2.toPattern();
+        // assertTrue("Wrong pattern: " + pattern, pattern.equals("G y M d Z"));
+        // END android-removed
+
+        // test invalid patterns
+        try {
+            f2.applyLocalizedPattern("b");
+            fail("Expected IllegalArgumentException for pattern with invalid pattern letter: b");
+        } catch (IllegalArgumentException e) {
+        }
+
+        try {
+            // ICU only! this fails on the RI
+            f2.applyLocalizedPattern("u");
+            fail("Expected IllegalArgumentException for pattern with invalid pattern letter: u");
+        } catch (IllegalArgumentException e) {
+        }
+
+        try {
+            f2.applyLocalizedPattern("a '");
+            fail("Expected IllegalArgumentException for pattern with unterminated quote: a '");
+        } catch (IllegalArgumentException e) {
+        }
+
+        try {
+            f2.applyLocalizedPattern(null);
+            fail("Expected NullPointerException for null pattern");
+        } catch (NullPointerException e) {
+        }
+    }
+
+    /**
+     * @tests java.text.SimpleDateFormat#applyPattern(java.lang.String)
+     */
+    public void test_applyPatternLjava_lang_String() {
+        // Test for method void
+        // java.text.SimpleDateFormat.applyPattern(java.lang.String)
+        SimpleDateFormat f2 = new SimpleDateFormat("y", new Locale("de", "CH"));
+        // BEGIN android-changed
+        f2.applyPattern("GyMdkHmsSEDFwWahKzZ");
+        assertEquals("Wrong pattern", "GyMdkHmsSEDFwWahKzZ", f2.toPattern());
+        // END android-changed
+
+        // test invalid patterns
+        try {
+            f2.applyPattern("u");
+            fail("Expected IllegalArgumentException for pattern with invalid patter letter: u");
+        } catch (IllegalArgumentException e) {
+        }
+    }
+
+    public void test_hashCode() {
+        SimpleDateFormat format = (SimpleDateFormat) DateFormat.getInstance();
+        SimpleDateFormat clone = (SimpleDateFormat) format.clone();
+        assertTrue("clone has not equal hash code", clone.hashCode() == format
+                .hashCode());
+        format.format(new Date());
+        assertTrue("clone has not equal hash code after format", clone
+                .hashCode() == format.hashCode());
+        DateFormatSymbols symbols = new DateFormatSymbols(Locale.ENGLISH);
+        symbols.setEras(new String[] { "Before", "After" });
+        SimpleDateFormat format2 = new SimpleDateFormat("y'y'yy", symbols);
+        assertFalse("objects has equal hash code", format2.hashCode() == format
+                .hashCode());
+    }
+
+    public void test_formatLjava_util_DateLjava_lang_StringBufferLjava_text_FieldPosition() {
+        // Test for method java.lang.StringBuffer
+        // java.text.SimpleDateFormat.format(java.util.Date,
+        // java.lang.StringBuffer, java.text.FieldPosition)
+
+        // Android doesn't support EST time zone
+        // new Support_SimpleDateFormat(
+        //        "test_formatLjava_util_DateLjava_lang_StringBufferLjava_text_FieldPosition")
+        //        .t_format_with_FieldPosition();
+
+        TestFormat test = new TestFormat(
+                "test_formatLjava_util_DateLjava_lang_StringBufferLjava_text_FieldPosition");
+
+        Calendar cal = new GregorianCalendar(1999, Calendar.JUNE, 2, 15, 3, 6);
+        test.test(" G", cal, " AD", DateFormat.ERA_FIELD);
+        test.test(" GG", cal, " AD", DateFormat.ERA_FIELD);
+        test.test(" GGG", cal, " AD", DateFormat.ERA_FIELD);
+        test.test(" G", new GregorianCalendar(-1999, Calendar.JUNE, 2), " BC",
+                DateFormat.ERA_FIELD);
+
+        test.test(" y", cal, " 99", DateFormat.YEAR_FIELD);
+        test.test(" yy", cal, " 99", DateFormat.YEAR_FIELD);
+        test.test(" yy", new GregorianCalendar(2001, Calendar.JUNE, 2), " 01",
+                DateFormat.YEAR_FIELD);
+        test.test(" yy", new GregorianCalendar(2000, Calendar.JUNE, 2), " 00",
+                DateFormat.YEAR_FIELD);
+        test.test(" yyy", new GregorianCalendar(2000, Calendar.JUNE, 2), " 00",
+                DateFormat.YEAR_FIELD);
+        test.test(" yyy", cal, " 99", DateFormat.YEAR_FIELD);
+        test.test(" yyyy", cal, " 1999", DateFormat.YEAR_FIELD);
+        test.test(" yyyyy", cal, " 01999", DateFormat.YEAR_FIELD);
+
+        test.test(" M", cal, " 6", DateFormat.MONTH_FIELD);
+        test.test(" M", new GregorianCalendar(1999, Calendar.NOVEMBER, 2),
+                " 11", DateFormat.MONTH_FIELD);
+        test.test(" MM", cal, " 06", DateFormat.MONTH_FIELD);
+        test.test(" MMM", cal, " Jun", DateFormat.MONTH_FIELD);
+        test.test(" MMMM", cal, " June", DateFormat.MONTH_FIELD);
+        test.test(" MMMMM", cal, " June", DateFormat.MONTH_FIELD);
+
+        test.test(" d", cal, " 2", DateFormat.DATE_FIELD);
+        test.test(" d", new GregorianCalendar(1999, Calendar.NOVEMBER, 12),
+                " 12", DateFormat.DATE_FIELD);
+        test.test(" dd", cal, " 02", DateFormat.DATE_FIELD);
+        test.test(" dddd", cal, " 0002", DateFormat.DATE_FIELD);
+
+        test.test(" h", cal, " 3", DateFormat.HOUR1_FIELD);
+        test.test(" h", new GregorianCalendar(1999, Calendar.NOVEMBER, 12),
+                " 12", DateFormat.HOUR1_FIELD);
+        test.test(" hh", cal, " 03", DateFormat.HOUR1_FIELD);
+        test.test(" hhhh", cal, " 0003", DateFormat.HOUR1_FIELD);
+
+        test.test(" H", cal, " 15", DateFormat.HOUR_OF_DAY0_FIELD);
+        test.test(" H",
+                new GregorianCalendar(1999, Calendar.NOVEMBER, 12, 4, 0), " 4",
+                DateFormat.HOUR_OF_DAY0_FIELD);
+        test.test(" H", new GregorianCalendar(1999, Calendar.NOVEMBER, 12, 12,
+                0), " 12", DateFormat.HOUR_OF_DAY0_FIELD);
+        test.test(" H", new GregorianCalendar(1999, Calendar.NOVEMBER, 12),
+                " 0", DateFormat.HOUR_OF_DAY0_FIELD);
+        test.test(" HH", cal, " 15", DateFormat.HOUR_OF_DAY0_FIELD);
+        test.test(" HHHH", cal, " 0015", DateFormat.HOUR_OF_DAY0_FIELD);
+
+        test.test(" m", cal, " 3", DateFormat.MINUTE_FIELD);
+        test.test(" m", new GregorianCalendar(1999, Calendar.NOVEMBER, 12, 4,
+                47), " 47", DateFormat.MINUTE_FIELD);
+        test.test(" mm", cal, " 03", DateFormat.MINUTE_FIELD);
+        test.test(" mmmm", cal, " 0003", DateFormat.MINUTE_FIELD);
+
+        test.test(" s", cal, " 6", DateFormat.SECOND_FIELD);
+        test.test(" s", new GregorianCalendar(1999, Calendar.NOVEMBER, 12, 4,
+                47, 13), " 13", DateFormat.SECOND_FIELD);
+        test.test(" ss", cal, " 06", DateFormat.SECOND_FIELD);
+        test.test(" ssss", cal, " 0006", DateFormat.SECOND_FIELD);
+
+        test.test(" S", cal, " 0", DateFormat.MILLISECOND_FIELD);
+        Calendar temp = new GregorianCalendar();
+        temp.set(Calendar.MILLISECOND, 961);
+
+        test.test(" SS", temp, " 961", DateFormat.MILLISECOND_FIELD);
+        test.test(" SSSS", cal, " 0000", DateFormat.MILLISECOND_FIELD);
+
+        test.test(" SS", cal, " 00", DateFormat.MILLISECOND_FIELD);
+
+        test.test(" E", cal, " Wed", DateFormat.DAY_OF_WEEK_FIELD);
+        test.test(" EE", cal, " Wed", DateFormat.DAY_OF_WEEK_FIELD);
+        test.test(" EEE", cal, " Wed", DateFormat.DAY_OF_WEEK_FIELD);
+        test.test(" EEEE", cal, " Wednesday", DateFormat.DAY_OF_WEEK_FIELD);
+        test.test(" EEEEE", cal, " Wednesday", DateFormat.DAY_OF_WEEK_FIELD);
+
+        test.test(" D", cal, " 153", DateFormat.DAY_OF_YEAR_FIELD);
+        test.test(" DD", cal, " 153", DateFormat.DAY_OF_YEAR_FIELD);
+        test.test(" DDDD", cal, " 0153", DateFormat.DAY_OF_YEAR_FIELD);
+
+        test.test(" F", cal, " 1", DateFormat.DAY_OF_WEEK_IN_MONTH_FIELD);
+        test.test(" F", new GregorianCalendar(1999, Calendar.NOVEMBER, 14),
+                " 2", DateFormat.DAY_OF_WEEK_IN_MONTH_FIELD);
+        test.test(" FF", cal, " 01", DateFormat.DAY_OF_WEEK_IN_MONTH_FIELD);
+        test.test(" FFFF", cal, " 0001", DateFormat.DAY_OF_WEEK_IN_MONTH_FIELD);
+
+        test.test(" w", cal, " 23", DateFormat.WEEK_OF_YEAR_FIELD);
+        test.test(" ww", cal, " 23", DateFormat.WEEK_OF_YEAR_FIELD);
+        test.test(" wwww", cal, " 0023", DateFormat.WEEK_OF_YEAR_FIELD);
+
+        test.test(" W", cal, " 1", DateFormat.WEEK_OF_MONTH_FIELD);
+        test.test(" W", new GregorianCalendar(1999, Calendar.NOVEMBER, 14),
+                " 3", DateFormat.WEEK_OF_MONTH_FIELD);
+        test.test(" WW", cal, " 01", DateFormat.WEEK_OF_MONTH_FIELD);
+        test.test(" WWWW", cal, " 0001", DateFormat.WEEK_OF_MONTH_FIELD);
+
+        test.test(" a", cal, " PM", DateFormat.AM_PM_FIELD);
+        test.test(" a", new GregorianCalendar(1999, Calendar.NOVEMBER, 14),
+                " AM", DateFormat.AM_PM_FIELD);
+        test.test(" a", new GregorianCalendar(1999, Calendar.NOVEMBER, 14, 12,
+                0), " PM", DateFormat.AM_PM_FIELD);
+        test.test(" aa", cal, " PM", DateFormat.AM_PM_FIELD);
+        test.test(" aaa", cal, " PM", DateFormat.AM_PM_FIELD);
+        test.test(" aaaa", cal, " PM", DateFormat.AM_PM_FIELD);
+        test.test(" aaaaa", cal, " PM", DateFormat.AM_PM_FIELD);
+
+        test.test(" k", cal, " 15", DateFormat.HOUR_OF_DAY1_FIELD);
+        test.test(" k",
+                new GregorianCalendar(1999, Calendar.NOVEMBER, 12, 4, 0), " 4",
+                DateFormat.HOUR_OF_DAY1_FIELD);
+        test.test(" k", new GregorianCalendar(1999, Calendar.NOVEMBER, 12, 12,
+                0), " 12", DateFormat.HOUR_OF_DAY1_FIELD);
+        test.test(" k", new GregorianCalendar(1999, Calendar.NOVEMBER, 12),
+                " 24", DateFormat.HOUR_OF_DAY1_FIELD);
+        test.test(" kk", cal, " 15", DateFormat.HOUR_OF_DAY1_FIELD);
+        test.test(" kkkk", cal, " 0015", DateFormat.HOUR_OF_DAY1_FIELD);
+
+        test.test(" K", cal, " 3", DateFormat.HOUR0_FIELD);
+        test.test(" K", new GregorianCalendar(1999, Calendar.NOVEMBER, 12),
+                " 0", DateFormat.HOUR0_FIELD);
+        test.test(" KK", cal, " 03", DateFormat.HOUR0_FIELD);
+        test.test(" KKKK", cal, " 0003", DateFormat.HOUR0_FIELD);
+
+        format.setTimeZone(new SimpleTimeZone(60000, "ONE MINUTE"));
+        test.test(" z", cal, " GMT+00:01", DateFormat.TIMEZONE_FIELD);
+        test.test(" zzzz", cal, " GMT+00:01", DateFormat.TIMEZONE_FIELD);
+        format.setTimeZone(new SimpleTimeZone(5400000, "ONE HOUR, THIRTY"));
+        test.test(" z", cal, " GMT+01:30", DateFormat.TIMEZONE_FIELD);
+        format
+                .setTimeZone(new SimpleTimeZone(-5400000,
+                        "NEG ONE HOUR, THIRTY"));
+        test.test(" z", cal, " GMT-01:30", DateFormat.TIMEZONE_FIELD);
+
+        format.applyPattern("'Mkz''':.@5");
+        assertEquals("Wrong output", "Mkz':.@5", format.format(new Date()));
+
+        //assertTrue("Tests failed", !test.testsFailed());
+
+        // Test invalid args to format.
+        SimpleDateFormat dateFormat = new SimpleDateFormat();
+        try {
+            dateFormat.format(null, new StringBuffer(), new FieldPosition(1));
+            fail("Expected test to throw NPE.");
+        } catch (NullPointerException ex) {
+            // expected
+        } catch (Throwable ex) {
+            fail("Expected test to throw NPE, not " + ex.getClass().getName());
+        }
+
+        format.setTimeZone(TimeZone.getTimeZone("EST"));
+        test.test(" z", cal, " EDT", DateFormat.TIMEZONE_FIELD);
+        Calendar temp2 = new GregorianCalendar(1999, Calendar.JANUARY, 12);
+        test.test(" z", temp2, " EST", DateFormat.TIMEZONE_FIELD);
+        test.test(" zz", cal, " EDT", DateFormat.TIMEZONE_FIELD);
+        test.test(" zzz", cal, " EDT", DateFormat.TIMEZONE_FIELD);
+        test.test(" zzzz", cal, " Eastern Daylight Time",
+                DateFormat.TIMEZONE_FIELD);
+        test.test(" zzzz", temp2, " Eastern Standard Time",
+                DateFormat.TIMEZONE_FIELD);
+       test.test(" zzzzz", cal, " Eastern Daylight Time",
+                DateFormat.TIMEZONE_FIELD);
+    }
+
+    /**
+     * @tests java.text.SimpleDateFormat#format(java.util.Date)
+     */
+    public void test_timeZoneFormatting() {
+        // tests specific to formatting of timezones
+        Date summerDate = new GregorianCalendar(1999, Calendar.JUNE, 2, 15, 3,
+                6).getTime();
+        Date winterDate = new GregorianCalendar(1999, Calendar.JANUARY, 12)
+                .getTime();
+
+        TestFormat test = new TestFormat(
+                "test_formatLjava_util_DateLjava_lang_StringBufferLjava_text_FieldPosition");
+        test.verifyFormatTimezone("GMT-7", "GMT-07:00, GMT-07:00",
+                "-0700, -0700", summerDate);
+        test.verifyFormatTimezone("GMT-7", "GMT-07:00, GMT-07:00",
+                "-0700, -0700", winterDate);
+
+        test.verifyFormatTimezone("GMT+14", "GMT+14:00, GMT+14:00",
+                "+1400, +1400", summerDate);
+        test.verifyFormatTimezone("GMT+14", "GMT+14:00, GMT+14:00",
+                "+1400, +1400", winterDate);
+
+        test.verifyFormatTimezone("PST", "PDT, Pacific Daylight Time",
+                "-0700, -0700", summerDate);
+        test.verifyFormatTimezone("PST", "PST, Pacific Standard Time",
+                "-0800, -0800", winterDate);
+
+        // this fails on the RI!
+        test.verifyFormatTimezone("EDT", "EDT, Eastern Daylight Time",
+                "-0400, -0400", summerDate);
+        test.verifyFormatTimezone("EST", "EST, Eastern Standard Time",
+                "-0500, -0500", winterDate);
+    }
+
+    public void test_parseLjava_lang_StringLjava_text_ParsePosition_2() {
+        try {
+            format.parse("240 11 2002 March", null);
+            fail("ParsePosition is null: NullPointerException was not thrown.");
+        } catch(NullPointerException pe) {
+            //expected
+        }
+
+        try {
+            format.parse(null, new ParsePosition(0));
+            fail("String is null: NullPointerException was not thrown.");
+        } catch(NullPointerException pe) {
+            //expected
+        }
+    }
+
+    public void test_setDateFormatSymbolsLjava_text_DateFormatSymbols() {
+        // Test for method void
+        // java.text.SimpleDateFormat.setDateFormatSymbols(java.text.DateFormatSymbols)
+        SimpleDateFormat f1 = new SimpleDateFormat("a");
+        DateFormatSymbols symbols = new DateFormatSymbols();
+        symbols.setAmPmStrings(new String[] { "morning", "night" });
+        f1.setDateFormatSymbols(symbols);
+        DateFormatSymbols newSym = f1.getDateFormatSymbols();
+        assertTrue("Set incorrectly", newSym.equals(symbols));
+        assertTrue("Not a clone", f1.getDateFormatSymbols() != symbols);
+        String result = f1.format(new GregorianCalendar(1999, Calendar.JUNE,
+                12, 3, 0).getTime());
+        assertEquals("Incorrect symbols used", "morning", result);
+        symbols.setEras(new String[] { "before", "after" });
+        assertTrue("Identical symbols", !f1.getDateFormatSymbols().equals(
+                symbols));
+
+        try {
+            f1.setDateFormatSymbols(null);
+            fail("NullPointerException was not thrown.");
+        } catch(NullPointerException npe) {
+            //expected
+        }
+    }
+
+    public void test_toLocalizedPattern() {
+        // BEGIN android-changed
+        // Test for method java.lang.String
+        // java.text.SimpleDateFormat.toLocalizedPattern()
+        SimpleDateFormat f2 = new SimpleDateFormat("GyMdkHmsSEDFwWahKzZ",
+                new Locale("de", "CH"));
+        String pattern = f2.toLocalizedPattern();
+        // the default localized pattern characters are the same for all locales
+        // since icu has dropped support for this. the default pattern characters
+        // are these: GyMdkHmsSEDFwWahKz
+        // ICU only! this fails on the RI
+        assertTrue("Wrong pattern: " + pattern, pattern
+                .equals("GyMdkHmsSEDFwWahKzZ"));
+
+
+        // test the new "Z" pattern char
+        f2 = new SimpleDateFormat("G y M d Z", new Locale("de", "CH"));
+        pattern = f2.toLocalizedPattern();
+        // assertTrue("Wrong pattern: " + pattern, pattern.equals("G u M t Z"));
+        assertTrue("Wrong pattern: " + pattern, pattern.equals("G y M d Z"));
+        // END android-changed
+    }
+
+    public void test_toPattern() {
+        String pattern = "yyyy mm dd";
+        SimpleDateFormat f = new SimpleDateFormat(pattern);
+        assertEquals("Wrong pattern: " + pattern, pattern, f.toPattern());
+
+        pattern = "GyMdkHmsSEDFwWahKz";
+        f = new SimpleDateFormat("GyMdkHmsSEDFwWahKz", new Locale("de", "CH"));
+        assertTrue("Wrong pattern: " + pattern, f.toPattern().equals(pattern));
+
+        pattern = "G y M d Z";
+        f = new SimpleDateFormat(pattern, new Locale("de", "CH"));
+        pattern = f.toPattern();
+        assertTrue("Wrong pattern: " + pattern, f.toPattern().equals(pattern));
+    }
+}
diff --git a/luni/src/test/java/tests/targets/security/AlgorithmParameterGeneratorTestAES.java b/luni/src/test/java/javax/crypto/spec/AlgorithmParameterGeneratorTestAES.java
similarity index 85%
rename from luni/src/test/java/tests/targets/security/AlgorithmParameterGeneratorTestAES.java
rename to luni/src/test/java/javax/crypto/spec/AlgorithmParameterGeneratorTestAES.java
index fc7ecb2..1c1132e 100644
--- a/luni/src/test/java/tests/targets/security/AlgorithmParameterGeneratorTestAES.java
+++ b/luni/src/test/java/javax/crypto/spec/AlgorithmParameterGeneratorTestAES.java
@@ -13,9 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
+package javax.crypto.spec;
 
-import dalvik.annotation.TestTargetClass;
+import tests.security.AlgorithmParameterGeneratorTest;
+import tests.security.AlgorithmParameterSymmetricHelper;
 
 public class AlgorithmParameterGeneratorTestAES extends
         AlgorithmParameterGeneratorTest {
diff --git a/luni/src/test/java/tests/targets/security/AlgorithmParameterGeneratorTestDH.java b/luni/src/test/java/javax/crypto/spec/AlgorithmParameterGeneratorTestDH.java
similarity index 91%
rename from luni/src/test/java/tests/targets/security/AlgorithmParameterGeneratorTestDH.java
rename to luni/src/test/java/javax/crypto/spec/AlgorithmParameterGeneratorTestDH.java
index cba7cc6..6073186 100644
--- a/luni/src/test/java/tests/targets/security/AlgorithmParameterGeneratorTestDH.java
+++ b/luni/src/test/java/javax/crypto/spec/AlgorithmParameterGeneratorTestDH.java
@@ -13,13 +13,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
+package javax.crypto.spec;
 
 import dalvik.annotation.BrokenTest;
 import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
 import dalvik.annotation.TestTargetNew;
 import dalvik.annotation.TestTargets;
+import tests.security.AlgorithmParameterGeneratorTest;
+import tests.security.AlgorithmParameterKeyAgreementHelper;
 
 public class AlgorithmParameterGeneratorTestDH extends
         AlgorithmParameterGeneratorTest {
diff --git a/luni/src/test/java/tests/targets/security/AlgorithmParameterGeneratorTestDSA.java b/luni/src/test/java/javax/crypto/spec/AlgorithmParameterGeneratorTestDSA.java
similarity index 86%
rename from luni/src/test/java/tests/targets/security/AlgorithmParameterGeneratorTestDSA.java
rename to luni/src/test/java/javax/crypto/spec/AlgorithmParameterGeneratorTestDSA.java
index a8afb9e..78770c4 100644
--- a/luni/src/test/java/tests/targets/security/AlgorithmParameterGeneratorTestDSA.java
+++ b/luni/src/test/java/javax/crypto/spec/AlgorithmParameterGeneratorTestDSA.java
@@ -13,11 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
-
-import dalvik.annotation.TestTargetClass;
+package javax.crypto.spec;
 
 import java.security.spec.DSAParameterSpec;
+import tests.security.AlgorithmParameterGeneratorTest;
+import tests.security.AlgorithmParameterSignatureHelper;
 
 public class AlgorithmParameterGeneratorTestDSA extends
         AlgorithmParameterGeneratorTest {
@@ -25,6 +25,4 @@
     public AlgorithmParameterGeneratorTestDSA() {
         super("DSA", new AlgorithmParameterSignatureHelper<DSAParameterSpec>("DSA", DSAParameterSpec.class));
     }
-
-
 }
diff --git a/luni/src/test/java/tests/targets/security/AlgorithmParametersTestAES.java b/luni/src/test/java/javax/crypto/spec/AlgorithmParametersTestAES.java
similarity index 89%
rename from luni/src/test/java/tests/targets/security/AlgorithmParametersTestAES.java
rename to luni/src/test/java/javax/crypto/spec/AlgorithmParametersTestAES.java
index 95dfaa8..253df10 100644
--- a/luni/src/test/java/tests/targets/security/AlgorithmParametersTestAES.java
+++ b/luni/src/test/java/javax/crypto/spec/AlgorithmParametersTestAES.java
@@ -13,11 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
+package javax.crypto.spec;
 
-import dalvik.annotation.TestTargetClass;
-
-import javax.crypto.spec.IvParameterSpec;
+import tests.security.AlgorithmParameterSymmetricHelper;
+import tests.security.AlgorithmParametersTest;
 
 public class AlgorithmParametersTestAES extends AlgorithmParametersTest {
 
diff --git a/luni/src/test/java/tests/targets/security/AlgorithmParametersTestDES.java b/luni/src/test/java/javax/crypto/spec/AlgorithmParametersTestDES.java
similarity index 88%
rename from luni/src/test/java/tests/targets/security/AlgorithmParametersTestDES.java
rename to luni/src/test/java/javax/crypto/spec/AlgorithmParametersTestDES.java
index d6d22ca..c218a3e 100644
--- a/luni/src/test/java/tests/targets/security/AlgorithmParametersTestDES.java
+++ b/luni/src/test/java/javax/crypto/spec/AlgorithmParametersTestDES.java
@@ -13,11 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
+package javax.crypto.spec;
 
-import dalvik.annotation.TestTargetClass;
-
-import javax.crypto.spec.IvParameterSpec;
+import tests.security.AlgorithmParameterSymmetricHelper;
+import tests.security.AlgorithmParametersTest;
 
 public class AlgorithmParametersTestDES extends AlgorithmParametersTest {
 
diff --git a/luni/src/test/java/tests/targets/security/AlgorithmParametersTestDESede.java b/luni/src/test/java/javax/crypto/spec/AlgorithmParametersTestDESede.java
similarity index 88%
rename from luni/src/test/java/tests/targets/security/AlgorithmParametersTestDESede.java
rename to luni/src/test/java/javax/crypto/spec/AlgorithmParametersTestDESede.java
index e4b1f77..6d5ee23 100644
--- a/luni/src/test/java/tests/targets/security/AlgorithmParametersTestDESede.java
+++ b/luni/src/test/java/javax/crypto/spec/AlgorithmParametersTestDESede.java
@@ -13,11 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
+package javax.crypto.spec;
 
-import javax.crypto.spec.IvParameterSpec;
-
-import dalvik.annotation.TestTargetClass;
+import tests.security.AlgorithmParameterSymmetricHelper;
+import tests.security.AlgorithmParametersTest;
 
 public class AlgorithmParametersTestDESede extends AlgorithmParametersTest {
 
diff --git a/luni/src/test/java/tests/targets/security/AlgorithmParametersTestDH.java b/luni/src/test/java/javax/crypto/spec/AlgorithmParametersTestDH.java
similarity index 96%
rename from luni/src/test/java/tests/targets/security/AlgorithmParametersTestDH.java
rename to luni/src/test/java/javax/crypto/spec/AlgorithmParametersTestDH.java
index 3bda78d..59746e6 100644
--- a/luni/src/test/java/tests/targets/security/AlgorithmParametersTestDH.java
+++ b/luni/src/test/java/javax/crypto/spec/AlgorithmParametersTestDH.java
@@ -13,17 +13,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
+package javax.crypto.spec;
 
 import dalvik.annotation.BrokenTest;
 import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
 import dalvik.annotation.TestTargetNew;
 import dalvik.annotation.TestTargets;
-
 import java.math.BigInteger;
-
-import javax.crypto.spec.DHParameterSpec;
+import tests.security.AlgorithmParameterKeyAgreementHelper;
+import tests.security.AlgorithmParametersTest;
 
 public class AlgorithmParametersTestDH extends AlgorithmParametersTest {
 
diff --git a/luni/src/test/java/tests/targets/security/AlgorithmParametersTestDSA.java b/luni/src/test/java/javax/crypto/spec/AlgorithmParametersTestDSA.java
similarity index 96%
rename from luni/src/test/java/tests/targets/security/AlgorithmParametersTestDSA.java
rename to luni/src/test/java/javax/crypto/spec/AlgorithmParametersTestDSA.java
index ea89b52..2e46821 100644
--- a/luni/src/test/java/tests/targets/security/AlgorithmParametersTestDSA.java
+++ b/luni/src/test/java/javax/crypto/spec/AlgorithmParametersTestDSA.java
@@ -13,12 +13,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
+package javax.crypto.spec;
 
 import java.math.BigInteger;
 import java.security.spec.DSAParameterSpec;
-
-import dalvik.annotation.TestTargetClass;
+import tests.security.AlgorithmParameterSignatureHelper;
+import tests.security.AlgorithmParametersTest;
 
 public class AlgorithmParametersTestDSA extends AlgorithmParametersTest {
 
diff --git a/luni/src/test/java/tests/targets/security/AlgorithmParametersTestOAEP.java b/luni/src/test/java/javax/crypto/spec/AlgorithmParametersTestOAEP.java
similarity index 85%
rename from luni/src/test/java/tests/targets/security/AlgorithmParametersTestOAEP.java
rename to luni/src/test/java/javax/crypto/spec/AlgorithmParametersTestOAEP.java
index b366eab..de87958 100644
--- a/luni/src/test/java/tests/targets/security/AlgorithmParametersTestOAEP.java
+++ b/luni/src/test/java/javax/crypto/spec/AlgorithmParametersTestOAEP.java
@@ -13,14 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
-
-import dalvik.annotation.TestTargetClass;
+package javax.crypto.spec;
 
 import java.security.spec.MGF1ParameterSpec;
-
-import javax.crypto.spec.OAEPParameterSpec;
-import javax.crypto.spec.PSource;
+import tests.security.AlgorithmParameterAsymmetricHelper;
+import tests.security.AlgorithmParametersTest;
 
 public class AlgorithmParametersTestOAEP extends AlgorithmParametersTest {
 
diff --git a/luni/src/test/java/tests/targets/security/KeyFactoryTestDH.java b/luni/src/test/java/javax/crypto/spec/KeyFactoryTestDH.java
similarity index 70%
rename from luni/src/test/java/tests/targets/security/KeyFactoryTestDH.java
rename to luni/src/test/java/javax/crypto/spec/KeyFactoryTestDH.java
index 721ae1b..8378883 100644
--- a/luni/src/test/java/tests/targets/security/KeyFactoryTestDH.java
+++ b/luni/src/test/java/javax/crypto/spec/KeyFactoryTestDH.java
@@ -13,17 +13,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
+package javax.crypto.spec;
 
-import dalvik.annotation.TestTargetClass;
-
-import javax.crypto.spec.DHPrivateKeySpec;
-import javax.crypto.spec.DHPublicKeySpec;
+import java.security.KeyPair;
+import tests.security.KeyAgreementHelper;
+import tests.security.KeyFactoryTest;
 
 public class KeyFactoryTestDH extends KeyFactoryTest<DHPublicKeySpec, DHPrivateKeySpec> {
 
     public KeyFactoryTestDH() {
-        super("DH", new KeyAgreementHelper("DH"), DHPublicKeySpec.class, DHPrivateKeySpec.class);
+        super("DH", DHPublicKeySpec.class, DHPrivateKeySpec.class);
     }
 
+    @Override protected void check(KeyPair keyPair) {
+        new KeyAgreementHelper("DH").test(keyPair);
+    }
 }
diff --git a/luni/src/test/java/tests/targets/security/KeyFactoryTestDSA.java b/luni/src/test/java/javax/crypto/spec/KeyFactoryTestDSA.java
similarity index 72%
rename from luni/src/test/java/tests/targets/security/KeyFactoryTestDSA.java
rename to luni/src/test/java/javax/crypto/spec/KeyFactoryTestDSA.java
index 3a52fce..881c5d2 100644
--- a/luni/src/test/java/tests/targets/security/KeyFactoryTestDSA.java
+++ b/luni/src/test/java/javax/crypto/spec/KeyFactoryTestDSA.java
@@ -13,18 +13,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
+package javax.crypto.spec;
 
-import dalvik.annotation.TestTargetClass;
-
+import java.security.KeyPair;
 import java.security.spec.DSAPrivateKeySpec;
 import java.security.spec.DSAPublicKeySpec;
+import tests.security.KeyFactoryTest;
+import tests.security.SignatureHelper;
 
 public class KeyFactoryTestDSA extends
         KeyFactoryTest<DSAPublicKeySpec, DSAPrivateKeySpec> {
 
     public KeyFactoryTestDSA() {
-        super("DSA", new SignatureHelper("DSA"), DSAPublicKeySpec.class, DSAPrivateKeySpec.class);
+        super("DSA", DSAPublicKeySpec.class, DSAPrivateKeySpec.class);
     }
 
+    @Override protected void check(KeyPair keyPair) {
+        new SignatureHelper("DSA").test(keyPair);
+    }
 }
diff --git a/luni/src/test/java/tests/targets/security/KeyFactoryTestRSA.java b/luni/src/test/java/javax/crypto/spec/KeyFactoryTestRSA.java
similarity index 72%
rename from luni/src/test/java/tests/targets/security/KeyFactoryTestRSA.java
rename to luni/src/test/java/javax/crypto/spec/KeyFactoryTestRSA.java
index ec96459..a754c1f 100644
--- a/luni/src/test/java/tests/targets/security/KeyFactoryTestRSA.java
+++ b/luni/src/test/java/javax/crypto/spec/KeyFactoryTestRSA.java
@@ -13,19 +13,23 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
+package javax.crypto.spec;
 
-import dalvik.annotation.TestTargetClass;
-
+import java.security.KeyPair;
 import java.security.spec.RSAPrivateKeySpec;
 import java.security.spec.RSAPublicKeySpec;
+import tests.security.CipherAsymmetricCryptHelper;
+import tests.security.KeyFactoryTest;
 
 public class KeyFactoryTestRSA extends
         KeyFactoryTest<RSAPublicKeySpec, RSAPrivateKeySpec> {
 
     @SuppressWarnings("unchecked")
     public KeyFactoryTestRSA() {
-        super("RSA", new CipherAsymmetricCryptHelper("RSA"), RSAPublicKeySpec.class, RSAPrivateKeySpec.class);
+        super("RSA", RSAPublicKeySpec.class, RSAPrivateKeySpec.class);
     }
 
+    @Override protected void check(KeyPair keyPair) {
+        new CipherAsymmetricCryptHelper("RSA").test(keyPair);
+    }
 }
diff --git a/luni/src/test/java/tests/targets/security/KeyPairGeneratorTestDH.java b/luni/src/test/java/javax/crypto/spec/KeyPairGeneratorTestDH.java
similarity index 86%
rename from luni/src/test/java/tests/targets/security/KeyPairGeneratorTestDH.java
rename to luni/src/test/java/javax/crypto/spec/KeyPairGeneratorTestDH.java
index 99546e2..7383d37 100644
--- a/luni/src/test/java/tests/targets/security/KeyPairGeneratorTestDH.java
+++ b/luni/src/test/java/javax/crypto/spec/KeyPairGeneratorTestDH.java
@@ -13,13 +13,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
+package javax.crypto.spec;
 
 import dalvik.annotation.BrokenTest;
 import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
 import dalvik.annotation.TestTargetNew;
 import dalvik.annotation.TestTargets;
+import java.security.NoSuchAlgorithmException;
+import tests.security.KeyAgreementHelper;
+import tests.security.KeyPairGeneratorTest;
 
 public class KeyPairGeneratorTestDH extends KeyPairGeneratorTest {
 
@@ -45,7 +47,7 @@
         )
     })
     @BrokenTest("Takes ages due to DH computations. Disabling for now.")
-    public void testKeyPairGenerator() {
+    public void testKeyPairGenerator() throws NoSuchAlgorithmException {
         super.testKeyPairGenerator();
     }
 }
diff --git a/luni/src/test/java/tests/targets/security/KeyPairGeneratorTestDSA.java b/luni/src/test/java/javax/crypto/spec/KeyPairGeneratorTestDSA.java
similarity index 87%
rename from luni/src/test/java/tests/targets/security/KeyPairGeneratorTestDSA.java
rename to luni/src/test/java/javax/crypto/spec/KeyPairGeneratorTestDSA.java
index 0137106..04afb5a 100644
--- a/luni/src/test/java/tests/targets/security/KeyPairGeneratorTestDSA.java
+++ b/luni/src/test/java/javax/crypto/spec/KeyPairGeneratorTestDSA.java
@@ -13,9 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
+package javax.crypto.spec;
 
-import dalvik.annotation.TestTargetClass;
+import tests.security.KeyPairGeneratorTest;
+import tests.security.SignatureHelper;
 
 public class KeyPairGeneratorTestDSA extends KeyPairGeneratorTest {
 
diff --git a/luni/src/test/java/tests/targets/security/KeyPairGeneratorTestRSA.java b/luni/src/test/java/javax/crypto/spec/KeyPairGeneratorTestRSA.java
similarity index 86%
rename from luni/src/test/java/tests/targets/security/KeyPairGeneratorTestRSA.java
rename to luni/src/test/java/javax/crypto/spec/KeyPairGeneratorTestRSA.java
index c29f3e9..a16bf09 100644
--- a/luni/src/test/java/tests/targets/security/KeyPairGeneratorTestRSA.java
+++ b/luni/src/test/java/javax/crypto/spec/KeyPairGeneratorTestRSA.java
@@ -13,9 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
+package javax.crypto.spec;
 
-import dalvik.annotation.TestTargetClass;
+import tests.security.CipherAsymmetricCryptHelper;
+import tests.security.KeyPairGeneratorTest;
 
 public class KeyPairGeneratorTestRSA extends KeyPairGeneratorTest {
 
diff --git a/luni/src/test/java/javax/net/ssl/SSLContextTest.java b/luni/src/test/java/javax/net/ssl/SSLContextTest.java
index f68b21f..9ed372b 100644
--- a/luni/src/test/java/javax/net/ssl/SSLContextTest.java
+++ b/luni/src/test/java/javax/net/ssl/SSLContextTest.java
@@ -18,6 +18,7 @@
 
 import java.security.KeyManagementException;
 import java.security.Provider;
+import java.security.StandardNames;
 import javax.net.ServerSocketFactory;
 import javax.net.SocketFactory;
 import junit.framework.TestCase;
@@ -82,7 +83,7 @@
             }
         }
         try {
-            SSLContext.getInstance(null, TestSSLContext.PROVIDER_NAME);
+            SSLContext.getInstance(null, StandardNames.PROVIDER_NAME);
             fail();
         } catch (NullPointerException expected) {
         }
@@ -99,7 +100,7 @@
     public void test_SSLContext_getProvider() throws Exception {
         Provider provider = SSLContext.getDefault().getProvider();
         assertNotNull(provider);
-        assertEquals(TestSSLContext.PROVIDER_NAME, provider.getName());
+        assertEquals(StandardNames.PROVIDER_NAME, provider.getName());
     }
 
     public void test_SSLContext_init() throws Exception {
diff --git a/luni/src/test/java/javax/net/ssl/SSLEngineTest.java b/luni/src/test/java/javax/net/ssl/SSLEngineTest.java
index 75f04a0..2aa43dd 100644
--- a/luni/src/test/java/javax/net/ssl/SSLEngineTest.java
+++ b/luni/src/test/java/javax/net/ssl/SSLEngineTest.java
@@ -17,6 +17,7 @@
 package javax.net.ssl;
 
 import dalvik.annotation.KnownFailure;
+import java.security.StandardNames;
 import java.util.Arrays;
 import javax.net.ssl.SSLEngineResult.HandshakeStatus;
 import junit.framework.TestCase;
diff --git a/luni/src/test/java/javax/net/ssl/SSLSessionTest.java b/luni/src/test/java/javax/net/ssl/SSLSessionTest.java
index 1219e0b..6435af6 100644
--- a/luni/src/test/java/javax/net/ssl/SSLSessionTest.java
+++ b/luni/src/test/java/javax/net/ssl/SSLSessionTest.java
@@ -16,6 +16,7 @@
 
 package javax.net.ssl;
 
+import java.security.StandardNames;
 import java.util.Arrays;
 import junit.framework.TestCase;
 
diff --git a/luni/src/test/java/javax/net/ssl/SSLSocketFactoryTest.java b/luni/src/test/java/javax/net/ssl/SSLSocketFactoryTest.java
index a91d07a..d970cad 100644
--- a/luni/src/test/java/javax/net/ssl/SSLSocketFactoryTest.java
+++ b/luni/src/test/java/javax/net/ssl/SSLSocketFactoryTest.java
@@ -21,6 +21,7 @@
 import java.net.ServerSocket;
 import java.net.Socket;
 import java.net.SocketException;
+import java.security.StandardNames;
 import javax.net.ServerSocketFactory;
 import javax.net.SocketFactory;
 import junit.framework.TestCase;
diff --git a/luni/src/test/java/javax/net/ssl/SSLSocketTest.java b/luni/src/test/java/javax/net/ssl/SSLSocketTest.java
index fae21bf..c49d1bc 100644
--- a/luni/src/test/java/javax/net/ssl/SSLSocketTest.java
+++ b/luni/src/test/java/javax/net/ssl/SSLSocketTest.java
@@ -19,6 +19,7 @@
 import java.net.Socket;
 import java.net.SocketTimeoutException;
 import java.security.Principal;
+import java.security.StandardNames;
 import java.security.cert.Certificate;
 import java.security.cert.X509Certificate;
 import java.util.Arrays;
diff --git a/luni/src/test/java/com/ibm/icu4jni/text/NativePluralRulesTest.java b/luni/src/test/java/libcore/icu/NativePluralRulesTest.java
similarity index 98%
rename from luni/src/test/java/com/ibm/icu4jni/text/NativePluralRulesTest.java
rename to luni/src/test/java/libcore/icu/NativePluralRulesTest.java
index a4681ef..ccc3ca6 100644
--- a/luni/src/test/java/com/ibm/icu4jni/text/NativePluralRulesTest.java
+++ b/luni/src/test/java/libcore/icu/NativePluralRulesTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.ibm.icu4jni.text;
+package libcore.icu;
 
 import java.util.Locale;
 
diff --git a/luni/src/test/java/libcore/icu/TimeZonesTest.java b/luni/src/test/java/libcore/icu/TimeZonesTest.java
new file mode 100644
index 0000000..6c41d86
--- /dev/null
+++ b/luni/src/test/java/libcore/icu/TimeZonesTest.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package libcore.icu;
+
+import java.util.Locale;
+
+public class TimeZonesTest extends junit.framework.TestCase {
+    public void test_getZoneStrings() throws Exception {
+        // Check that corrupting our array doesn't affect other callers.
+        assertNotNull(TimeZones.getZoneStrings(null)[0]);
+        TimeZones.getZoneStrings(null)[0] = null;
+        assertNotNull(TimeZones.getZoneStrings(null)[0]);
+        // getDisplayTimezones actually returns a String[][] rather than a String[].
+        assertNotNull(TimeZones.getZoneStrings(null)[0][0]);
+        TimeZones.getZoneStrings(null)[0][0] = null;
+        assertNotNull(TimeZones.getZoneStrings(null)[0][0]);
+    }
+}
diff --git a/luni/src/test/java/org/apache/harmony/archive/tests/java/util/jar/AllTests.java b/luni/src/test/java/org/apache/harmony/archive/tests/java/util/jar/AllTests.java
index 18017dc..cd3746a 100644
--- a/luni/src/test/java/org/apache/harmony/archive/tests/java/util/jar/AllTests.java
+++ b/luni/src/test/java/org/apache/harmony/archive/tests/java/util/jar/AllTests.java
@@ -36,9 +36,6 @@
         suite.addTestSuite(JarInputStreamTest.class);
         suite.addTestSuite(JarOutputStreamTest.class);
         suite.addTestSuite(ManifestTest.class);
-        suite.addTestSuite(Pack200Test.class);
-        suite.addTestSuite(Pack200PackerTest.class);
-        suite.addTestSuite(Pack200UnpackerTest.class);
         suite.addTestSuite(ZipExecTest.class);
         return suite;
     }
diff --git a/luni/src/test/java/org/apache/harmony/archive/tests/java/util/jar/Pack200PackerTest.java b/luni/src/test/java/org/apache/harmony/archive/tests/java/util/jar/Pack200PackerTest.java
deleted file mode 100644
index e187679..0000000
--- a/luni/src/test/java/org/apache/harmony/archive/tests/java/util/jar/Pack200PackerTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.archive.tests.java.util.jar;
-
-import junit.framework.TestCase;
-
-import tests.support.resource.Support_Resources;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Map;
-import java.util.jar.JarFile;
-import java.util.jar.JarInputStream;
-import java.util.jar.Pack200;
-import java.util.jar.Pack200.Packer;
-
-public class Pack200PackerTest extends TestCase {
-    Packer packer;
-    Map properties;
-
-    public void testProperties() {
-        assertTrue(properties.size()>0);
-    }
-
-    public void testPackJarFileOutputStream() throws IOException {
-        File resources = Support_Resources.createTempFolder();
-        //Use junit4.jar file for testing pack200 compressing rate.
-        //file can be changed to any other.
-        Support_Resources.copyFile(resources, null, "junit4-4.3.1.jar");
-        File jarFile = new File(resources, "junit4-4.3.1.jar");
-        JarFile jf = new JarFile(jarFile);
-
-        File packFile1 = Support_Resources.createTempFile("pack200_1");
-        File packFile2 = Support_Resources.createTempFile("pack200_2");
-        File packFile3 = Support_Resources.createTempFile("pack200_3");
-        FileOutputStream fos1 = new FileOutputStream(packFile1);
-        FileOutputStream fos2 = new FileOutputStream(packFile2);
-        FileOutputStream fos3 = new FileOutputStream(packFile3);
-        properties.put(Packer.EFFORT, "0");
-        packer.pack(jf, fos1);
-        jf.close();
-        fos1.close();
-        jf = new JarFile(jarFile);
-        properties.put(Packer.EFFORT, "1");
-        packer.pack(jf, fos2);
-        jf.close();
-        fos2.close();
-        jf = new JarFile(jarFile);
-        properties.put(Packer.EFFORT, "9");
-        packer.pack(jf, fos3);
-        jf.close();
-        fos3.close();
-        assertTrue(jarFile.length()!=packFile1.length());
-        assertTrue(packFile1.length()>packFile2.length());
-        assertTrue(packFile2.length()>packFile3.length());
-    }
-
-    public void testPackJarInputStreamOutputStream() throws IOException {
-        File resources = Support_Resources.createTempFolder();
-        //Use junit4.jar file for testing pack200 compressing rate.
-        //file can be changed to any other.
-        Support_Resources.copyFile(resources, null, "junit4-4.3.1.jar");
-        File jarFile = new File(resources, "junit4-4.3.1.jar");
-        JarInputStream jis = new JarInputStream(new FileInputStream(jarFile));
-
-        File packFile1 = Support_Resources.createTempFile("pack200_1");
-        File packFile2 = Support_Resources.createTempFile("pack200_2");
-        File packFile3 = Support_Resources.createTempFile("pack200_3");
-        FileOutputStream fos1 = new FileOutputStream(packFile1);
-        FileOutputStream fos2 = new FileOutputStream(packFile2);
-        FileOutputStream fos3 = new FileOutputStream(packFile3);
-        properties.put(Packer.EFFORT, "0");
-        packer.pack(jis, fos1);
-        fos1.close();
-        jis = new JarInputStream(new FileInputStream(jarFile));
-        properties.put(Packer.EFFORT, "1");
-        packer.pack(jis, fos2);
-        fos2.close();
-        jis = new JarInputStream(new FileInputStream(jarFile));
-        properties.put(Packer.EFFORT, "9");
-        packer.pack(jis, fos3);
-        fos3.close();
-        assertTrue(jarFile.length()!=packFile1.length());
-        assertTrue(packFile1.length()>packFile2.length());
-        assertTrue(packFile2.length()>packFile3.length());
-    }
-
-    class MyPCL implements PropertyChangeListener {
-        boolean flag = false;
-
-        public boolean isCalled() {
-            return flag;
-        }
-
-        public void propertyChange(PropertyChangeEvent arg0) {
-            flag = true;
-        }
-    }
-
-    public void testAddPropertyChangeListener() {
-        MyPCL pcl = new MyPCL();
-        packer.addPropertyChangeListener(pcl);
-        assertFalse(pcl.isCalled());
-        properties.put(Packer.EFFORT, "7");
-        assertTrue(pcl.isCalled());
-    }
-
-    public void testRemovePropertyChangeListener() {
-        MyPCL pcl = new MyPCL();
-        packer.addPropertyChangeListener(pcl);
-        assertFalse(pcl.isCalled());
-        packer.removePropertyChangeListener(pcl);
-        properties.put(Packer.EFFORT, "7");
-        assertFalse(pcl.isCalled());
-    }
-
-    @Override
-    protected void setUp() {
-        packer = Pack200.newPacker();
-        properties = packer.properties();
-    }
-
-    @Override
-    protected void tearDown() {
-        packer = null;
-        properties = null;
-    }
-}
diff --git a/luni/src/test/java/org/apache/harmony/archive/tests/java/util/jar/Pack200Test.java b/luni/src/test/java/org/apache/harmony/archive/tests/java/util/jar/Pack200Test.java
deleted file mode 100644
index 0e2b688..0000000
--- a/luni/src/test/java/org/apache/harmony/archive/tests/java/util/jar/Pack200Test.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.archive.tests.java.util.jar;
-
-import junit.framework.TestCase;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.jar.Pack200;
-
-public class Pack200Test extends TestCase {
-
-    public void testNewPacker() {
-        Method[] methodsInt = Pack200.Packer.class.getDeclaredMethods();
-        Method[] methodsImpl = Pack200.newPacker().getClass()
-                .getDeclaredMethods();
-        Field[] fieldsInt = Pack200.Packer.class.getFields();
-        Field[] fieldsImpl = Pack200.newPacker().getClass().getFields();
-        int i, k;
-        boolean flag;
-        for (i = 0; i < methodsInt.length; i++) {
-            flag = false;
-            for (k = 0; k < methodsImpl.length; k++) {
-                if (methodsInt[i].getName().equals(methodsImpl[k].getName())) {
-                    flag = true;
-                    break;
-                }
-            }
-            assertTrue("Not all methods were implemented", flag);
-        }
-
-        for (i = 0; i < fieldsInt.length; i++) {
-            flag = false;
-            for (k = 0; k < fieldsImpl.length; k++) {
-                if (fieldsInt[i].getName().equals(fieldsImpl[k].getName())) {
-                    flag = true;
-                    break;
-                }
-            }
-            assertTrue("Not all fields were existed", flag);
-        }
-    }
-
-    public void testNewUnpacker() {
-        assertNotNull(Pack200.newUnpacker().getClass());
-        Method[] methodsInt = Pack200.Unpacker.class.getDeclaredMethods();
-        Method[] methodsImpl = Pack200.newUnpacker().getClass()
-                .getDeclaredMethods();
-        Field[] fieldsInt = Pack200.Unpacker.class.getFields();
-        Field[] fieldsImpl = Pack200.newUnpacker().getClass().getFields();
-        int i, k;
-        boolean flag;
-        for (i = 0; i < methodsInt.length; i++) {
-            flag = false;
-            for (k = 0; k < methodsImpl.length; k++) {
-                if (methodsInt[i].getName().equals(methodsImpl[k].getName())) {
-                    flag = true;
-                    break;
-                }
-            }
-            assertTrue("Not all methods were implemented", flag);
-        }
-
-        for (i = 0; i < fieldsInt.length; i++) {
-            flag = false;
-            for (k = 0; k < fieldsImpl.length; k++) {
-                if (fieldsInt[i].getName().equals(fieldsImpl[k].getName())) {
-                    flag = true;
-                    break;
-                }
-            }
-            assertTrue("Not all fields were existed", flag);
-        }
-    }
-
-}
diff --git a/luni/src/test/java/org/apache/harmony/archive/tests/java/util/jar/Pack200UnpackerTest.java b/luni/src/test/java/org/apache/harmony/archive/tests/java/util/jar/Pack200UnpackerTest.java
deleted file mode 100644
index f863cb7..0000000
--- a/luni/src/test/java/org/apache/harmony/archive/tests/java/util/jar/Pack200UnpackerTest.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.archive.tests.java.util.jar;
-
-import junit.framework.TestCase;
-
-import tests.support.resource.Support_Resources;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Map;
-import java.util.jar.JarFile;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Pack200;
-import java.util.jar.Pack200.Packer;
-import java.util.jar.Pack200.Unpacker;
-
-public class Pack200UnpackerTest extends TestCase {
-    Unpacker unpacker;
-    Map properties;
-
-    public void testProperties() {
-        assertTrue(properties.size()>0);
-    }
-
-    public void testUnpackInputStreamJarOutputStream() throws IOException {
-        File resources = Support_Resources.createTempFolder();
-        //Use junit4.jar file for testing pack200 compressing rate.
-        //file can be changed to any other.
-        Support_Resources.copyFile(resources, null, "junit4-4.3.1.jar");
-        File jarFile = new File(resources, "junit4-4.3.1.jar");
-        JarFile jf = new JarFile(jarFile);
-        int jarEntries = jf.size();
-
-        File packFile1 = Support_Resources.createTempFile("pack200_1");
-        File packFile2 = Support_Resources.createTempFile("pack200_2");
-        File packFile3 = Support_Resources.createTempFile("pack200_3");
-        FileOutputStream fos1 = new FileOutputStream(packFile1);
-        FileOutputStream fos2 = new FileOutputStream(packFile2);
-        FileOutputStream fos3 = new FileOutputStream(packFile3);
-        properties.put(Packer.EFFORT, "0");
-        Packer packer = Pack200.newPacker();
-        packer.pack(jf, fos1);
-        jf.close();
-        fos1.close();
-        jf = new JarFile(jarFile);
-        properties.put(Packer.EFFORT, "1");
-        packer.pack(jf, fos2);
-        jf.close();
-        fos2.close();
-        jf = new JarFile(jarFile);
-        properties.put(Packer.EFFORT, "9");
-        packer.pack(jf, fos3);
-        jf.close();
-        fos3.close();
-
-        File jarFile1 = Support_Resources.createTempFile("jar_1");
-        File jarFile2 = Support_Resources.createTempFile("jar_2");
-        File jarFile3 = Support_Resources.createTempFile("jar_3");
-        JarOutputStream jos1 = new JarOutputStream(new FileOutputStream(jarFile1));
-        JarOutputStream jos2 = new JarOutputStream(new FileOutputStream(jarFile2));
-        JarOutputStream jos3 = new JarOutputStream(new FileOutputStream(jarFile3));
-
-        unpacker.unpack(packFile1, jos1);
-        unpacker.unpack(packFile2, jos2);
-        unpacker.unpack(packFile3, jos3);
-
-        jos1.close();
-        jos2.close();
-        jos3.close();
-
-        assertEquals(jarFile1.length(), jarFile2.length());
-        assertEquals(jarFile2.length(), jarFile3.length());
-
-        assertEquals(jarEntries, new JarFile(jarFile1).size());
-        assertEquals(jarEntries, new JarFile(jarFile2).size());
-        assertEquals(jarEntries, new JarFile(jarFile3).size());
-    }
-
-    public void testUnpackFileJarOutputStream() throws IOException {
-        File resources = Support_Resources.createTempFolder();
-        //Use junit4.jar file for testing pack200 compressing rate.
-        //file can be changed to any other.
-        Support_Resources.copyFile(resources, null, "junit4-4.3.1.jar");
-        File jarFile = new File(resources, "junit4-4.3.1.jar");
-        JarFile jf = new JarFile(jarFile);
-        int jarEntries = jf.size();
-
-        File packFile1 = Support_Resources.createTempFile("pack200_1");
-        File packFile2 = Support_Resources.createTempFile("pack200_2");
-        File packFile3 = Support_Resources.createTempFile("pack200_3");
-        FileOutputStream fos1 = new FileOutputStream(packFile1);
-        FileOutputStream fos2 = new FileOutputStream(packFile2);
-        FileOutputStream fos3 = new FileOutputStream(packFile3);
-        properties.put(Packer.EFFORT, "0");
-        Packer packer = Pack200.newPacker();
-        packer.pack(jf, fos1);
-        jf.close();
-        fos1.close();
-        jf = new JarFile(jarFile);
-        properties.put(Packer.EFFORT, "1");
-        packer.pack(jf, fos2);
-        jf.close();
-        fos2.close();
-        jf = new JarFile(jarFile);
-        properties.put(Packer.EFFORT, "9");
-        packer.pack(jf, fos3);
-        jf.close();
-        fos3.close();
-
-        File jarFile1 = Support_Resources.createTempFile("jar_1");
-        File jarFile2 = Support_Resources.createTempFile("jar_2");
-        File jarFile3 = Support_Resources.createTempFile("jar_3");
-        JarOutputStream jos1 = new JarOutputStream(new FileOutputStream(jarFile1));
-        JarOutputStream jos2 = new JarOutputStream(new FileOutputStream(jarFile2));
-        JarOutputStream jos3 = new JarOutputStream(new FileOutputStream(jarFile3));
-        FileInputStream fis1 = new FileInputStream(packFile1);
-        FileInputStream fis2 = new FileInputStream(packFile2);
-        FileInputStream fis3 = new FileInputStream(packFile3);
-
-        unpacker.unpack(fis1, jos1);
-        unpacker.unpack(fis2, jos2);
-        unpacker.unpack(fis3, jos3);
-
-        jos1.close();
-        jos2.close();
-        jos3.close();
-
-        assertEquals(jarFile1.length(), jarFile2.length());
-        assertEquals(jarFile2.length(), jarFile3.length());
-
-        assertEquals(jarEntries, new JarFile(jarFile1).size());
-        assertEquals(jarEntries, new JarFile(jarFile2).size());
-        assertEquals(jarEntries, new JarFile(jarFile3).size());
-    }
-
-    class MyPCL implements PropertyChangeListener {
-        boolean flag = false;
-
-        public boolean isCalled() {
-            return flag;
-        }
-
-        public void propertyChange(PropertyChangeEvent arg0) {
-            flag = true;
-        }
-    }
-
-    public void testAddPropertyChangeListener() {
-        MyPCL pcl = new MyPCL();
-        unpacker.addPropertyChangeListener(pcl);
-        assertFalse(pcl.isCalled());
-        properties.put(Unpacker.PROGRESS, "0");
-        assertTrue(pcl.isCalled());
-    }
-
-    public void testRemovePropertyChangeListener() {
-        MyPCL pcl = new MyPCL();
-        unpacker.addPropertyChangeListener(pcl);
-        assertFalse(pcl.isCalled());
-        unpacker.removePropertyChangeListener(pcl);
-        properties.put(Unpacker.PROGRESS, "7");
-        assertFalse(pcl.isCalled());
-    }
-
-    @Override
-    protected void setUp() {
-        unpacker = Pack200.newUnpacker();
-        properties = unpacker.properties();
-    }
-
-    @Override
-    protected void tearDown() {
-        unpacker = null;
-        properties = null;
-    }
-}
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/AbstractMethodErrorTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/AbstractMethodErrorTest.java
deleted file mode 100644
index d59d468..0000000
--- a/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/AbstractMethodErrorTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.harmony.luni.tests.java.lang;
-
-import org.apache.harmony.testframework.serialization.SerializationTest;
-
-public class AbstractMethodErrorTest extends junit.framework.TestCase {
-
-    /**
-     * @tests {@link java.lang.AbstractMethodError#AbstractMethodError()}
-     */
-    public void test_Constructor() {
-        // Test for method java.lang.AbstractMethodError()
-        Error error = new AbstractMethodError();
-        assertNull(error.getCause());
-        assertNull(error.getMessage());
-    }
-
-    /**
-     * @tests {@link java.lang.AbstractMethodError#AbstractMethodError(String)}
-     */
-    public void test_ConstructorLjava_lang_String() {
-        // Test for method java.lang.AbstractMethodError(java.lang.String)
-        Error error = new AbstractMethodError(null);
-        assertNull(error.getMessage());
-        assertNull(error.getCause());
-
-        error = new AbstractMethodError("msg");
-        assertEquals("msg", error.getMessage());
-        assertNull(error.getCause());
-    }
-
-    /**
-     * @tests serialization/deserialization.
-     */
-    public void testSerializationSelf() throws Exception {
-        SerializationTest.verifySelf(new AbstractMethodError());
-    }
-
-    /**
-     * @tests serialization/deserialization compatibility with RI.
-     */
-    public void testSerializationCompatibility() throws Exception {
-        SerializationTest.verifyGolden(this, new AbstractMethodError());
-    }
-
-}
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/AllTests.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/AllTests.java
index 19542d9..09753bd 100644
--- a/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/AllTests.java
+++ b/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/AllTests.java
@@ -29,19 +29,17 @@
         TestRunner.main(new String[] { AllTests.class.getName() });
     }
 
-    public static final Test suite() {
+    public static Test suite() {
         TestSuite suite = new TestSuite("Tests for java.lang");
 
-        suite.addTestSuite(AbstractMethodErrorTest.class);
         suite.addTestSuite(ArithmeticExceptionTest.class);
         suite.addTestSuite(ArrayIndexOutOfBoundsExceptionTest.class);
         suite.addTestSuite(ArrayStoreExceptionTest.class);
         suite.addTestSuite(AssertionErrorTest.class);
         suite.addTestSuite(BooleanTest.class);
         suite.addTestSuite(ByteTest.class);
-        suite.addTestSuite(CharacterImplTest.class);
         suite.addTestSuite(Character_SubsetTest.class);
-        suite.addTestSuite(CharacterTest.class);
+        suite.addTestSuite(OldCharacterTest.class);
         suite.addTestSuite(Character_UnicodeBlockTest.class);
         suite.addTestSuite(ClassCastExceptionTest.class);
         suite.addTestSuite(ClassCircularityErrorTest.class);
@@ -54,7 +52,6 @@
         suite.addTestSuite(CompilerTest.class);
         suite.addTestSuite(DoubleTest.class);
         suite.addTestSuite(EnumConstantNotPresentExceptionTest.class);
-        suite.addTestSuite(EnumTest.class);
         suite.addTestSuite(ErrorTest.class);
         suite.addTestSuite(ExceptionInInitializerErrorTest.class);
         suite.addTestSuite(ExceptionTest.class);
@@ -87,7 +84,6 @@
         suite.addTestSuite(NumberTest.class);
         suite.addTestSuite(ObjectTest.class);
         suite.addTestSuite(OutOfMemoryErrorTest.class);
-        suite.addTestSuite(PackageTest.class);
         suite.addTestSuite(ProcessBuilderTest.class);
         suite.addTestSuite(RuntimeExceptionTest.class);
         suite.addTestSuite(RuntimePermissionTest.class);
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/CharacterImplTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/CharacterImplTest.java
deleted file mode 100644
index a81775e..0000000
--- a/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/CharacterImplTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.luni.tests.java.lang;
-
-import junit.framework.TestCase;
-
-public class CharacterImplTest extends TestCase {
-
-    public void test_valueOfC() {
-        // test the cache range
-// BEGIN android-changed
-// The JLS requires caching for chars between "\u0000 to \u007f"
-// http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7
-// The Harmony code cached 0-512 and tested for this behavior. The test and the
-// code have been modified to match the JLS
-        for (char c = '\u0000'; c < 128; c++) {
-// END android-changed
-            Character e = new Character(c);
-            Character a = Character.valueOf(c);
-            assertEquals(e, a);
-
-            // WARN: this assertion may not be valid on other JREs
-            assertSame(Character.valueOf(c), Character.valueOf(c));
-        }
-        // test the rest of the chars
-        for (int c = '\u0512'; c <= Character.MAX_VALUE; c++) {
-            assertEquals(new Character((char) c), Character.valueOf((char) c));
-        }
-    }
-}
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/CharacterTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/CharacterTest.java
deleted file mode 100644
index c4e7ba1..0000000
--- a/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/CharacterTest.java
+++ /dev/null
@@ -1,2349 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.luni.tests.java.lang;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import junit.framework.TestCase;
-
-import java.io.FileOutputStream;
-import java.io.PrintWriter;
-import java.util.Arrays;
-
-@TestTargetClass(Character.class)
-public class CharacterTest extends TestCase {
-
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "valueOf",
-        args = {char.class}
-    )
-    public void test_valueOfC() {
-        // test the cache range
-        for (char c = '\u0000'; c < 512; c++) {
-            Character e = new Character(c);
-            Character a = Character.valueOf(c);
-            assertEquals(e, a);
-        }
-        // test the rest of the chars
-        for (int c = 512; c <= Character.MAX_VALUE; c++) {
-            assertEquals(new Character((char) c), Character.valueOf((char) c));
-        }
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isValidCodePoint",
-        args = {int.class}
-    )
-    public void test_isValidCodePointI() {
-        assertFalse(Character.isValidCodePoint(-1));
-        assertTrue(Character.isValidCodePoint(0));
-        assertTrue(Character.isValidCodePoint(1));
-        assertFalse(Character.isValidCodePoint(Integer.MAX_VALUE));
-
-        for (int c = '\u0000'; c <= 0x10FFFF; c++) {
-            assertTrue(Character.isValidCodePoint(c));
-        }
-
-        assertFalse(Character.isValidCodePoint(0x10FFFF + 1));
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isSupplementaryCodePoint",
-        args = {int.class}
-    )
-    public void test_isSupplementaryCodePointI() {
-        assertFalse(Character.isSupplementaryCodePoint(-1));
-
-        for (int c = '\u0000'; c <= '\uFFFF'; c++) {
-            assertFalse(Character.isSupplementaryCodePoint(c));
-        }
-
-        for (int c = 0xFFFF + 1; c <= 0x10FFFF; c++) {
-            assertTrue(Character.isSupplementaryCodePoint(c));
-        }
-
-        assertFalse(Character.isSupplementaryCodePoint(0x10FFFF + 1));
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isHighSurrogate",
-        args = {char.class}
-    )
-    public void test_isHighSurrogateC() {
-        // (\uD800-\uDBFF)
-        assertFalse(Character.isHighSurrogate((char) ('\uD800' - 1)));
-        for (int c = '\uD800'; c <= '\uDBFF'; c++) {
-            assertTrue(Character.isHighSurrogate((char) c));
-        }
-        assertFalse(Character.isHighSurrogate((char) ('\uDBFF' + 1)));
-        assertFalse(Character.isHighSurrogate('\uFFFF'));
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isLowSurrogate",
-        args = {char.class}
-    )
-    public void test_isLowSurrogateC() {
-        // (\uDC00-\uDFFF)
-        assertFalse(Character.isLowSurrogate((char) ('\uDC00' - 1)));
-        for (int c = '\uDC00'; c <= '\uDFFF'; c++) {
-            assertTrue(Character.isLowSurrogate((char) c));
-        }
-        assertFalse(Character.isLowSurrogate((char) ('\uDFFF' + 1)));
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isSurrogatePair",
-        args = {char.class, char.class}
-    )
-    public void test_isSurrogatePairCC() {
-        assertFalse(Character.isSurrogatePair('\u0000', '\u0000'));
-        assertFalse(Character.isSurrogatePair('\u0000', '\uDC00'));
-
-        assertTrue(Character.isSurrogatePair('\uD800', '\uDC00'));
-        assertTrue(Character.isSurrogatePair('\uD800', '\uDFFF'));
-        assertTrue(Character.isSurrogatePair('\uDBFF', '\uDFFF'));
-
-        assertFalse(Character.isSurrogatePair('\uDBFF', '\uF000'));
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "charCount",
-        args = {int.class}
-    )
-    public void test_charCountI() {
-
-        for (int c = '\u0000'; c <= '\uFFFF'; c++) {
-            assertEquals(1, Character.charCount(c));
-        }
-
-        for (int c = 0xFFFF + 1; c <= 0x10FFFF; c++) {
-            assertEquals(2, Character.charCount(c));
-        }
-
-        // invalid code points work in this method
-        assertEquals(2, Character.charCount(Integer.MAX_VALUE));
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "toCodePoint",
-        args = {char.class, char.class}
-    )
-    public void test_toCodePointCC() {
-        int result = Character.toCodePoint('\uD800', '\uDC00');
-        assertEquals(0x00010000, result);
-
-        result = Character.toCodePoint('\uD800', '\uDC01');
-        assertEquals(0x00010001, result);
-
-        result = Character.toCodePoint('\uD801', '\uDC01');
-        assertEquals(0x00010401, result);
-
-        result = Character.toCodePoint('\uDBFF', '\uDFFF');
-        assertEquals(0x00010FFFF, result);
-    }
-
-    @SuppressWarnings("cast")
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "codePointAt",
-        args = {java.lang.CharSequence.class, int.class}
-    )
-    public void test_codePointAtLjava_lang_CharSequenceI() {
-
-        assertEquals('a', Character.codePointAt((CharSequence) "abc", 0));
-        assertEquals('b', Character.codePointAt((CharSequence) "abc", 1));
-        assertEquals('c', Character.codePointAt((CharSequence) "abc", 2));
-        assertEquals(0x10000, Character.codePointAt(
-                (CharSequence) "\uD800\uDC00", 0));
-        assertEquals('\uDC00', Character.codePointAt(
-                (CharSequence) "\uD800\uDC00", 1));
-
-        try {
-            Character.codePointAt((CharSequence) null, 0);
-            fail("No NPE.");
-        } catch (NullPointerException e) {
-        }
-
-        try {
-            Character.codePointAt((CharSequence) "abc", -1);
-            fail("No IOOBE, negative index.");
-        } catch (IndexOutOfBoundsException e) {
-        }
-
-        try {
-            Character.codePointAt((CharSequence) "abc", 4);
-            fail("No IOOBE, index too large.");
-        } catch (IndexOutOfBoundsException e) {
-        }
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "codePointAt",
-        args = {char[].class, int.class}
-    )
-    public void test_codePointAt$CI() {
-
-        assertEquals('a', Character.codePointAt("abc".toCharArray(), 0));
-        assertEquals('b', Character.codePointAt("abc".toCharArray(), 1));
-        assertEquals('c', Character.codePointAt("abc".toCharArray(), 2));
-        assertEquals(0x10000, Character.codePointAt("\uD800\uDC00"
-                .toCharArray(), 0));
-        assertEquals('\uDC00', Character.codePointAt("\uD800\uDC00"
-                .toCharArray(), 1));
-
-        try {
-            Character.codePointAt((char[]) null, 0);
-            fail("No NPE.");
-        } catch (NullPointerException e) {
-        }
-
-        try {
-            Character.codePointAt("abc".toCharArray(), -1);
-            fail("No IOOBE, negative index.");
-        } catch (IndexOutOfBoundsException e) {
-        }
-
-        try {
-            Character.codePointAt("abc".toCharArray(), 4);
-            fail("No IOOBE, index too large.");
-        } catch (IndexOutOfBoundsException e) {
-        }
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "codePointAt",
-        args = {char[].class, int.class, int.class}
-    )
-    public void test_codePointAt$CII() {
-
-        assertEquals('a', Character.codePointAt("abc".toCharArray(), 0, 3));
-        assertEquals('b', Character.codePointAt("abc".toCharArray(), 1, 3));
-        assertEquals('c', Character.codePointAt("abc".toCharArray(), 2, 3));
-        assertEquals(0x10000, Character.codePointAt("\uD800\uDC00"
-                .toCharArray(), 0, 2));
-        assertEquals('\uDC00', Character.codePointAt("\uD800\uDC00"
-                .toCharArray(), 1, 2));
-        assertEquals('\uD800', Character.codePointAt("\uD800\uDC00"
-                .toCharArray(), 0, 1));
-
-        try {
-            Character.codePointAt((char[]) null, 0, 1);
-            fail("No NPE.");
-        } catch (NullPointerException e) {
-        }
-
-        try {
-            Character.codePointAt("abc".toCharArray(), -1, 3);
-            fail("No IOOBE, negative index.");
-        } catch (IndexOutOfBoundsException e) {
-        }
-
-        try {
-            Character.codePointAt("abc".toCharArray(), 4, 3);
-            fail("No IOOBE, index too large.");
-        } catch (IndexOutOfBoundsException e) {
-        }
-
-        try {
-            Character.codePointAt("abc".toCharArray(), 2, 1);
-            fail("No IOOBE, index larger than limit.");
-        } catch (IndexOutOfBoundsException e) {
-        }
-
-        try {
-            Character.codePointAt("abc".toCharArray(), 2, -1);
-            fail("No IOOBE, limit is negative.");
-        } catch (IndexOutOfBoundsException e) {
-        }
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "codePointBefore",
-        args = {java.lang.CharSequence.class, int.class}
-    )
-    @SuppressWarnings("cast")
-    public void test_codePointBeforeLjava_lang_CharSequenceI() {
-
-        assertEquals('a', Character.codePointBefore((CharSequence) "abc", 1));
-        assertEquals('b', Character.codePointBefore((CharSequence) "abc", 2));
-        assertEquals('c', Character.codePointBefore((CharSequence) "abc", 3));
-        assertEquals(0x10000, Character.codePointBefore(
-                (CharSequence) "\uD800\uDC00", 2));
-        assertEquals('\uD800', Character.codePointBefore(
-                (CharSequence) "\uD800\uDC00", 1));
-
-        try {
-            Character.codePointBefore((CharSequence) null, 0);
-            fail("No NPE.");
-        } catch (NullPointerException e) {
-        }
-
-        try {
-            Character.codePointBefore((CharSequence) "abc", 0);
-            fail("No IOOBE, index below one.");
-        } catch (IndexOutOfBoundsException e) {
-        }
-
-        try {
-            Character.codePointBefore((CharSequence) "abc", 4);
-            fail("No IOOBE, index too large.");
-        } catch (IndexOutOfBoundsException e) {
-        }
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "codePointBefore",
-        args = {char[].class, int.class}
-    )
-    public void test_codePointBefore$CI() {
-
-        assertEquals('a', Character.codePointBefore("abc".toCharArray(), 1));
-        assertEquals('b', Character.codePointBefore("abc".toCharArray(), 2));
-        assertEquals('c', Character.codePointBefore("abc".toCharArray(), 3));
-        assertEquals(0x10000, Character.codePointBefore("\uD800\uDC00"
-                .toCharArray(), 2));
-        assertEquals('\uD800', Character.codePointBefore("\uD800\uDC00"
-                .toCharArray(), 1));
-
-        try {
-            Character.codePointBefore((char[]) null, 0);
-            fail("No NPE.");
-        } catch (NullPointerException e) {
-        }
-
-        try {
-            Character.codePointBefore("abc".toCharArray(), -1);
-            fail("No IOOBE, negative index.");
-        } catch (IndexOutOfBoundsException e) {
-        }
-
-        try {
-            Character.codePointBefore("abc".toCharArray(), 4);
-            fail("No IOOBE, index too large.");
-        } catch (IndexOutOfBoundsException e) {
-        }
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "codePointBefore",
-        args = {char[].class, int.class, int.class}
-    )
-    public void test_codePointBefore$CII() {
-
-        assertEquals('a', Character.codePointBefore("abc".toCharArray(), 1, 0));
-        assertEquals('b', Character.codePointBefore("abc".toCharArray(), 2, 0));
-        assertEquals('c', Character.codePointBefore("abc".toCharArray(), 3, 0));
-        assertEquals(0x10000, Character.codePointBefore("\uD800\uDC00"
-                .toCharArray(), 2, 0));
-        assertEquals('\uDC00', Character.codePointBefore("\uD800\uDC00"
-                .toCharArray(), 2, 1));
-        assertEquals('\uD800', Character.codePointBefore("\uD800\uDC00"
-                .toCharArray(), 1, 0));
-
-        try {
-            Character.codePointBefore((char[]) null, 1, 0);
-            fail("No NPE.");
-        } catch (NullPointerException e) {
-        }
-
-        try {
-            Character.codePointBefore("abc".toCharArray(), 0, 1);
-            fail("No IOOBE, index less than start.");
-        } catch (IndexOutOfBoundsException e) {
-        }
-
-        try {
-            Character.codePointBefore("abc".toCharArray(), 4, 0);
-            fail("No IOOBE, index larger than length.");
-        } catch (IndexOutOfBoundsException e) {
-        }
-
-        try {
-            Character.codePointBefore("abc".toCharArray(), 2, -1);
-            fail("No IOOBE, start is negative.");
-        } catch (IndexOutOfBoundsException e) {
-        }
-
-        try {
-            Character.codePointBefore("abc".toCharArray(), 2, 4);
-            fail("No IOOBE, start larger than length.");
-        } catch (IndexOutOfBoundsException e) {
-        }
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "toChars",
-        args = {int.class, char[].class, int.class}
-    )
-    public void test_toCharsI$CI() {
-        char[] dst = new char[2];
-        int result = Character.toChars(0x10000, dst, 0);
-        assertEquals(2, result);
-        assertTrue(Arrays.equals(new char[] { '\uD800', '\uDC00' }, dst));
-
-        result = Character.toChars(0x10001, dst, 0);
-        assertEquals(2, result);
-        assertTrue(Arrays.equals(new char[] { '\uD800', '\uDC01' }, dst));
-
-        result = Character.toChars(0x10401, dst, 0);
-        assertEquals(2, result);
-        assertTrue(Arrays.equals(new char[] { '\uD801', '\uDC01' }, dst));
-
-        result = Character.toChars(0x10FFFF, dst, 0);
-        assertEquals(2, result);
-        assertTrue(Arrays.equals(new char[] { '\uDBFF', '\uDFFF' }, dst));
-
-        try {
-            Character.toChars(Integer.MAX_VALUE, new char[2], 0);
-            fail("No IAE, invalid code point.");
-        } catch (IllegalArgumentException e) {
-        }
-
-        try {
-            Character.toChars('a', null, 0);
-            fail("No NPE, null char[].");
-        } catch (NullPointerException e) {
-        }
-
-        try {
-            Character.toChars('a', new char[1], -1);
-            fail("No IOOBE, negative index.");
-        } catch (IndexOutOfBoundsException e) {
-        }
-
-        try {
-            Character.toChars('a', new char[1], 1);
-            fail("No IOOBE, index equal to length.");
-        } catch (IndexOutOfBoundsException e) {
-        }
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "toChars",
-        args = {int.class}
-    )
-    public void test_toCharsI() {
-        assertTrue(Arrays.equals(new char[] { '\uD800', '\uDC00' }, Character
-                .toChars(0x10000)));
-        assertTrue(Arrays.equals(new char[] { '\uD800', '\uDC01' }, Character
-                .toChars(0x10001)));
-        assertTrue(Arrays.equals(new char[] { '\uD801', '\uDC01' }, Character
-                .toChars(0x10401)));
-        assertTrue(Arrays.equals(new char[] { '\uDBFF', '\uDFFF' }, Character
-                .toChars(0x10FFFF)));
-
-        try {
-            Character.toChars(Integer.MAX_VALUE);
-            fail("No IAE, invalid code point.");
-        } catch (IllegalArgumentException e) {
-        }
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "codePointCount",
-        args = {java.lang.CharSequence.class, int.class, int.class}
-    )
-    public void test_codePointCountLjava_lang_CharSequenceII() {
-        assertEquals(1, Character.codePointCount("\uD800\uDC00", 0, 2));
-        assertEquals(1, Character.codePointCount("\uD800\uDC01", 0, 2));
-        assertEquals(1, Character.codePointCount("\uD801\uDC01", 0, 2));
-        assertEquals(1, Character.codePointCount("\uDBFF\uDFFF", 0, 2));
-
-        assertEquals(3, Character.codePointCount("a\uD800\uDC00b", 0, 4));
-        assertEquals(4, Character.codePointCount("a\uD800\uDC00b\uD800", 0, 5));
-
-        try {
-            Character.codePointCount((CharSequence) null, 0, 1);
-            fail("No NPE, null char sequence.");
-        } catch (NullPointerException e) {
-        }
-
-        try {
-            Character.codePointCount("abc", -1, 1);
-            fail("No IOOBE, negative start.");
-        } catch (IndexOutOfBoundsException e) {
-        }
-
-        try {
-            Character.codePointCount("abc", 0, 4);
-            fail("No IOOBE, end greater than length.");
-        } catch (IndexOutOfBoundsException e) {
-        }
-
-        try {
-            Character.codePointCount("abc", 2, 1);
-            fail("No IOOBE, end greater than start.");
-        } catch (IndexOutOfBoundsException e) {
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "codePointCount",
-        args = {char[].class, int.class, int.class}
-    )
-    public void test_codePointCountLjava_lang_CharArrayII() {
-
-      assertEquals(1, Character.codePointCount("\uD800\uDC00".toCharArray(),
-                                               0, 2));
-      assertEquals(3, Character.codePointCount("a\uD800\uDC00b".toCharArray(),
-                                               0, 4));
-      assertEquals(4, Character.codePointCount("a\uD800\uDC00b\uD800".toCharArray(),
-                                               0, 5));
-      assertEquals(4, Character.codePointCount("ab\uD800\uDC00b\uD800".toCharArray(),
-                                                1, 5));
-
-      try {
-          Character.codePointCount((char[]) null, 0, 1);
-          fail("No NPE, null char sequence.");
-      } catch (NullPointerException e) {
-      }
-
-      try {
-          Character.codePointCount("abc".toCharArray(), -1, 1);
-          fail("No IOOBE, negative start.");
-      } catch (IndexOutOfBoundsException e) {
-      }
-
-      try {
-          Character.codePointCount("abc".toCharArray(), 0, 4);
-          fail("No IOOBE, end greater than length.");
-      } catch (IndexOutOfBoundsException e) {
-      }
-
-      try {
-          Character.codePointCount("abc".toCharArray(), 1, 3);
-          fail("No IOOBE, end greater than start.");
-      } catch (IndexOutOfBoundsException e) {
-      }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getDirectionality",
-        args = {char.class}
-    )
-    public void test_getDirectionality() throws Exception {
-
-        byte[] directionalities = {
-                // BEGIN android-changed
-                // Unicode 5.1 defines U+0370 to be Greek capital letter Heta.
-                Character.DIRECTIONALITY_LEFT_TO_RIGHT,
-                // END android-changed.
-
-                Character.DIRECTIONALITY_LEFT_TO_RIGHT,
-                Character.DIRECTIONALITY_RIGHT_TO_LEFT,
-
-                // BEGIN android-changed
-                // Unicode standard 5.1 changed category of unicode point 0x0600 from AL to AN
-                Character.DIRECTIONALITY_ARABIC_NUMBER,
-                // END android-changed.
-
-                Character.DIRECTIONALITY_EUROPEAN_NUMBER,
-                // Character.DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR,
-                Character.DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR,
-                Character.DIRECTIONALITY_ARABIC_NUMBER,
-                Character.DIRECTIONALITY_COMMON_NUMBER_SEPARATOR,
-                Character.DIRECTIONALITY_NONSPACING_MARK,
-                Character.DIRECTIONALITY_BOUNDARY_NEUTRAL,
-                Character.DIRECTIONALITY_PARAGRAPH_SEPARATOR,
-                Character.DIRECTIONALITY_SEGMENT_SEPARATOR,
-                Character.DIRECTIONALITY_WHITESPACE,
-                Character.DIRECTIONALITY_OTHER_NEUTRALS,
-                Character.DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING,
-                Character.DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE,
-                Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING,
-                Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE,
-                Character.DIRECTIONALITY_POP_DIRECTIONAL_FORMAT
-                };
-
-        char[] characters = {
-                // BEGIN android-changed
-                // Unicode 5.1 defines U+0370 to be Greek capital letter Heta.
-                '\u0370', // 1
-                // END android-changed
-                '\u00B5', // 0
-                '\u05BE', // 1
-                // BEGIN android-changed
-                '\u0600', // 6
-                // END android-changed
-                '\u00B2', // 3
-                // '', // No common char in this group on android and java.
-                '\u00B1', // 5
-                '\u0660', // 6
-                '\u00A0', // 7
-                '\u0300', // 8
-                '\u009F', // 9
-                '\u0085', // 10
-                '\u001F', // 11
-                '\u0020', // 12
-                '\u00AB', // 13
-                '\u202A', // 14
-                '\u202D', // 15
-                '\u202B', // 16
-                '\u202E', // 17
-                '\u202C' // 18
-                };
-
-        for(int i = 0; i < directionalities.length; i++) {
-            assertEquals(directionalities[i],
-                    Character.getDirectionality(characters[i]));
-        }
-
-
-    }
-
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "offsetByCodePoints",
-        args = {java.lang.CharSequence.class, int.class, int.class}
-    )
-    public void test_offsetByCodePointsLjava_lang_CharSequenceII() {
-        int result = Character.offsetByCodePoints("a\uD800\uDC00b", 0, 2);
-        assertEquals(3, result);
-
-        result = Character.offsetByCodePoints("abcd", 3, -1);
-        assertEquals(2, result);
-
-        result = Character.offsetByCodePoints("a\uD800\uDC00b", 0, 3);
-        assertEquals(4, result);
-
-        result = Character.offsetByCodePoints("a\uD800\uDC00b", 3, -1);
-        assertEquals(1, result);
-
-        result = Character.offsetByCodePoints("a\uD800\uDC00b", 3, 0);
-        assertEquals(3, result);
-
-        result = Character.offsetByCodePoints("\uD800\uDC00bc", 3, 0);
-        assertEquals(3, result);
-
-        result = Character.offsetByCodePoints("a\uDC00bc", 3, -1);
-        assertEquals(2, result);
-
-        result = Character.offsetByCodePoints("a\uD800bc", 3, -1);
-        assertEquals(2, result);
-
-        try {
-            Character.offsetByCodePoints((CharSequence) null, 0, 1);
-            fail();
-        } catch (NullPointerException e) {
-        }
-
-        try {
-            Character.offsetByCodePoints("abc", -1, 1);
-            fail();
-        } catch (IndexOutOfBoundsException e) {
-        }
-
-        try {
-            Character.offsetByCodePoints("abc", 4, 1);
-            fail();
-        } catch (IndexOutOfBoundsException e) {
-        }
-
-        try {
-            Character.offsetByCodePoints("abc", 1, 3);
-            fail();
-        } catch (IndexOutOfBoundsException e) {
-        }
-
-        try {
-            Character.offsetByCodePoints("abc", 1, -2);
-            fail();
-        } catch (IndexOutOfBoundsException e) {
-        }
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "offsetByCodePoints",
-        args = {char[].class, int.class, int.class, int.class, int.class}
-    )
-    public void test_offsetByCodePoints$CIIII() {
-        int result = Character.offsetByCodePoints("a\uD800\uDC00b"
-                .toCharArray(), 0, 4, 0, 2);
-        assertEquals(3, result);
-
-        result = Character.offsetByCodePoints("a\uD800\uDC00b".toCharArray(),
-                0, 4, 0, 3);
-        assertEquals(4, result);
-
-        result = Character.offsetByCodePoints("a\uD800\uDC00b\uD800c"
-                .toCharArray(), 0, 5, 0, 3);
-        assertEquals(4, result);
-
-        result = Character
-                .offsetByCodePoints("abcd".toCharArray(), 0, 4, 3, -1);
-        assertEquals(2, result);
-
-        result = Character
-                .offsetByCodePoints("abcd".toCharArray(), 1, 2, 3, -2);
-        assertEquals(1, result);
-
-        result = Character.offsetByCodePoints("a\uD800\uDC00b".toCharArray(),
-                0, 4, 3, -1);
-        assertEquals(1, result);
-
-        result = Character.offsetByCodePoints("a\uD800\uDC00b".toCharArray(),
-                0, 2, 2, -1);
-        assertEquals(1, result);
-
-        result = Character.offsetByCodePoints("a\uD800\uDC00b".toCharArray(),
-                0, 4, 3, 0);
-        assertEquals(3, result);
-
-        result = Character.offsetByCodePoints("\uD800\uDC00bc".toCharArray(),
-                0, 4, 3, 0);
-        assertEquals(3, result);
-
-        result = Character.offsetByCodePoints("a\uDC00bc".toCharArray(), 0, 4,
-                3, -1);
-        assertEquals(2, result);
-
-        result = Character.offsetByCodePoints("a\uD800bc".toCharArray(), 0, 4,
-                3, -1);
-        assertEquals(2, result);
-
-        try {
-            Character.offsetByCodePoints(null, 0, 4, 1, 1);
-            fail();
-        } catch (NullPointerException e) {
-        }
-
-        try {
-            Character.offsetByCodePoints("abcd".toCharArray(), -1, 4, 1, 1);
-            fail();
-        } catch (IndexOutOfBoundsException e) {
-        }
-
-        try {
-            Character.offsetByCodePoints("abcd".toCharArray(), 0, -1, 1, 1);
-            fail();
-        } catch (IndexOutOfBoundsException e) {
-        }
-
-        try {
-            Character.offsetByCodePoints("abcd".toCharArray(), 2, 4, 1, 1);
-            fail();
-        } catch (IndexOutOfBoundsException e) {
-        }
-
-        try {
-            Character.offsetByCodePoints("abcd".toCharArray(), 1, 3, 0, 1);
-            fail();
-        } catch (IndexOutOfBoundsException e) {
-        }
-
-        try {
-            Character.offsetByCodePoints("abcd".toCharArray(), 1, 1, 3, 1);
-            fail();
-        } catch (IndexOutOfBoundsException e) {
-        }
-
-        try {
-            Character.offsetByCodePoints("abc".toCharArray(), 0, 3, 1, 3);
-            fail();
-        } catch (IndexOutOfBoundsException e) {
-        }
-
-        try {
-            Character.offsetByCodePoints("abc".toCharArray(), 0, 2, 1, 2);
-            fail();
-        } catch (IndexOutOfBoundsException e) {
-        }
-
-        try {
-            Character.offsetByCodePoints("abc".toCharArray(), 1, 3, 1, -2);
-            fail();
-        } catch (IndexOutOfBoundsException e) {
-        }
-    }
-
-    /**
-     * @tests java.lang.Character#compareTo(Character)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "compareTo",
-        args = {java.lang.Character.class}
-    )
-    public void test_compareToLjava_lang_Byte() {
-        final Character min = new Character(Character.MIN_VALUE);
-        final Character mid = new Character((char)(Character.MAX_VALUE/2));
-        final Character max = new Character(Character.MAX_VALUE);
-
-        assertTrue(max.compareTo(max) == 0);
-        assertTrue(min.compareTo(min) == 0);
-        assertTrue(mid.compareTo(mid) == 0);
-
-        assertTrue(max.compareTo(mid) > 0);
-        assertTrue(max.compareTo(min) > 0);
-
-        assertTrue(mid.compareTo(max) < 0);
-        assertTrue(mid.compareTo(min) > 0);
-
-        assertTrue(min.compareTo(mid) < 0);
-        assertTrue(min.compareTo(max) < 0);
-
-        try {
-            min.compareTo(null);
-            fail("No NPE");
-        } catch (NullPointerException e) {
-        }
-    }
-    @TestTargetNew(
-        level = TestLevel.PARTIAL,
-        notes = "Checks exceptions.",
-        method = "codePointAt",
-        args = {char[].class, int.class, int.class}
-    )
-    public void test_codePointAt_Invalid() {
-
-        try {
-            Character.codePointAt(null, 6, 4);
-            fail("Expected IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        } catch (Exception e) {
-            fail("Expected IndexOutOfBoundsException");
-        }
-
-        try {
-            Character.codePointAt(null, 4, 6);
-            fail("Expected NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        } catch (Exception e) {
-            fail("Expected NullPointerException");
-        }
-
-        try {
-            Character.codePointAt(null, 0, 0);
-            fail("Expected IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        } catch (Exception e) {
-            fail("Expected IndexOutOfBoundsException");
-        }
-    }
-
-    /**
-     * @tests java.lang.Character#Character(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "Character",
-        args = {char.class}
-    )
-    public void test_ConstructorC() {
-        assertEquals("Constructor failed", 'T', new Character('T').charValue());
-    }
-
-    /**
-     * @tests java.lang.Character#charValue()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "charValue",
-        args = {}
-    )
-    public void test_charValue() {
-        assertEquals("Incorrect char value returned", 'T', new Character('T')
-                .charValue());
-    }
-
-    /**
-     * @tests java.lang.Character#compareTo(java.lang.Character)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "compareTo",
-        args = {java.lang.Character.class}
-    )
-    public void test_compareToLjava_lang_Character() {
-        Character c = new Character('c');
-        Character x = new Character('c');
-        Character y = new Character('b');
-        Character z = new Character('d');
-
-        assertEquals("Returned false for same Character", 0, c.compareTo(c));
-        assertEquals("Returned false for identical Character",
-                0, c.compareTo(x));
-        assertTrue("Returned other than less than for lesser char", c
-                .compareTo(y) > 0);
-        assertTrue("Returned other than greater than for greater char", c
-                .compareTo(z) < 0);
-    }
-
-    /**
-     * @tests java.lang.Character#digit(char, int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "digit",
-        args = {char.class, int.class}
-    )
-    public void test_digitCI() {
-        assertEquals("Returned incorrect digit", 1, Character.digit('1', 10));
-        assertEquals("Returned incorrect digit", 15, Character.digit('F', 16));
-        assertEquals(-1, Character.digit('\uFFFF', 1));
-    }
-
-    /**
-     * @tests java.lang.Character#digit(int, int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "digit",
-        args = {int.class, int.class}
-    )
-    public void test_digit_II() {
-        assertEquals(1, Character.digit((int)'1', 10));
-        assertEquals(15, Character.digit((int)'F', 16));
-
-        assertEquals(-1, Character.digit(0x0000, 37));
-        assertEquals(-1, Character.digit(0x0045, 10));
-
-        assertEquals(10, Character.digit(0x0041, 20));
-        assertEquals(10, Character.digit(0x0061, 20));
-
-        assertEquals(-1, Character.digit(0x110000, 20));
-    }
-
-    /**
-     * @tests java.lang.Character#equals(java.lang.Object)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "equals",
-        args = {java.lang.Object.class}
-    )
-    public void test_equalsLjava_lang_Object() {
-        // Test for method boolean java.lang.Character.equals(java.lang.Object)
-        assertTrue("Equality test failed", new Character('A')
-                .equals(new Character('A')));
-        assertTrue("Equality test failed", !(new Character('A')
-                .equals(new Character('a'))));
-    }
-
-    /**
-     * @tests java.lang.Character#forDigit(int, int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "forDigit",
-        args = {int.class, int.class}
-    )
-    public void test_forDigitII() {
-        char hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-                'a', 'b', 'c', 'd', 'e', 'f' };
-        for (int i = 0; i < hexChars.length; i++) {
-            assertTrue("Returned incorrect char for " + Integer.toString(i),
-                    Character.forDigit(i, hexChars.length) == hexChars[i]);
-        }
-
-        char decimalChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8',
-                '9' };
-        for (int i = 0; i < decimalChars.length; i++) {
-            assertTrue(
-                    "Returned incorrect char for " + Integer.toString(i),
-                    Character.forDigit(i, decimalChars.length) == decimalChars[i]);
-        }
-
-    }
-
-    /**
-     * @tests java.lang.Character#getNumericValue(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getNumericValue",
-        args = {char.class}
-    )
-    public void test_getNumericValueC() {
-        assertEquals("Returned incorrect numeric value 1", 1, Character
-                .getNumericValue('1'));
-        assertEquals("Returned incorrect numeric value 2", 15, Character
-                .getNumericValue('F'));
-        assertEquals("Returned incorrect numeric value 3", -1, Character
-                .getNumericValue('\u221e'));
-        assertEquals("Returned incorrect numeric value 4", -2, Character
-                .getNumericValue('\u00be'));
-        assertEquals("Returned incorrect numeric value 5", 10000, Character
-                .getNumericValue('\u2182'));
-        assertEquals("Returned incorrect numeric value 6", 2, Character
-                .getNumericValue('\uff12'));
-    }
-
-    /**
-     * @tests java.lang.Character#getNumericValue(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getNumericValue",
-        args = {int.class}
-    )
-    public void test_getNumericValue_I() {
-        assertEquals(1, Character.getNumericValue((int)'1'));
-        assertEquals(15, Character.getNumericValue((int)'F'));
-        assertEquals(-1, Character.getNumericValue((int)'\u221e'));
-        assertEquals(-2, Character.getNumericValue((int)'\u00be'));
-        assertEquals(10000, Character.getNumericValue((int)'\u2182'));
-        assertEquals(2, Character.getNumericValue((int)'\uff12'));
-        assertEquals(-1, Character.getNumericValue(0xFFFF));
-
-        assertEquals(-1, Character.getNumericValue(0xFFFF));
-        assertEquals(0, Character.getNumericValue(0x1D7CE));
-        assertEquals(0, Character.getNumericValue(0x1D7D8));
-        assertEquals(-1, Character.getNumericValue(0x2F800));
-        assertEquals(-1, Character.getNumericValue(0x10FFFD));
-        assertEquals(-1, Character.getNumericValue(0x110000));
-
-        assertEquals(50, Character.getNumericValue(0x216C));
-
-        assertEquals(10, Character.getNumericValue(0x0041));
-        assertEquals(35, Character.getNumericValue(0x005A));
-        assertEquals(10, Character.getNumericValue(0x0061));
-        assertEquals(35, Character.getNumericValue(0x007A));
-        assertEquals(10, Character.getNumericValue(0xFF21));
-
-        //FIXME depends on ICU4J
-        //assertEquals(35, Character.getNumericValue(0xFF3A));
-
-        assertEquals(10, Character.getNumericValue(0xFF41));
-        assertEquals(35, Character.getNumericValue(0xFF5A));
-    }
-
-    /**
-     * @tests java.lang.Character#getType(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getType",
-        args = {char.class}
-    )
-    public void test_getTypeC() {
-        assertTrue("Returned incorrect type for: \n",
-                Character.getType('\n') == Character.CONTROL);
-        assertTrue("Returned incorrect type for: 1",
-                Character.getType('1') == Character.DECIMAL_DIGIT_NUMBER);
-        assertTrue("Returned incorrect type for: ' '",
-                Character.getType(' ') == Character.SPACE_SEPARATOR);
-        assertTrue("Returned incorrect type for: a",
-                Character.getType('a') == Character.LOWERCASE_LETTER);
-        assertTrue("Returned incorrect type for: A",
-                Character.getType('A') == Character.UPPERCASE_LETTER);
-        assertTrue("Returned incorrect type for: <",
-                Character.getType('<') == Character.MATH_SYMBOL);
-        assertTrue("Returned incorrect type for: ;",
-                Character.getType(';') == Character.OTHER_PUNCTUATION);
-        assertTrue("Returned incorrect type for: _",
-                Character.getType('_') == Character.CONNECTOR_PUNCTUATION);
-        assertTrue("Returned incorrect type for: $",
-                Character.getType('$') == Character.CURRENCY_SYMBOL);
-        assertTrue("Returned incorrect type for: \u2029", Character
-                .getType('\u2029') == Character.PARAGRAPH_SEPARATOR);
-
-        assertEquals("Wrong constant for FORMAT", 16, Character.FORMAT);
-        assertEquals("Wrong constant for PRIVATE_USE",
-                18, Character.PRIVATE_USE);
-    }
-
-    /**
-     * @tests java.lang.Character#getType(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getType",
-        args = {int.class}
-    )
-    public void test_getType_I() {
-        assertTrue(Character.getType((int) '\n') == Character.CONTROL);
-        assertTrue(Character.getType((int) '1') == Character.DECIMAL_DIGIT_NUMBER);
-        assertTrue(Character.getType((int) ' ') == Character.SPACE_SEPARATOR);
-        assertTrue(Character.getType((int) 'a') == Character.LOWERCASE_LETTER);
-        assertTrue(Character.getType((int) 'A') == Character.UPPERCASE_LETTER);
-        assertTrue(Character.getType((int) '<') == Character.MATH_SYMBOL);
-        assertTrue(Character.getType((int) ';') == Character.OTHER_PUNCTUATION);
-        assertTrue(Character.getType((int) '_') == Character.CONNECTOR_PUNCTUATION);
-        assertTrue(Character.getType((int) '$') == Character.CURRENCY_SYMBOL);
-        assertTrue(Character.getType((int) '\u2029') == Character.PARAGRAPH_SEPARATOR);
-
-        assertTrue(Character.getType(0x9FFF) == Character.UNASSIGNED);
-        assertTrue(Character.getType(0x30000) == Character.UNASSIGNED);
-        assertTrue(Character.getType(0x110000) == Character.UNASSIGNED);
-
-        assertTrue(Character.getType(0x0041) == Character.UPPERCASE_LETTER);
-        assertTrue(Character.getType(0x10400) == Character.UPPERCASE_LETTER);
-
-        assertTrue(Character.getType(0x0061) == Character.LOWERCASE_LETTER);
-        assertTrue(Character.getType(0x10428) == Character.LOWERCASE_LETTER);
-
-        assertTrue(Character.getType(0x01C5) == Character.TITLECASE_LETTER);
-        assertTrue(Character.getType(0x1FFC) == Character.TITLECASE_LETTER);
-
-        assertTrue(Character.getType(0x02B0) == Character.MODIFIER_LETTER);
-        assertTrue(Character.getType(0xFF9F) == Character.MODIFIER_LETTER);
-
-        assertTrue(Character.getType(0x01BB) == Character.OTHER_LETTER);
-        assertTrue(Character.getType(0x2F888) == Character.OTHER_LETTER);
-
-        assertTrue(Character.getType(0x0F82) == Character.NON_SPACING_MARK);
-        assertTrue(Character.getType(0x1D180) == Character.NON_SPACING_MARK);
-
-        assertTrue(Character.getType(0x0488) == Character.ENCLOSING_MARK);
-        assertTrue(Character.getType(0x20DE) == Character.ENCLOSING_MARK);
-
-        assertTrue(Character.getType(0x1938) == Character.COMBINING_SPACING_MARK);
-        assertTrue(Character.getType(0x1D165) == Character.COMBINING_SPACING_MARK);
-
-        assertTrue(Character.getType(0x194D) == Character.DECIMAL_DIGIT_NUMBER);
-        assertTrue(Character.getType(0x1D7CE) == Character.DECIMAL_DIGIT_NUMBER);
-
-        assertTrue(Character.getType(0x2160) == Character.LETTER_NUMBER);
-        assertTrue(Character.getType(0x1034A) == Character.LETTER_NUMBER);
-
-        assertTrue(Character.getType(0x00B2) == Character.OTHER_NUMBER);
-        assertTrue(Character.getType(0x10120) == Character.OTHER_NUMBER);
-
-        assertTrue(Character.getType(0x0020) == Character.SPACE_SEPARATOR);
-        assertTrue(Character.getType(0x3000) == Character.SPACE_SEPARATOR);
-
-        assertTrue(Character.getType(0x2028) == Character.LINE_SEPARATOR);
-
-        assertTrue(Character.getType(0x2029) == Character.PARAGRAPH_SEPARATOR);
-
-        assertTrue(Character.getType(0x0000) == Character.CONTROL);
-        assertTrue(Character.getType(0x009F) == Character.CONTROL);
-
-        assertTrue(Character.getType(0x00AD) == Character.FORMAT);
-        assertTrue(Character.getType(0xE007F) == Character.FORMAT);
-
-        assertTrue(Character.getType(0xE000) == Character.PRIVATE_USE);
-        assertTrue(Character.getType(0x10FFFD) == Character.PRIVATE_USE);
-
-        assertTrue(Character.getType(0xD800) == Character.SURROGATE);
-        assertTrue(Character.getType(0xDFFF) == Character.SURROGATE);
-
-        assertTrue(Character.getType(0xFE31) == Character.DASH_PUNCTUATION);
-        assertTrue(Character.getType(0xFF0D) == Character.DASH_PUNCTUATION);
-
-        assertTrue(Character.getType(0x0028) == Character.START_PUNCTUATION);
-        assertTrue(Character.getType(0xFF62) == Character.START_PUNCTUATION);
-
-        assertTrue(Character.getType(0x0029) == Character.END_PUNCTUATION);
-        assertTrue(Character.getType(0xFF63) == Character.END_PUNCTUATION);
-
-        assertTrue(Character.getType(0x005F) == Character.CONNECTOR_PUNCTUATION);
-        assertTrue(Character.getType(0xFF3F) == Character.CONNECTOR_PUNCTUATION);
-
-        assertTrue(Character.getType(0x2034) == Character.OTHER_PUNCTUATION);
-        assertTrue(Character.getType(0x1039F) == Character.OTHER_PUNCTUATION);
-
-        assertTrue(Character.getType(0x002B) == Character.MATH_SYMBOL);
-        assertTrue(Character.getType(0x1D6C1) == Character.MATH_SYMBOL);
-
-        assertTrue(Character.getType(0x0024) == Character.CURRENCY_SYMBOL);
-        assertTrue(Character.getType(0xFFE6) == Character.CURRENCY_SYMBOL);
-
-        assertTrue(Character.getType(0x005E) == Character.MODIFIER_SYMBOL);
-        assertTrue(Character.getType(0xFFE3) == Character.MODIFIER_SYMBOL);
-
-        assertTrue(Character.getType(0x00A6) == Character.OTHER_SYMBOL);
-        assertTrue(Character.getType(0x1D356) == Character.OTHER_SYMBOL);
-
-        assertTrue(Character.getType(0x00AB) == Character.INITIAL_QUOTE_PUNCTUATION);
-        assertTrue(Character.getType(0x2039) == Character.INITIAL_QUOTE_PUNCTUATION);
-
-        assertTrue(Character.getType(0x00BB) == Character.FINAL_QUOTE_PUNCTUATION);
-        assertTrue(Character.getType(0x203A) == Character.FINAL_QUOTE_PUNCTUATION);
-    }
-
-    /**
-     * @tests java.lang.Character#hashCode()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "hashCode",
-        args = {}
-    )
-    public void test_hashCode() {
-        assertEquals("Incorrect hash returned",
-                89, new Character('Y').hashCode());
-    }
-
-    /**
-     * @tests java.lang.Character#isDefined(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isDefined",
-        args = {char.class}
-    )
-    public void test_isDefinedC() {
-        assertTrue("Defined character returned false", Character.isDefined('v'));
-        assertTrue("Defined character returned false", Character
-                .isDefined('\u6039'));
-    }
-
-    /**
-     * @tests java.lang.Character#isDefined(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isDefined",
-        args = {int.class}
-    )
-    public void test_isDefined_I(){
-        assertTrue(Character.isDefined((int)'v'));
-        assertTrue(Character.isDefined((int)'\u6039'));
-        assertTrue(Character.isDefined(0x10300));
-
-        assertFalse(Character.isDefined(0x30000));
-        assertFalse(Character.isDefined(0x3FFFF));
-        assertFalse(Character.isDefined(0x110000));
-    }
-
-    /**
-     * @tests java.lang.Character#isDigit(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isDigit",
-        args = {char.class}
-    )
-    public void test_isDigitC() {
-        assertTrue("Digit returned false", Character.isDigit('1'));
-        assertTrue("Non-Digit returned false", !Character.isDigit('A'));
-    }
-
-    /**
-     * @tests java.lang.Character#isDigit(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isDigit",
-        args = {int.class}
-    )
-    public void test_isDigit_I() {
-        assertTrue(Character.isDigit((int) '1'));
-        assertFalse(Character.isDigit((int) 'A'));
-
-        assertTrue(Character.isDigit(0x0030));
-        assertTrue(Character.isDigit(0x0035));
-        assertTrue(Character.isDigit(0x0039));
-
-        assertTrue(Character.isDigit(0x0660));
-        assertTrue(Character.isDigit(0x0665));
-        assertTrue(Character.isDigit(0x0669));
-
-        assertTrue(Character.isDigit(0x06F0));
-        assertTrue(Character.isDigit(0x06F5));
-        assertTrue(Character.isDigit(0x06F9));
-
-        assertTrue(Character.isDigit(0x0966));
-        assertTrue(Character.isDigit(0x096A));
-        assertTrue(Character.isDigit(0x096F));
-
-        assertTrue(Character.isDigit(0xFF10));
-        assertTrue(Character.isDigit(0xFF15));
-        assertTrue(Character.isDigit(0xFF19));
-
-        assertTrue(Character.isDigit(0x1D7CE));
-        assertTrue(Character.isDigit(0x1D7D8));
-
-        assertFalse(Character.isDigit(0x2F800));
-        assertFalse(Character.isDigit(0x10FFFD));
-        assertFalse(Character.isDigit(0x110000));
-    }
-
-    /**
-     * @tests java.lang.Character#isIdentifierIgnorable(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isIdentifierIgnorable",
-        args = {char.class}
-    )
-    public void test_isIdentifierIgnorableC() {
-        assertTrue("Ignorable whitespace returned false", Character
-                .isIdentifierIgnorable('\u0007'));
-        assertTrue("Ignorable non - whitespace  control returned false",
-                Character.isIdentifierIgnorable('\u000f'));
-        assertTrue("Ignorable join control returned false", Character
-                .isIdentifierIgnorable('\u200e'));
-
-        // the spec is wrong, and our implementation is correct
-        assertTrue("Ignorable bidi control returned false", Character
-                .isIdentifierIgnorable('\u202b'));
-
-        assertTrue("Ignorable format control returned false", Character
-                .isIdentifierIgnorable('\u206c'));
-        assertTrue("Ignorable zero-width no-break returned false", Character
-                .isIdentifierIgnorable('\ufeff'));
-
-        assertTrue("Non-Ignorable returned true", !Character
-                .isIdentifierIgnorable('\u0065'));
-    }
-
-    /**
-     * @tests java.lang.Character#isIdentifierIgnorable(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isIdentifierIgnorable",
-        args = {int.class}
-    )
-    public void test_isIdentifierIgnorable_I() {
-        assertTrue(Character.isIdentifierIgnorable(0x0000));
-        assertTrue(Character.isIdentifierIgnorable(0x0004));
-        assertTrue(Character.isIdentifierIgnorable(0x0008));
-
-        assertTrue(Character.isIdentifierIgnorable(0x000E));
-        assertTrue(Character.isIdentifierIgnorable(0x0013));
-        assertTrue(Character.isIdentifierIgnorable(0x001B));
-
-        assertTrue(Character.isIdentifierIgnorable(0x007F));
-        assertTrue(Character.isIdentifierIgnorable(0x008F));
-        assertTrue(Character.isIdentifierIgnorable(0x009F));
-
-        assertTrue(Character.isIdentifierIgnorable(0x202b));
-        assertTrue(Character.isIdentifierIgnorable(0x206c));
-        assertTrue(Character.isIdentifierIgnorable(0xfeff));
-        assertFalse(Character.isIdentifierIgnorable(0x0065));
-
-        assertTrue(Character.isIdentifierIgnorable(0x1D173));
-
-        assertFalse(Character.isIdentifierIgnorable(0x10FFFD));
-        assertFalse(Character.isIdentifierIgnorable(0x110000));
-    }
-
-    /**
-     * @tests java.lang.Character#isMirrored(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isMirrored",
-        args = {char.class}
-    )
-    public void test_isMirrored_C() {
-        assertTrue(Character.isMirrored('\u0028'));
-        assertFalse(Character.isMirrored('\uFFFF'));
-    }
-
-    /**
-     * @tests java.lang.Character#isMirrored(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isMirrored",
-        args = {int.class}
-    )
-    public void test_isMirrored_I() {
-        assertTrue(Character.isMirrored(0x0028));
-        assertFalse(Character.isMirrored(0xFFFF));
-        assertFalse(Character.isMirrored(0x110000));
-    }
-
-    /**
-     * @tests java.lang.Character#isISOControl(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isISOControl",
-        args = {char.class}
-    )
-    public void test_isISOControlC() {
-        // Test for method boolean java.lang.Character.isISOControl(char)
-        for (int i = 0; i < 32; i++)
-            assertTrue("ISOConstrol char returned false", Character
-                    .isISOControl((char) i));
-
-        for (int i = 127; i < 160; i++)
-            assertTrue("ISOConstrol char returned false", Character
-                    .isISOControl((char) i));
-
-        for (int i = 160; i < 260; i++)
-            assertFalse("Not ISOConstrol char returned true", Character
-                .isISOControl((char) i));
-    }
-
-    /**
-     * @tests java.lang.Character#isISOControl(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isISOControl",
-        args = {int.class}
-    )
-    public void test_isISOControlI() {
-        // Test for method boolean java.lang.Character.isISOControl(char)
-        for (int i = 0; i < 32; i++)
-            assertTrue("ISOConstrol char returned false", Character
-                .isISOControl(i));
-
-        for (int i = 127; i < 160; i++)
-            assertTrue("ISOConstrol char returned false", Character
-                .isISOControl(i));
-
-        for (int i = 160; i < 260; i++)
-            assertFalse("Not ISOConstrol char returned true", Character
-                .isISOControl(i));
-
-    }
-
-
-    /**
-     * @tests java.lang.Character#isJavaIdentifierPart(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isJavaIdentifierPart",
-        args = {char.class}
-    )
-    public void test_isJavaIdentifierPartC() {
-        assertTrue("letter returned false", Character.isJavaIdentifierPart('l'));
-        assertTrue("currency returned false", Character
-                .isJavaIdentifierPart('$'));
-        assertTrue("digit returned false", Character.isJavaIdentifierPart('9'));
-        assertTrue("connecting char returned false", Character
-                .isJavaIdentifierPart('_'));
-        assertTrue("ignorable control returned false", Character
-                .isJavaIdentifierPart('\u200c'));
-        assertTrue("semi returned true", !Character.isJavaIdentifierPart(';'));
-    }
-
-    /**
-     * @tests java.lang.Character#isJavaIdentifierPart(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isJavaIdentifierPart",
-        args = {int.class}
-    )
-    public void test_isJavaIdentifierPart_I() {
-        assertTrue(Character.isJavaIdentifierPart((int)'l'));
-        assertTrue(Character.isJavaIdentifierPart((int)'$'));
-        assertTrue(Character.isJavaIdentifierPart((int)'9'));
-        assertTrue(Character.isJavaIdentifierPart((int)'_'));
-        assertFalse(Character.isJavaIdentifierPart((int)';'));
-
-        assertTrue(Character.isJavaIdentifierPart(0x0041));
-        assertTrue(Character.isJavaIdentifierPart(0x10400));
-        assertTrue(Character.isJavaIdentifierPart(0x0061));
-        assertTrue(Character.isJavaIdentifierPart(0x10428));
-        assertTrue(Character.isJavaIdentifierPart(0x01C5));
-        assertTrue(Character.isJavaIdentifierPart(0x1FFC));
-        assertTrue(Character.isJavaIdentifierPart(0x02B0));
-        assertTrue(Character.isJavaIdentifierPart(0xFF9F));
-        assertTrue(Character.isJavaIdentifierPart(0x01BB));
-        assertTrue(Character.isJavaIdentifierPart(0x2F888));
-
-        assertTrue(Character.isJavaIdentifierPart(0x0024));
-        assertTrue(Character.isJavaIdentifierPart(0xFFE6));
-
-        assertTrue(Character.isJavaIdentifierPart(0x005F));
-        assertTrue(Character.isJavaIdentifierPart(0xFF3F));
-
-        assertTrue(Character.isJavaIdentifierPart(0x194D));
-        assertTrue(Character.isJavaIdentifierPart(0x1D7CE));
-        assertTrue(Character.isJavaIdentifierPart(0x2160));
-        assertTrue(Character.isJavaIdentifierPart(0x1034A));
-
-        assertTrue(Character.isJavaIdentifierPart(0x0F82));
-        assertTrue(Character.isJavaIdentifierPart(0x1D180));
-
-        assertTrue(Character.isJavaIdentifierPart(0x0000));
-        assertTrue(Character.isJavaIdentifierPart(0x0008));
-        assertTrue(Character.isJavaIdentifierPart(0x000E));
-        assertTrue(Character.isJavaIdentifierPart(0x001B));
-        assertTrue(Character.isJavaIdentifierPart(0x007F));
-        assertTrue(Character.isJavaIdentifierPart(0x009F));
-        assertTrue(Character.isJavaIdentifierPart(0x00AD));
-        assertTrue(Character.isJavaIdentifierPart(0xE007F));
-
-        assertTrue(Character.isJavaIdentifierPart(0x200C));
-    }
-
-    /**
-     * @tests java.lang.Character#isJavaIdentifierStart(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isJavaIdentifierStart",
-        args = {char.class}
-    )
-    public void test_isJavaIdentifierStartC() {
-        assertTrue("letter returned false", Character
-                .isJavaIdentifierStart('l'));
-        assertTrue("currency returned false", Character
-                .isJavaIdentifierStart('$'));
-        assertTrue("connecting char returned false", Character
-                .isJavaIdentifierStart('_'));
-        assertTrue("digit returned true", !Character.isJavaIdentifierStart('9'));
-        assertTrue("ignorable control returned true", !Character
-                .isJavaIdentifierStart('\u200b'));
-        assertTrue("semi returned true", !Character.isJavaIdentifierStart(';'));
-    }
-
-    /**
-     * @tests java.lang.Character#isJavaIdentifierStart(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isJavaIdentifierStart",
-        args = {int.class}
-    )
-    public void test_isJavaIdentifierStart_I() {
-        assertTrue(Character.isJavaIdentifierStart((int)'l'));
-        assertTrue(Character.isJavaIdentifierStart((int)'$'));
-        assertTrue(Character.isJavaIdentifierStart((int)'_'));
-        assertFalse(Character.isJavaIdentifierStart((int)'9'));
-        assertFalse(Character.isJavaIdentifierStart((int)'\u200b'));
-        assertFalse(Character.isJavaIdentifierStart((int)';'));
-
-        assertTrue(Character.isJavaIdentifierStart(0x0041));
-        assertTrue(Character.isJavaIdentifierStart(0x10400));
-        assertTrue(Character.isJavaIdentifierStart(0x0061));
-        assertTrue(Character.isJavaIdentifierStart(0x10428));
-        assertTrue(Character.isJavaIdentifierStart(0x01C5));
-        assertTrue(Character.isJavaIdentifierStart(0x1FFC));
-        assertTrue(Character.isJavaIdentifierStart(0x02B0));
-        assertTrue(Character.isJavaIdentifierStart(0xFF9F));
-        assertTrue(Character.isJavaIdentifierStart(0x01BB));
-        assertTrue(Character.isJavaIdentifierStart(0x2F888));
-
-        assertTrue(Character.isJavaIdentifierPart(0x0024));
-        assertTrue(Character.isJavaIdentifierPart(0xFFE6));
-
-        assertTrue(Character.isJavaIdentifierPart(0x005F));
-        assertTrue(Character.isJavaIdentifierPart(0xFF3F));
-
-        assertTrue(Character.isJavaIdentifierPart(0x2160));
-        assertTrue(Character.isJavaIdentifierPart(0x1034A));
-
-        assertFalse(Character.isJavaIdentifierPart(0x110000));
-    }
-
-    /**
-     * @tests java.lang.Character#isJavaLetter(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isJavaLetter",
-        args = {char.class}
-    )
-    @SuppressWarnings("deprecation")
-    public void test_isJavaLetterC() {
-        assertTrue("letter returned false", Character.isJavaLetter('l'));
-        assertTrue("currency returned false", Character.isJavaLetter('$'));
-        assertTrue("connecting char returned false", Character
-                .isJavaLetter('_'));
-
-        assertTrue("digit returned true", !Character.isJavaLetter('9'));
-        assertTrue("ignored control returned true", !Character
-                .isJavaLetter('\u200b'));
-        assertTrue("semi returned true", !Character.isJavaLetter(';'));
-    }
-
-    /**
-     * @tests java.lang.Character#isJavaLetterOrDigit(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isJavaLetterOrDigit",
-        args = {char.class}
-    )
-    @SuppressWarnings("deprecation")
-    public void test_isJavaLetterOrDigitC() {
-        assertTrue("letter returned false", Character.isJavaLetterOrDigit('l'));
-        assertTrue("currency returned false", Character
-                .isJavaLetterOrDigit('$'));
-        assertTrue("digit returned false", Character.isJavaLetterOrDigit('9'));
-        assertTrue("connecting char returned false", Character
-                .isJavaLetterOrDigit('_'));
-        assertTrue("semi returned true", !Character.isJavaLetterOrDigit(';'));
-    }
-
-    /**
-     * @tests java.lang.Character#isLetter(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isLetter",
-        args = {char.class}
-    )
-    public void test_isLetterC() {
-        assertTrue("Letter returned false", Character.isLetter('L'));
-        assertTrue("Non-Letter returned true", !Character.isLetter('9'));
-    }
-
-    /**
-     * @tests java.lang.Character#isLetter(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isLetter",
-        args = {int.class}
-    )
-    public void test_isLetter_I() {
-        assertTrue(Character.isLetter((int)'L'));
-        assertFalse(Character.isLetter((int)'9'));
-
-        assertTrue(Character.isLetter(0x1FA9));
-        assertTrue(Character.isLetter(0x1D400));
-        assertTrue(Character.isLetter(0x1D622));
-        assertTrue(Character.isLetter(0x10000));
-
-        assertFalse(Character.isLetter(0x1012C));
-        assertFalse(Character.isLetter(0x110000));
-    }
-
-    /**
-     * @tests java.lang.Character#isLetterOrDigit(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isLetterOrDigit",
-        args = {char.class}
-    )
-    public void test_isLetterOrDigitC() {
-        assertTrue("Digit returned false", Character.isLetterOrDigit('9'));
-        assertTrue("Letter returned false", Character.isLetterOrDigit('K'));
-        assertTrue("Control returned true", !Character.isLetterOrDigit('\n'));
-        assertTrue("Punctuation returned true", !Character.isLetterOrDigit('?'));
-    }
-
-    /**
-     * @tests java.lang.Character#isLetterOrDigit(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isLetterOrDigit",
-        args = {int.class}
-    )
-    public void test_isLetterOrDigit_I() {
-        assertTrue(Character.isLetterOrDigit((int)'9'));
-        assertTrue(Character.isLetterOrDigit((int)'K'));
-        assertFalse(Character.isLetterOrDigit((int)'\n'));
-        assertFalse(Character.isLetterOrDigit((int)'?'));
-
-        assertTrue(Character.isLetterOrDigit(0x1FA9));
-        assertTrue(Character.isLetterOrDigit(0x1D400));
-        assertTrue(Character.isLetterOrDigit(0x1D622));
-        assertTrue(Character.isLetterOrDigit(0x10000));
-
-        assertTrue(Character.isLetterOrDigit(0x1D7CE));
-        assertTrue(Character.isLetterOrDigit(0x1D7D8));
-
-        assertFalse(Character.isLetterOrDigit(0x10FFFD));
-        assertFalse(Character.isLetterOrDigit(0x1012C));
-        assertFalse(Character.isLetterOrDigit(0x110000));
-    }
-
-    /**
-     * @tests java.lang.Character#isLowerCase(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isLowerCase",
-        args = {char.class}
-    )
-    public void test_isLowerCaseC() {
-        assertTrue("lower returned false", Character.isLowerCase('a'));
-        assertTrue("upper returned true", !Character.isLowerCase('T'));
-    }
-
-    /**
-     * @tests java.lang.Character#isLowerCase(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isLowerCase",
-        args = {int.class}
-    )
-    public void test_isLowerCase_I() {
-        assertTrue(Character.isLowerCase((int)'a'));
-        assertFalse(Character.isLowerCase((int)'T'));
-
-        assertTrue(Character.isLowerCase(0x10428));
-        assertTrue(Character.isLowerCase(0x1D4EA));
-
-        assertFalse(Character.isLowerCase(0x1D504));
-        assertFalse(Character.isLowerCase(0x30000));
-        assertFalse(Character.isLowerCase(0x110000));
-    }
-
-    /**
-     * @tests java.lang.Character#isSpace(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isSpace",
-        args = {char.class}
-    )
-    @SuppressWarnings("deprecation")
-    public void test_isSpaceC() {
-        // Test for method boolean java.lang.Character.isSpace(char)
-        assertTrue("space returned false", Character.isSpace('\n'));
-        assertTrue("non-space returned true", !Character.isSpace('T'));
-    }
-
-    /**
-     * @tests java.lang.Character#isSpaceChar(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isSpaceChar",
-        args = {char.class}
-    )
-    public void test_isSpaceCharC() {
-        assertTrue("space returned false", Character.isSpaceChar('\u0020'));
-        assertTrue("non-space returned true", !Character.isSpaceChar('\n'));
-    }
-
-    /**
-     * @tests java.lang.Character#isSpaceChar(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isSpaceChar",
-        args = {int.class}
-    )
-    public void test_isSpaceChar_I() {
-        assertTrue(Character.isSpaceChar((int)'\u0020'));
-        assertFalse(Character.isSpaceChar((int)'\n'));
-
-        assertTrue(Character.isSpaceChar(0x2000));
-        assertTrue(Character.isSpaceChar(0x200A));
-
-        assertTrue(Character.isSpaceChar(0x2028));
-        assertTrue(Character.isSpaceChar(0x2029));
-
-        assertFalse(Character.isSpaceChar(0x110000));
-    }
-
-    /**
-     * @tests java.lang.Character#isTitleCase(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isTitleCase",
-        args = {char.class}
-    )
-    public void test_isTitleCaseC() {
-        char[] tChars = { (char) 0x01c5, (char) 0x01c8, (char) 0x01cb,
-                (char) 0x01f2, (char) 0x1f88, (char) 0x1f89, (char) 0x1f8a,
-                (char) 0x1f8b, (char) 0x1f8c, (char) 0x1f8d, (char) 0x1f8e,
-                (char) 0x1f8f, (char) 0x1f98, (char) 0x1f99, (char) 0x1f9a,
-                (char) 0x1f9b, (char) 0x1f9c, (char) 0x1f9d, (char) 0x1f9e,
-                (char) 0x1f9f, (char) 0x1fa8, (char) 0x1fa9, (char) 0x1faa,
-                (char) 0x1fab, (char) 0x1fac, (char) 0x1fad, (char) 0x1fae,
-                (char) 0x1faf, (char) 0x1fbc, (char) 0x1fcc, (char) 0x1ffc };
-        byte tnum = 0;
-        for (char c = 0; c < 65535; c++) {
-            if (Character.isTitleCase(c)) {
-                tnum++;
-                int i;
-                for (i = 0; i < tChars.length; i++)
-                    if (tChars[i] == c)
-                        i = tChars.length + 1;
-                if (i < tChars.length) {
-                    fail("Non Title Case char returned true");
-                }
-            }
-        }
-        assertTrue("Failed to find all Title Case chars", tnum == tChars.length);
-    }
-
-    /**
-     * @tests java.lang.Character#isTitleCase(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isTitleCase",
-        args = {int.class}
-    )
-    public void test_isTitleCase_I() {
-        //all the titlecase characters
-        int[] titleCaseCharacters = { 0x01c5, 0x01c8, 0x01cb, 0x01f2, 0x1f88,
-                0x1f89, 0x1f8a, 0x1f8b, 0x1f8c, 0x1f8d, 0x1f8e, 0x1f8f, 0x1f98,
-                0x1f99, 0x1f9a, 0x1f9b, 0x1f9c, 0x1f9d, 0x1f9e, 0x1f9f, 0x1fa8,
-                0x1fa9, 0x1faa, 0x1fab, 0x1fac, 0x1fad, 0x1fae, 0x1faf, 0x1fbc,
-                0x1fcc, 0x1ffc };
-
-        for (int i = 0; i < titleCaseCharacters.length; i++) {
-            assertTrue(Character.isTitleCase(titleCaseCharacters[i]));
-        }
-
-        assertFalse(Character.isTitleCase(0x110000));
-    }
-
-    /**
-     * @tests java.lang.Character#isUnicodeIdentifierPart(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isUnicodeIdentifierPart",
-        args = {char.class}
-    )
-    public void test_isUnicodeIdentifierPartC() {
-        assertTrue("'a' returned false", Character.isUnicodeIdentifierPart('a'));
-        assertTrue("'2' returned false", Character.isUnicodeIdentifierPart('2'));
-        assertTrue("'+' returned true", !Character.isUnicodeIdentifierPart('+'));
-    }
-
-    /**
-     * @tests java.lang.Character#isUnicodeIdentifierPart(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isUnicodeIdentifierPart",
-        args = {int.class}
-    )
-    public void test_isUnicodeIdentifierPart_I() {
-        assertTrue(Character.isUnicodeIdentifierPart((int)'a'));
-        assertTrue(Character.isUnicodeIdentifierPart((int)'2'));
-        assertFalse(Character.isUnicodeIdentifierPart((int)'+'));
-
-        assertTrue(Character.isUnicodeIdentifierPart(0x1FA9));
-        assertTrue(Character.isUnicodeIdentifierPart(0x1D400));
-        assertTrue(Character.isUnicodeIdentifierPart(0x1D622));
-        assertTrue(Character.isUnicodeIdentifierPart(0x10000));
-
-        assertTrue(Character.isUnicodeIdentifierPart(0x0030));
-        assertTrue(Character.isUnicodeIdentifierPart(0x0035));
-        assertTrue(Character.isUnicodeIdentifierPart(0x0039));
-
-        assertTrue(Character.isUnicodeIdentifierPart(0x0660));
-        assertTrue(Character.isUnicodeIdentifierPart(0x0665));
-        assertTrue(Character.isUnicodeIdentifierPart(0x0669));
-
-        assertTrue(Character.isUnicodeIdentifierPart(0x06F0));
-        assertTrue(Character.isUnicodeIdentifierPart(0x06F5));
-        assertTrue(Character.isUnicodeIdentifierPart(0x06F9));
-
-        assertTrue(Character.isUnicodeIdentifierPart(0x0966));
-        assertTrue(Character.isUnicodeIdentifierPart(0x096A));
-        assertTrue(Character.isUnicodeIdentifierPart(0x096F));
-
-        assertTrue(Character.isUnicodeIdentifierPart(0xFF10));
-        assertTrue(Character.isUnicodeIdentifierPart(0xFF15));
-        assertTrue(Character.isUnicodeIdentifierPart(0xFF19));
-
-        assertTrue(Character.isUnicodeIdentifierPart(0x1D7CE));
-        assertTrue(Character.isUnicodeIdentifierPart(0x1D7D8));
-
-        assertTrue(Character.isUnicodeIdentifierPart(0x16EE));
-        assertTrue(Character.isUnicodeIdentifierPart(0xFE33));
-        assertTrue(Character.isUnicodeIdentifierPart(0xFF10));
-        assertTrue(Character.isUnicodeIdentifierPart(0x1D165));
-        assertTrue(Character.isUnicodeIdentifierPart(0x1D167));
-        assertTrue(Character.isUnicodeIdentifierPart(0x1D173));
-
-        assertFalse(Character.isUnicodeIdentifierPart(0x10FFFF));
-        assertFalse(Character.isUnicodeIdentifierPart(0x110000));
-    }
-
-    /**
-     * @tests java.lang.Character#isUnicodeIdentifierStart(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isUnicodeIdentifierStart",
-        args = {char.class}
-    )
-    public void test_isUnicodeIdentifierStartC() {
-        assertTrue("'a' returned false", Character
-                .isUnicodeIdentifierStart('a'));
-        assertTrue("'2' returned true", !Character
-                .isUnicodeIdentifierStart('2'));
-        assertTrue("'+' returned true", !Character
-                .isUnicodeIdentifierStart('+'));
-    }
-
-    /**
-     * @tests java.lang.Character#isUnicodeIdentifierStart(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isUnicodeIdentifierStart",
-        args = {int.class}
-    )
-    public void test_isUnicodeIdentifierStart_I() {
-
-        assertTrue(Character.isUnicodeIdentifierStart((int) 'a'));
-        assertFalse(Character.isUnicodeIdentifierStart((int) '2'));
-        assertFalse(Character.isUnicodeIdentifierStart((int) '+'));
-
-        assertTrue(Character.isUnicodeIdentifierStart(0x1FA9));
-        assertTrue(Character.isUnicodeIdentifierStart(0x1D400));
-        assertTrue(Character.isUnicodeIdentifierStart(0x1D622));
-        assertTrue(Character.isUnicodeIdentifierStart(0x10000));
-
-        assertTrue(Character.isUnicodeIdentifierStart(0x16EE));
-
-        // number is not a valid start of a Unicode identifier
-        assertFalse(Character.isUnicodeIdentifierStart(0x0030));
-        assertFalse(Character.isUnicodeIdentifierStart(0x0039));
-        assertFalse(Character.isUnicodeIdentifierStart(0x0660));
-        assertFalse(Character.isUnicodeIdentifierStart(0x0669));
-        assertFalse(Character.isUnicodeIdentifierStart(0x06F0));
-        assertFalse(Character.isUnicodeIdentifierStart(0x06F9));
-
-        assertFalse(Character.isUnicodeIdentifierPart(0x10FFFF));
-        assertFalse(Character.isUnicodeIdentifierPart(0x110000));
-    }
-
-    /**
-     * @tests java.lang.Character#isUpperCase(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isUpperCase",
-        args = {char.class}
-    )
-    public void test_isUpperCaseC() {
-        assertTrue("Incorrect case value", !Character.isUpperCase('t'));
-        assertTrue("Incorrect case value", Character.isUpperCase('T'));
-        assertFalse("Incorrect case value", Character.isUpperCase('1'));
-        assertFalse("Incorrect case value", Character.isUpperCase('?'));
-    }
-
-    /**
-     * @tests java.lang.Character#isUpperCase(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isUpperCase",
-        args = {int.class}
-    )
-    public void test_isUpperCase_I() {
-        assertFalse(Character.isUpperCase((int)'t'));
-        assertTrue(Character.isUpperCase((int)'T'));
-
-        assertTrue(Character.isUpperCase(0x1D504));
-        assertTrue(Character.isUpperCase(0x1D608));
-
-        assertFalse(Character.isUpperCase(0x1D656));
-        assertFalse(Character.isUpperCase(0x10FFFD));
-        assertFalse(Character.isUpperCase(0x110000));
-    }
-
-    /**
-     * @tests java.lang.Character#isWhitespace(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isWhitespace",
-        args = {char.class}
-    )
-    public void test_isWhitespaceC() {
-        assertTrue("space returned false", Character.isWhitespace('\n'));
-        assertTrue("non-space returned true", !Character.isWhitespace('T'));
-    }
-
-    /**
-     * @tests java.lang.Character#isWhitespace(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isWhitespace",
-        args = {int.class}
-    )
-    public void test_isWhitespace_I() {
-        assertTrue(Character.isWhitespace((int)'\n'));
-        assertFalse(Character.isWhitespace((int)'T'));
-
-        assertTrue(Character.isWhitespace(0x0009));
-        assertTrue(Character.isWhitespace(0x000A));
-        assertTrue(Character.isWhitespace(0x000B));
-        assertTrue(Character.isWhitespace(0x000C));
-        assertTrue(Character.isWhitespace(0x000D));
-        assertTrue(Character.isWhitespace(0x001C));
-        assertTrue(Character.isWhitespace(0x001D));
-        assertTrue(Character.isWhitespace(0x001F));
-        assertTrue(Character.isWhitespace(0x001E));
-
-        assertTrue(Character.isWhitespace(0x2000));
-        assertTrue(Character.isWhitespace(0x200A));
-
-        assertTrue(Character.isWhitespace(0x2028));
-        assertTrue(Character.isWhitespace(0x2029));
-
-        assertFalse(Character.isWhitespace(0x00A0));
-        assertFalse(Character.isWhitespace(0x202F));
-        assertFalse(Character.isWhitespace(0x110000));
-
-        assertFalse(Character.isWhitespace(0xFEFF));
-
-        //FIXME depend on ICU4J
-        //assertFalse(Character.isWhitespace(0x2007));
-
-    }
-
-    /**
-     * @tests java.lang.Character#reverseBytes(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "reverseBytes",
-        args = {char.class}
-    )
-    public void test_reverseBytesC() {
-        char original[] = new char[]{0x0000, 0x0010, 0x00AA, 0xB000, 0xCC00, 0xABCD, 0xFFAA};
-        char reversed[] = new char[]{0x0000, 0x1000, 0xAA00, 0x00B0, 0x00CC, 0xCDAB, 0xAAFF};
-        assertTrue("Test self check", original.length==reversed.length);
-
-        for (int i=0; i<original.length; i++) {
-            char origChar = original[i];
-            char reversedChar = reversed[i];
-            char origReversed= Character.reverseBytes(origChar);
-
-            assertTrue("java.lang.Character.reverseBytes failed: orig char="
-                +Integer.toHexString(origChar)+", reversed char="
-                +Integer.toHexString(origReversed), reversedChar==origReversed);
-        }
-    }
-
-    /**
-     * @tests java.lang.Character#toLowerCase(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "toLowerCase",
-        args = {char.class}
-    )
-    public void test_toLowerCaseC() {
-        assertEquals("Failed to change case", 't', Character.toLowerCase('T'));
-        assertEquals("Failed to change case", 't', Character.toLowerCase('t'));
-        assertEquals("Failed to change case", '1', Character.toLowerCase('1'));
-    }
-
-    /**
-     * @tests java.lang.Character#toLowerCase(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "toLowerCase",
-        args = {int.class}
-    )
-    public void test_toLowerCase_I() {
-        assertEquals('t', Character.toLowerCase((int)'T'));
-
-        assertEquals(0x10428, Character.toLowerCase(0x10400));
-        assertEquals(0x10428, Character.toLowerCase(0x10428));
-
-        assertEquals(0x1D504, Character.toLowerCase(0x1D504));
-        assertEquals(0x10FFFD, Character.toLowerCase(0x10FFFD));
-        assertEquals(0x110000, Character.toLowerCase(0x110000));
-    }
-
-    /**
-     * @tests java.lang.Character#toString()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "toString",
-        args = {}
-    )
-    public void test_toString() {
-        assertEquals("Incorrect String returned", "T", new Character('T').toString());
-        assertEquals("Incorrect String returned", "1", new Character('1').toString());
-        assertEquals("Incorrect String returned", "$", new Character('$').toString());
-    }
-
-    /**
-     * @tests java.lang.Character#toString(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "toString",
-        args = {char.class}
-    )
-    public void test_toString_char() {
-        assertEquals("Incorrect String returned", "T", Character.toString('T'));
-    }
-
-    /**
-     * @tests java.lang.Character#toTitleCase(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "toTitleCase",
-        args = {char.class}
-    )
-    public void test_toTitleCaseC() {
-        assertEquals("Incorrect title case for a",
-                'A', Character.toTitleCase('a'));
-        assertEquals("Incorrect title case for A",
-                'A', Character.toTitleCase('A'));
-        assertEquals("Incorrect title case for 1",
-                '1', Character.toTitleCase('1'));
-    }
-
-    /**
-     * @tests java.lang.Character#toTitleCase(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "toTitleCase",
-        args = {int.class}
-    )
-    public void test_toTitleCase_I() {
-        assertEquals('A', Character.toTitleCase((int)'a'));
-        assertEquals('A', Character.toTitleCase((int)'A'));
-        assertEquals('1', Character.toTitleCase((int)'1'));
-
-        assertEquals(0x10400, Character.toTitleCase(0x10428));
-        assertEquals(0x10400, Character.toTitleCase(0x10400));
-
-        assertEquals(0x10FFFF, Character.toTitleCase(0x10FFFF));
-        assertEquals(0x110000, Character.toTitleCase(0x110000));
-    }
-
-    /**
-     * @tests java.lang.Character#toUpperCase(char)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "toUpperCase",
-        args = {char.class}
-    )
-    public void test_toUpperCaseC() {
-        // Test for method char java.lang.Character.toUpperCase(char)
-        assertEquals("Incorrect upper case for a",
-                'A', Character.toUpperCase('a'));
-        assertEquals("Incorrect upper case for A",
-                'A', Character.toUpperCase('A'));
-        assertEquals("Incorrect upper case for 1",
-                '1', Character.toUpperCase('1'));
-    }
-
-    /**
-     * @tests java.lang.Character#toUpperCase(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "toUpperCase",
-        args = {int.class}
-    )
-    public void test_toUpperCase_I() {
-        assertEquals('A', Character.toUpperCase((int)'a'));
-        assertEquals('A', Character.toUpperCase((int)'A'));
-        assertEquals('1', Character.toUpperCase((int)'1'));
-
-        assertEquals(0x10400, Character.toUpperCase(0x10428));
-        assertEquals(0x10400, Character.toUpperCase(0x10400));
-
-        assertEquals(0x10FFFF, Character.toUpperCase(0x10FFFF));
-        assertEquals(0x110000, Character.toUpperCase(0x110000));
-    }
-
-    /**
-     * @tests java.lang.Character#getDirectionality(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getDirectionality",
-        args = {int.class}
-    )
-    public void test_isDirectionaliy_I(){
-        assertEquals(Character.DIRECTIONALITY_UNDEFINED, Character
-                .getDirectionality(0xFFFE));
-        assertEquals(Character.DIRECTIONALITY_UNDEFINED, Character
-                .getDirectionality(0x30000));
-        assertEquals(Character.DIRECTIONALITY_UNDEFINED, Character
-                .getDirectionality(0x110000));
-        assertEquals(Character.DIRECTIONALITY_UNDEFINED, Character
-                .getDirectionality(-1));
-
-        assertEquals(Character.DIRECTIONALITY_LEFT_TO_RIGHT, Character
-                .getDirectionality(0x0041));
-        assertEquals(Character.DIRECTIONALITY_LEFT_TO_RIGHT, Character
-                .getDirectionality(0x10000));
-        assertEquals(Character.DIRECTIONALITY_LEFT_TO_RIGHT, Character
-                .getDirectionality(0x104A9));
-
-        assertEquals(Character.DIRECTIONALITY_RIGHT_TO_LEFT, Character
-                .getDirectionality(0xFB4F));
-        assertEquals(Character.DIRECTIONALITY_RIGHT_TO_LEFT, Character
-                .getDirectionality(0x10838));
-
-        // BEGIN android-changed
-        // Unicode standard 5.1 changed category of unicode point 0x0600 from AL to AN
-        assertEquals(Character.DIRECTIONALITY_ARABIC_NUMBER, Character
-                .getDirectionality(0x0600));
-        // END android-changed
-        assertEquals(Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC, Character
-                .getDirectionality(0xFEFC));
-
-        assertEquals(Character.DIRECTIONALITY_EUROPEAN_NUMBER, Character
-                .getDirectionality(0x2070));
-        assertEquals(Character.DIRECTIONALITY_EUROPEAN_NUMBER, Character
-                .getDirectionality(0x1D7FF));
-
-        // No common char in this group on android and java.
-        // assertEquals(Character.DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR, Character
-        //         .getDirectionality(0x002B));
-        // assertEquals(Character.DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR, Character
-        //         .getDirectionality(0xFF0B));
-
-        assertEquals(Character.DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR, Character
-                .getDirectionality(0x0023));
-        assertEquals(Character.DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR, Character
-                .getDirectionality(0x17DB));
-
-        assertEquals(Character.DIRECTIONALITY_ARABIC_NUMBER, Character
-                .getDirectionality(0x0660));
-        assertEquals(Character.DIRECTIONALITY_ARABIC_NUMBER, Character
-                .getDirectionality(0x066C));
-
-        assertEquals(Character.DIRECTIONALITY_COMMON_NUMBER_SEPARATOR, Character
-                .getDirectionality(0x002C));
-        assertEquals(Character.DIRECTIONALITY_COMMON_NUMBER_SEPARATOR, Character
-                .getDirectionality(0xFF1A));
-
-        assertEquals(Character.DIRECTIONALITY_NONSPACING_MARK, Character
-                .getDirectionality(0x17CE));
-        assertEquals(Character.DIRECTIONALITY_NONSPACING_MARK, Character
-                .getDirectionality(0xE01DB));
-
-        assertEquals(Character.DIRECTIONALITY_BOUNDARY_NEUTRAL, Character
-                .getDirectionality(0x0000));
-        assertEquals(Character.DIRECTIONALITY_BOUNDARY_NEUTRAL, Character
-                .getDirectionality(0xE007F));
-
-        assertEquals(Character.DIRECTIONALITY_PARAGRAPH_SEPARATOR, Character
-                .getDirectionality(0x000A));
-        assertEquals(Character.DIRECTIONALITY_PARAGRAPH_SEPARATOR, Character
-                .getDirectionality(0x2029));
-
-        assertEquals(Character.DIRECTIONALITY_SEGMENT_SEPARATOR, Character
-                .getDirectionality(0x0009));
-        assertEquals(Character.DIRECTIONALITY_SEGMENT_SEPARATOR, Character
-                .getDirectionality(0x001F));
-
-        assertEquals(Character.DIRECTIONALITY_WHITESPACE, Character
-                .getDirectionality(0x0020));
-        assertEquals(Character.DIRECTIONALITY_WHITESPACE, Character
-                .getDirectionality(0x3000));
-
-        assertEquals(Character.DIRECTIONALITY_OTHER_NEUTRALS, Character
-                .getDirectionality(0x2FF0));
-        assertEquals(Character.DIRECTIONALITY_OTHER_NEUTRALS, Character
-                .getDirectionality(0x1D356));
-
-        assertEquals(Character.DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING, Character
-                .getDirectionality(0x202A));
-
-        assertEquals(Character.DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE, Character
-                .getDirectionality(0x202D));
-
-        assertEquals(Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING, Character
-                .getDirectionality(0x202B));
-
-        assertEquals(Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE, Character
-                .getDirectionality(0x202E));
-
-        assertEquals(Character.DIRECTIONALITY_POP_DIRECTIONAL_FORMAT, Character
-                .getDirectionality(0x202C));
-    }
-}
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/EnumTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/EnumTest.java
deleted file mode 100644
index 0c73170..0000000
--- a/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/EnumTest.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.luni.tests.java.lang;
-
-import java.util.HashMap;
-
-import junit.framework.TestCase;
-
-import org.apache.harmony.testframework.serialization.SerializationTest;
-
-import tests.util.SerializationTester;
-
-public class EnumTest extends TestCase {
-
-    enum Sample {
-        LARRY, MOE, CURLY
-    }
-
-    Sample larry = Sample.LARRY;
-
-    Sample moe = Sample.MOE;
-
-    enum Empty {
-    }
-
-    enum Bogus {
-        UNUSED
-    }
-
-    enum Color {
-        Red, Green, Blue {};
-    }
-
-    enum MockCloneEnum {
-        ONE;
-
-        public void callClone() throws CloneNotSupportedException{
-            super.clone();
-        }
-    }
-
-    /**
-     * @tests java.lang.Enum#compareTo(java.lang.Enum)
-     */
-    public void test_compareToLjava_lang_Enum() {
-        assertTrue(0 < Sample.MOE.compareTo(Sample.LARRY));
-        assertEquals(0, Sample.MOE.compareTo(Sample.MOE));
-        assertTrue(0 > Sample.MOE.compareTo(Sample.CURLY));
-        try {
-            Sample.MOE.compareTo((Sample)null);
-            fail("Should throw NullPointerException");
-        } catch (NullPointerException e) {
-            // Expected
-        }
-    }
-
-    /**
-     * @tests java.lang.Enum#equals(Object)
-     */
-    public void test_equalsLjava_lang_Object() {
-        assertFalse(moe.equals("bob"));
-        assertTrue(moe.equals(Sample.MOE));
-        assertFalse(Sample.LARRY.equals(Sample.CURLY));
-        assertTrue(Sample.LARRY.equals(larry));
-        assertFalse(Sample.CURLY.equals(null));
-    }
-
-    /**
-     * @tests java.lang.Enum#getDeclaringClass()
-     */
-    public void test_getDeclaringClass() {
-        assertEquals(Sample.class, moe.getDeclaringClass());
-    }
-
-    /**
-     * @tests java.lang.Enum#hashCode()
-     */
-    public void test_hashCode() {
-        assertEquals (moe.hashCode(), moe.hashCode());
-    }
-
-    /**
-     * @tests java.lang.Enum#name()
-     */
-    public void test_name() {
-        assertEquals("MOE", moe.name());
-    }
-
-    /**
-     * @tests java.lang.Enum#ordinal()
-     */
-    public void test_ordinal() {
-        assertEquals(0, larry.ordinal());
-        assertEquals(1, moe.ordinal());
-        assertEquals(2, Sample.CURLY.ordinal());
-    }
-
-    /**
-     * @tests java.lang.Enum#toString()
-     */
-    public void test_toString() {
-        assertTrue(moe.toString().equals("MOE"));
-    }
-
-    /**
-     * @tests java.lang.Enum#valueOf(Class, String)
-     */
-    public void test_valueOfLjava_lang_String() {
-        assertSame(Sample.CURLY, Sample.valueOf("CURLY"));
-        assertSame(Sample.LARRY, Sample.valueOf("LARRY"));
-        assertSame(moe, Sample.valueOf("MOE"));
-        try {
-            Sample.valueOf("non-existant");
-            fail("Expected an exception");
-        } catch (IllegalArgumentException e){
-            // Expected
-        }
-        try {
-            Sample.valueOf(null);
-            fail("Should throw NullPointerException");
-        } catch (NullPointerException e) {
-            // May be caused by some compilers' code
-        } catch (IllegalArgumentException e) {
-            // other compilers will throw this
-        }
-
-
-        Sample s = Enum.valueOf(Sample.class, "CURLY");
-        assertSame(s, Sample.CURLY);
-        s = Enum.valueOf(Sample.class, "LARRY");
-        assertSame(larry, s);
-        s = Enum.valueOf(Sample.class, "MOE");
-        assertSame(s, moe);
-        try {
-            Enum.valueOf(Bogus.class, "MOE");
-            fail("Expected IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
-            // Expected
-        }
-        try {
-            Enum.valueOf((Class<Sample>)null, "a string");
-            fail("Expected an exception");
-        } catch (NullPointerException e) {
-            // May be caused by some compilers' code
-        } catch (IllegalArgumentException e) {
-            // other compilers will throw this
-        }
-        try {
-            Enum.valueOf(Sample.class, null);
-            fail("Expected an exception");
-        } catch (NullPointerException e) {
-            // May be caused by some compilers' code
-        } catch (IllegalArgumentException e) {
-            // other compilers will throw this
-        }
-        try {
-            Enum.valueOf((Class<Sample>)null, (String)null);
-            fail("Expected an exception");
-        } catch (NullPointerException e) {
-            // May be caused by some compilers' code
-        } catch (IllegalArgumentException e) {
-            // other compilers will throw this
-        }
-    }
-
-    /**
-     * @tests java.lang.Enum#values
-     */
-    public void test_values() {
-        Sample[] myValues = Sample.values();
-        assertEquals(3, myValues.length);
-
-        assertEquals(Sample.LARRY, myValues[0]);
-        assertEquals(Sample.MOE, myValues[1]);
-        assertEquals(Sample.CURLY, myValues[2]);
-
-        assertEquals(0, Empty.values().length);
-    }
-
-    /**
-     * @tests java.lang.Enum#clone()
-     */
-    public void test_clone() {
-        try {
-            MockCloneEnum.ONE.callClone();
-            fail("Should throw CloneNotSupprotedException");
-        } catch (CloneNotSupportedException e1) {
-            // expected
-        }
-
-    }
-
-    /**
-     * @test Serialization/deserilazation compatibility with Harmony.
-     */
-    public void test_compatibilitySerialization_inClass_Complex_Harmony() throws Exception{
-        // TODO migrate to the new testing framework
-        assertTrue(SerializationTester.assertCompabilityEquals(new MockEnum2(),
-            "serialization/org/apache/harmony/luni/tests/java/lang/EnumTest.harmony.ser"));
-    }
-
-    /**
-     * @tests serialization/deserialization compatibility.
-     */
-    public void testSerializationSelf() throws Exception {
-
-        // test a map class that has enums.
-        // regression test for Harmony-1163
-        HashMap<Color, Integer> enumColorMap = new HashMap<Color, Integer>();
-        enumColorMap.put(Color.Red, 1);
-        enumColorMap.put(Color.Blue, 3);
-
-        Object[] testCases = { enumColorMap, Sample.CURLY };
-
-        SerializationTest.verifySelf(testCases);
-
-        // test a class that has enums as its fields.
-        MockEnum mock = new MockEnum();
-        MockEnum test = (MockEnum) SerializationTest.copySerializable(mock);
-        assertEquals(mock.i, test.i);
-        assertEquals(mock.str, test.str);
-        assertEquals(mock.samEnum, test.samEnum);
-
-        // test a class that has enums and a string of same name as its fields.
-        MockEnum2 mock2 = new MockEnum2();
-        MockEnum2 test2 = (MockEnum2) SerializationTest.copySerializable(mock2);
-        assertEquals(mock2.i, test2.i);
-        assertEquals(mock2.str, test2.str);
-        assertEquals(mock2.samEnum, test2.samEnum);
-    }
-
-    /**
-     * @tests serialization/deserialization compatibility with RI.
-     */
-    public void testSerializationCompatibility() throws Exception {
-
-        // regression test for Harmony-1163
-        HashMap<Color, Integer> enumColorMap = new HashMap<Color, Integer>();
-        enumColorMap.put(Color.Red, 1);
-        enumColorMap.put(Color.Blue, 3);
-
-        Object[] testCases = { Sample.CURLY, new MockEnum(),
-        // test a class that has enums and a string of same name as its fields.
-                new MockEnum2(),
-                // test a map class that has enums.
-                enumColorMap, };
-
-        SerializationTest.verifyGolden(this, testCases);
-    }
-}
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/OldCharacterTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/OldCharacterTest.java
new file mode 100644
index 0000000..73e0405
--- /dev/null
+++ b/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/OldCharacterTest.java
@@ -0,0 +1,153 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.luni.tests.java.lang;
+
+import junit.framework.TestCase;
+
+public class OldCharacterTest extends TestCase {
+
+
+    public void test_codePointCountLjava_lang_CharArrayII() {
+
+      assertEquals(1, Character.codePointCount("\uD800\uDC00".toCharArray(),
+                                               0, 2));
+      assertEquals(3, Character.codePointCount("a\uD800\uDC00b".toCharArray(),
+                                               0, 4));
+      assertEquals(4, Character.codePointCount("a\uD800\uDC00b\uD800".toCharArray(),
+                                               0, 5));
+      assertEquals(4, Character.codePointCount("ab\uD800\uDC00b\uD800".toCharArray(),
+                                                1, 5));
+
+      try {
+          Character.codePointCount((char[]) null, 0, 1);
+          fail("No NPE, null char sequence.");
+      } catch (NullPointerException e) {
+      }
+
+      try {
+          Character.codePointCount("abc".toCharArray(), -1, 1);
+          fail("No IOOBE, negative start.");
+      } catch (IndexOutOfBoundsException e) {
+      }
+
+      try {
+          Character.codePointCount("abc".toCharArray(), 0, 4);
+          fail("No IOOBE, end greater than length.");
+      } catch (IndexOutOfBoundsException e) {
+      }
+
+      try {
+          Character.codePointCount("abc".toCharArray(), 1, 3);
+          fail("No IOOBE, end greater than start.");
+      } catch (IndexOutOfBoundsException e) {
+      }
+    }
+
+    public void test_getDirectionality() throws Exception {
+
+        byte[] directionalities = {
+                // BEGIN android-changed
+                // Unicode 5.1 defines U+0370 to be Greek capital letter Heta.
+                Character.DIRECTIONALITY_LEFT_TO_RIGHT,
+                // END android-changed.
+
+                Character.DIRECTIONALITY_LEFT_TO_RIGHT,
+                Character.DIRECTIONALITY_RIGHT_TO_LEFT,
+
+                // BEGIN android-changed
+                // Unicode standard 5.1 changed category of unicode point 0x0600 from AL to AN
+                Character.DIRECTIONALITY_ARABIC_NUMBER,
+                // END android-changed.
+
+                Character.DIRECTIONALITY_EUROPEAN_NUMBER,
+                // Character.DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR,
+                Character.DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR,
+                Character.DIRECTIONALITY_ARABIC_NUMBER,
+                Character.DIRECTIONALITY_COMMON_NUMBER_SEPARATOR,
+                Character.DIRECTIONALITY_NONSPACING_MARK,
+                Character.DIRECTIONALITY_BOUNDARY_NEUTRAL,
+                Character.DIRECTIONALITY_PARAGRAPH_SEPARATOR,
+                Character.DIRECTIONALITY_SEGMENT_SEPARATOR,
+                Character.DIRECTIONALITY_WHITESPACE,
+                Character.DIRECTIONALITY_OTHER_NEUTRALS,
+                Character.DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING,
+                Character.DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE,
+                Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING,
+                Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE,
+                Character.DIRECTIONALITY_POP_DIRECTIONAL_FORMAT
+                };
+
+        char[] characters = {
+                // BEGIN android-changed
+                // Unicode 5.1 defines U+0370 to be Greek capital letter Heta.
+                '\u0370', // 1
+                // END android-changed
+                '\u00B5', // 0
+                '\u05BE', // 1
+                // BEGIN android-changed
+                '\u0600', // 6
+                // END android-changed
+                '\u00B2', // 3
+                // '', // No common char in this group on android and java.
+                '\u00B1', // 5
+                '\u0660', // 6
+                '\u00A0', // 7
+                '\u0300', // 8
+                '\u009F', // 9
+                '\u0085', // 10
+                '\u001F', // 11
+                '\u0020', // 12
+                '\u00AB', // 13
+                '\u202A', // 14
+                '\u202D', // 15
+                '\u202B', // 16
+                '\u202E', // 17
+                '\u202C' // 18
+                };
+
+        for(int i = 0; i < directionalities.length; i++) {
+            assertEquals(directionalities[i],
+                    Character.getDirectionality(characters[i]));
+        }
+
+
+    }
+
+    public void test_digitCI() {
+        assertEquals(-1, Character.digit('\uFFFF', 1));
+    }
+
+    public void test_isUpperCaseC() {
+        assertFalse("Incorrect case value", Character.isUpperCase('1'));
+        assertFalse("Incorrect case value", Character.isUpperCase('?'));
+    }
+
+    public void test_toLowerCaseC() {
+        assertEquals("Failed to change case", 't', Character.toLowerCase('t'));
+        assertEquals("Failed to change case", '1', Character.toLowerCase('1'));
+    }
+
+    public void test_toString() {
+        assertEquals("Incorrect String returned", "T", new Character('T').toString());
+        assertEquals("Incorrect String returned", "1", new Character('1').toString());
+        assertEquals("Incorrect String returned", "$", new Character('$').toString());
+    }
+
+    public void test_toString_char() {
+        assertEquals("Incorrect String returned", "T", Character.toString('T'));
+    }
+}
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/PackageTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/PackageTest.java
deleted file mode 100644
index 865b839..0000000
--- a/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/PackageTest.java
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.harmony.luni.tests.java.lang;
-
-import java.io.File;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLClassLoader;
-
-import tests.support.resource.Support_Resources;
-
-public class PackageTest extends junit.framework.TestCase {
-
-    private File resources;
-
-    private String resPath;
-
-    Package getTestPackage(String resourceJar, String className)
-            throws Exception {
-        Support_Resources.copyFile(resources, "Package", resourceJar);
-        URL resourceURL = new URL("file:/" + resPath + "/Package/"
-                + resourceJar);
-
-        URLClassLoader ucl = new URLClassLoader(new URL[] { resourceURL }, null);
-        return Class.forName(className, true, ucl).getPackage();
-    }
-
-    @Override
-    protected void setUp() {
-        resources = Support_Resources.createTempFolder();
-        resPath = resources.toString();
-        if (resPath.charAt(0) == '/' || resPath.charAt(0) == '\\')
-            resPath = resPath.substring(1);
-    }
-
-    /**
-     * There is a newer version of this class with some actual tests but since
-     * the class is not implemented they all fail. For now use the stub test
-     * methods.
-     */
-
-    /**
-     * @tests java.lang.Package#getImplementationVendor()
-     * @tests java.lang.Package#getImplementationVersion()
-     * @tests java.lang.Package#getSpecificationTitle()
-     * @tests java.lang.Package#getSpecificationVendor()
-     * @tests java.lang.Package#getSpecificationVersion()
-     * @tests java.lang.Package#getImplementationTitle()
-     */
-    public void test_helper_Attributes() throws Exception {
-
-        Package p = getTestPackage("hyts_all_attributes.jar", "p.C");
-        assertEquals(
-                "Package getImplementationTitle returns a wrong string (1)",
-                "p Implementation-Title", p.getImplementationTitle());
-        assertEquals(
-                "Package getImplementationVendor returns a wrong string (1)",
-                "p Implementation-Vendor", p.getImplementationVendor());
-        assertEquals(
-                "Package getImplementationVersion returns a wrong string (1)",
-                "2.2.2", p.getImplementationVersion());
-        assertEquals(
-                "Package getSpecificationTitle returns a wrong string (1)",
-                "p Specification-Title", p.getSpecificationTitle());
-        assertEquals(
-                "Package getSpecificationVendor returns a wrong string (1)",
-                "p Specification-Vendor", p.getSpecificationVendor());
-        assertEquals(
-                "Package getSpecificationVersion returns a wrong string (1)",
-                "2.2.2", p.getSpecificationVersion());
-
-        // No entry for the package
-        Package p2 = getTestPackage("hyts_no_entry.jar", "p.C");
-        assertEquals(
-                "Package getImplementationTitle returns a wrong string (2)",
-                "MF Implementation-Title", p2.getImplementationTitle());
-        assertEquals(
-                "Package getImplementationVendor returns a wrong string (2)",
-                "MF Implementation-Vendor", p2.getImplementationVendor());
-        assertEquals(
-                "Package getImplementationVersion returns a wrong string (2)",
-                "5.3.b1", p2.getImplementationVersion());
-        assertEquals(
-                "Package getSpecificationTitle returns a wrong string (2)",
-                "MF Specification-Title", p2.getSpecificationTitle());
-        assertEquals(
-                "Package getSpecificationVendor returns a wrong string (2)",
-                "MF Specification-Vendor", p2.getSpecificationVendor());
-        assertEquals(
-                "Package getSpecificationVersion returns a wrong string (2)",
-                "1.2.3", p2.getSpecificationVersion());
-
-        // No attributes in the package entry
-        Package p3 = getTestPackage("hyts_no_attributes.jar", "p.C");
-        assertEquals(
-                "Package getImplementationTitle returns a wrong string (3)",
-                "MF Implementation-Title", p3.getImplementationTitle());
-        assertEquals(
-                "Package getImplementationVendor returns a wrong string (3)",
-                "MF Implementation-Vendor", p3.getImplementationVendor());
-        assertEquals(
-                "Package getImplementationVersion returns a wrong string (3)",
-                "5.3.b1", p3.getImplementationVersion());
-        assertEquals(
-                "Package getSpecificationTitle returns a wrong string (3)",
-                "MF Specification-Title", p3.getSpecificationTitle());
-        assertEquals(
-                "Package getSpecificationVendor returns a wrong string (3)",
-                "MF Specification-Vendor", p3.getSpecificationVendor());
-        assertEquals(
-                "Package getSpecificationVersion returns a wrong string (3)",
-                "1.2.3", p3.getSpecificationVersion());
-
-        // Some attributes in the package entry
-        Package p4 = getTestPackage("hyts_some_attributes.jar", "p.C");
-        assertEquals(
-                "Package getImplementationTitle returns a wrong string (4)",
-                "p Implementation-Title", p4.getImplementationTitle());
-        assertEquals(
-                "Package getImplementationVendor returns a wrong string (4)",
-                "MF Implementation-Vendor", p4.getImplementationVendor());
-        assertEquals(
-                "Package getImplementationVersion returns a wrong string (4)",
-                "2.2.2", p4.getImplementationVersion());
-        assertEquals(
-                "Package getSpecificationTitle returns a wrong string (4)",
-                "MF Specification-Title", p4.getSpecificationTitle());
-        assertEquals(
-                "Package getSpecificationVendor returns a wrong string (4)",
-                "p Specification-Vendor", p4.getSpecificationVendor());
-        assertEquals(
-                "Package getSpecificationVersion returns a wrong string (4)",
-                "2.2.2", p4.getSpecificationVersion());
-
-        // subdirectory Package
-        Package p5 = getTestPackage("hyts_pq.jar", "p.q.C");
-        assertEquals(
-                "Package getImplementationTitle returns a wrong string (5)",
-                "p Implementation-Title", p5.getImplementationTitle());
-        assertEquals(
-                "Package getImplementationVendor returns a wrong string (5)",
-                "p Implementation-Vendor", p5.getImplementationVendor());
-        assertEquals(
-                "Package getImplementationVersion returns a wrong string (5)",
-                "1.1.3", p5.getImplementationVersion());
-        assertEquals(
-                "Package getSpecificationTitle returns a wrong string (5)",
-                "p Specification-Title", p5.getSpecificationTitle());
-        assertEquals(
-                "Package getSpecificationVendor returns a wrong string (5)",
-                "p Specification-Vendor", p5.getSpecificationVendor());
-        assertEquals(
-                "Package getSpecificationVersion returns a wrong string (5)",
-                "2.2.0.0.0.0.0.0.0.0.0", p5.getSpecificationVersion());
-    }
-
-    /**
-     * @tests java.lang.Package#getName()
-     */
-    public void test_getName() throws Exception {
-        Package p = getTestPackage("hyts_pq.jar", "p.q.C");
-        assertEquals("Package getName returns a wrong string", "p.q", p
-                .getName());
-    }
-
-    /**
-     * @tests java.lang.Package#getPackage(java.lang.String)
-     */
-    public void test_getPackageLjava_lang_String() {
-        assertSame("Package getPackage failed for java.lang", Package
-                .getPackage("java.lang"), Package.getPackage("java.lang"));
-
-        assertSame("Package getPackage failed for java.lang", Package
-                .getPackage("java.lang"), Object.class.getPackage());
-    }
-
-    /**
-     * @tests java.lang.Package#getPackages()
-     */
-    public void test_getPackages() throws Exception {
-        Package[] pckgs = Package.getPackages();
-        boolean found = false;
-        for (int i = 0; i < pckgs.length; i++) {
-            if (pckgs[i].getName().equals("java.util")) {
-                found = true;
-                break;
-            }
-        }
-        assertTrue("Package getPackages failed to retrieve a package", found);
-    }
-
-    /**
-     * @tests java.lang.Package#hashCode()
-     */
-    public void test_hashCode() {
-        Package p1 = Package.getPackage("java.lang");
-        if (p1 != null) {
-            assertEquals(p1.hashCode(), "java.lang".hashCode());
-        }
-    }
-
-    /**
-     * @tests java.lang.Package#isCompatibleWith(java.lang.String)
-     */
-    public void test_isCompatibleWithLjava_lang_String() throws Exception {
-        Package p = getTestPackage("hyts_c.jar", "p.C");
-
-        assertTrue("Package isCompatibleWith fails with lower version", p
-                .isCompatibleWith("2.1.9.9"));
-        assertTrue("Package isCompatibleWith fails with same version (1)", p
-                .isCompatibleWith("2.2.0"));
-        assertTrue("Package isCompatibleWith fails with same version (2)", p
-                .isCompatibleWith("2.2"));
-        assertFalse("Package isCompatibleWith fails with higher version", p
-                .isCompatibleWith("2.2.0.0.1"));
-        try {
-            p.isCompatibleWith(null);
-            fail("Null version is illegal");
-        } catch (NumberFormatException ok) {
-        } catch (NullPointerException compatible) {
-            /*
-             * RI throws NPE instead of NFE...
-             */
-        }
-
-        try {
-            p.isCompatibleWith("");
-            fail("Empty version is illegal");
-        } catch (NumberFormatException ok) {}
-        try {
-            p.isCompatibleWith(".");
-            fail("'.' version is illegal");
-        } catch (NumberFormatException ok) {}
-        try {
-            p.isCompatibleWith("1.2.");
-            fail("'1.2.' version is illegal");
-        } catch (NumberFormatException ok) {}
-        try {
-            p.isCompatibleWith(".9");
-            fail("'.9' version is illegal");
-        } catch (NumberFormatException ok) {}
-        try {
-            p.isCompatibleWith("2.4..5");
-            fail("'2.4..5' version is illegal");
-        } catch (NumberFormatException ok) {}
-        try {
-            p.isCompatibleWith("20.-4");
-            fail("'20.-4' version is illegal");
-        } catch (NumberFormatException ok) {}
-    }
-
-    /**
-     * @tests java.lang.Package#isSealed()
-     */
-    public void test_isSealed() throws Exception {
-        Package p = getTestPackage("hyts_pq.jar", "p.q.C");
-        assertTrue("Package isSealed returns wrong boolean", p.isSealed());
-    }
-
-    /**
-     * @tests java.lang.Package#isSealed(java.net.URL)
-     */
-    public void test_isSealedLjava_net_URL() throws Exception {
-        Package p = getTestPackage("hyts_c.jar", "p.C");
-        assertFalse("Package isSealed returns wrong boolean (1)", p
-                .isSealed(new URL("file:/" + resPath + "/")));
-        assertTrue("Package isSealed returns wrong boolean (2)", p
-                .isSealed(new URL("file:/" + resPath + "/Package/hyts_c.jar")));
-    }
-
-    /**
-     * @tests java.lang.Package#toString()
-     */
-    public void test_toString() throws Exception {
-        Package p = getTestPackage("hyts_c.jar", "p.C");
-        assertTrue("Package toString returns wrong string", p.toString()
-                .length() > 0);
-    }
-
-    public void test_SealedPackage_forName() throws Exception {
-        Support_Resources.copyFile(resources, "Package", "hyts_c.jar");
-        Support_Resources.copyFile(resources, "Package", "hyts_d.jar");
-        Support_Resources.copyFile(resources, "Package", "hyts_d1.jar");
-        Support_Resources.copyFile(resources, "Package", "hyts_d2.jar");
-
-        URL resourceURL1 = new URL("file:/" + resPath + "/Package/hyts_c.jar");
-        URL resourceURL2 = new URL("file:/" + resPath + "/Package/hyts_d.jar");
-        URL resourceURL3 = new URL("file:/" + resPath + "/Package/hyts_d1.jar");
-        URL resourceURL4 = new URL("file:/" + resPath + "/Package/hyts_d2.jar");
-        URL resourceURL5 = new URL("file:/" + resPath + "/");
-
-        URLClassLoader uclClassLoader;
-        // load from the sealed jar, then an unsealed jar with no manifest
-        uclClassLoader = new java.net.URLClassLoader(new URL[] { resourceURL1,
-                resourceURL2 }, null);
-        Class.forName("p.C", true, uclClassLoader);
-        try {
-            Class.forName("p.D", true, uclClassLoader);
-            fail("should throw SecurityException");
-        } catch (SecurityException e) {
-            // Expected
-        }
-
-        // setup for next test
-        Support_Resources.copyFile(resources, "p", "");
-        InputStream in = uclClassLoader.getResourceAsStream("p/D.class");
-        Support_Resources.copyLocalFileto(new File(resources.toString(),
-                "p/D.class"), in);
-
-        // load from a sealed jar, then the directory
-        uclClassLoader = new java.net.URLClassLoader(new URL[] { resourceURL1,
-                resourceURL5 }, null);
-        Class.forName("p.C", true, uclClassLoader);
-        try {
-            Class.forName("p.D", true, uclClassLoader);
-            fail("should throw SecurityException");
-        } catch (SecurityException e) {
-            // Expected
-        }
-
-        // load from a directory, then the sealed jar
-        uclClassLoader = new java.net.URLClassLoader(new URL[] { resourceURL1,
-                resourceURL5 }, null);
-        Class.forName("p.D", true, uclClassLoader);
-        try {
-            Class.forName("p.C", true, uclClassLoader);
-            fail("should throw SecurityException");
-        } catch (SecurityException e) {
-            // Expected
-        }
-
-        // load from an unsealed jar with no manifest, then the sealed jar
-        uclClassLoader = new java.net.URLClassLoader(new URL[] { resourceURL1,
-                resourceURL2 }, null);
-        Class.forName("p.D", true, uclClassLoader);
-        try {
-            Class.forName("p.C", true, uclClassLoader);
-            fail("should throw SecurityException");
-        } catch (SecurityException e) {
-            // Expected
-        }
-
-        // load from an unsealed jar with a manifest, then the sealed jar
-        uclClassLoader = new java.net.URLClassLoader(new URL[] { resourceURL1,
-                resourceURL3 }, null);
-        Class.forName("p.C", true, uclClassLoader);
-        try {
-            Class.forName("p.D", true, uclClassLoader);
-            fail("should throw SecurityException");
-        } catch (SecurityException e) {
-            // Expected
-        }
-
-        // load from an sealed jar, then the unsealed jar with a manifest
-        uclClassLoader = new java.net.URLClassLoader(new URL[] { resourceURL1,
-                resourceURL3 }, null);
-        Class.forName("p.D", true, uclClassLoader);
-        try {
-            Class.forName("p.C", true, uclClassLoader);
-            fail("should throw SecurityException");
-        } catch (SecurityException e) {
-            // Expected
-        }
-
-        // load from the sealed jar, then another sealed jar
-        uclClassLoader = new java.net.URLClassLoader(new URL[] { resourceURL1,
-                resourceURL4 }, null);
-        Class.forName("p.C", true, uclClassLoader);
-        try {
-            Class.forName("p.D", true, uclClassLoader);
-            fail("should throw SecurityException");
-        } catch (SecurityException e) {
-            // Expected
-        }
-    }
-}
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/net/AllTests.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/net/AllTests.java
index 0a71ca6..ba4f63a 100644
--- a/luni/src/test/java/org/apache/harmony/luni/tests/java/net/AllTests.java
+++ b/luni/src/test/java/org/apache/harmony/luni/tests/java/net/AllTests.java
@@ -29,7 +29,7 @@
         TestRunner.main(new String[] { AllTests.class.getName() });
     }
 
-    public static final Test suite() {
+    public static Test suite() {
         TestSuite suite = new TestSuite("Tests for java.net");
 
         // add net testsuites here
@@ -44,7 +44,6 @@
         suite.addTestSuite(URITest.class);
         suite.addTestSuite(URLConnectionTest.class);
         suite.addTestSuite(URLEncoderTest.class);
-        suite.addTestSuite(URLTest.class);
 
         return suite;
     }
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/util/AllTests.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/util/AllTests.java
index 88c4fad..9966809 100644
--- a/luni/src/test/java/org/apache/harmony/luni/tests/java/util/AllTests.java
+++ b/luni/src/test/java/org/apache/harmony/luni/tests/java/util/AllTests.java
@@ -38,14 +38,12 @@
         suite.addTestSuite(ArraysTest.class);
         suite.addTestSuite(BitSetTest.class);
         suite.addTestSuite(CollectionsTest.class);
-        suite.addTestSuite(DateTest.class);
         suite.addTestSuite(DictionaryTest.class);
         suite.addTestSuite(DuplicateFormatFlagsExceptionTest.class);
         suite.addTestSuite(EventListenerProxyTest.class);
         suite.addTestSuite(FormatFlagsConversionMismatchExceptionTest.class);
         suite.addTestSuite(FormattableTest.class);
         suite.addTestSuite(FormatterClosedExceptionTest.class);
-        suite.addTestSuite(FormatterTest.class);
         suite.addTestSuite(HashMapTest.class);
         suite.addTestSuite(IdentityHashMapTest.class);
         suite.addTestSuite(IllegalFormatCodePointExceptionTest.class);
@@ -57,12 +55,10 @@
         suite.addTestSuite(InvalidPropertiesFormatExceptionTest.class);
         suite.addTestSuite(LinkedHashMapTest.class);
         suite.addTestSuite(ListIteratorTest.class);
-        suite.addTestSuite(LocaleTest.class);
         suite.addTestSuite(MapEntryTest.class);
         suite.addTestSuite(MissingFormatArgumentExceptionTest.class);
         suite.addTestSuite(MissingFormatWidthExceptionTest.class);
         suite.addTestSuite(ObserverTest.class);
-        suite.addTestSuite(UnknownFormatConversionExceptionTest.class);
         suite.addTestSuite(UnknownFormatFlagsExceptionTest.class);
         suite.addTestSuite(UUIDTest.class);
         suite.addTestSuite(VectorTest.class);
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/util/DateTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/util/DateTest.java
deleted file mode 100644
index a2139ee..0000000
--- a/luni/src/test/java/org/apache/harmony/luni/tests/java/util/DateTest.java
+++ /dev/null
@@ -1,505 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.harmony.luni.tests.java.util;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.TimeZone;
-
-public class DateTest extends junit.framework.TestCase {
-
-    static class MockDate extends Date{
-        private String holiday;
-
-        public MockDate(long theTime) {
-            super(theTime);
-            holiday = "Christmas";
-        }
-
-        // Constructor should not call this public API,
-        // since it may be overrided to use variables uninitialized.
-        public void setTime(long theTime){
-            super.setTime(theTime);
-            holiday.hashCode();
-        }
-    }
-
-	/**
-	 * @tests java.util.Date#Date()
-	 */
-	public void test_Constructor() {
-		// Test for method java.util.Date()
-		GregorianCalendar gc = new GregorianCalendar(1998, Calendar.OCTOBER,
-				13, 19, 9);
-		long oldTime = gc.getTime().getTime();
-		long now = new Date().getTime();
-		assertTrue("Created incorrect date: " + oldTime + " now: " + now,
-				oldTime < now);
-	}
-
-	/**
-	 * @tests java.util.Date#Date(int, int, int)
-	 */
-	public void test_ConstructorIII() {
-		// Test for method java.util.Date(int, int, int)
-		Date d1 = new Date(70, 0, 1); // the epoch + local time
-		
-		// the epoch + local time
-		Date d2 = new Date(0 + d1.getTimezoneOffset() * 60 * 1000);
-		
-		assertTrue("Created incorrect date", d1.equals(d2));
-
-		Date date = new Date(99, 5, 22);
-		Calendar cal = new GregorianCalendar(1999, Calendar.JUNE, 22);
-		assertTrue("Wrong time zone", date.equals(cal.getTime()));
-	}
-
-	/**
-	 * @tests java.util.Date#Date(int, int, int, int, int)
-	 */
-	public void test_ConstructorIIIII() {
-		// Test for method java.util.Date(int, int, int, int, int)
-		
-		// the epoch + local time + (1 hour and 1 minute)
-		Date d1 = new Date(70, 0, 1, 1, 1);
-
-		// the epoch + local time + (1 hour and 1 minute)
-		Date d2 = new Date(0 + d1.getTimezoneOffset() * 60 * 1000 + 60 * 60
-				* 1000 + 60 * 1000);
-
-		assertTrue("Created incorrect date", d1.equals(d2));
-	}
-
-	/**
-	 * @tests java.util.Date#Date(int, int, int, int, int, int)
-	 */
-	public void test_ConstructorIIIIII() {
-		// Test for method java.util.Date(int, int, int, int, int, int)
-		
-		// the epoch + local time + (1 hour and 1 minute + 1 second)
-		Date d1 = new Date(70, 0, 1, 1, 1, 1);
-		
-		// the epoch + local time + (1 hour and 1 minute + 1 second)
-		Date d2 = new Date(0 + d1.getTimezoneOffset() * 60 * 1000 + 60 * 60
-				* 1000 + 60 * 1000 + 1000);
-		
-		assertTrue("Created incorrect date", d1.equals(d2));
-	}
-
-	/**
-	 * @tests java.util.Date#Date(long)
-	 */
-	public void test_ConstructorJ() {
-		// Test for method java.util.Date(long)
-        Date date = new MockDate(1000L);
-        assertNotNull(date);
-	}
-
-	/**
-	 * @tests java.util.Date#Date(java.lang.String)
-	 */
-	public void test_ConstructorLjava_lang_String() {
-		// Test for method java.util.Date(java.lang.String)
-		Date d1 = new Date("January 1, 1970, 00:00:00 GMT"); // the epoch
-		Date d2 = new Date(0); // the epoch
-		assertTrue("Created incorrect date", d1.equals(d2));
-
-		try {
-			// Regression for HARMONY-238
-			new Date(null);
-			fail("Constructor Date((String)null) should "
-				+ "throw IllegalArgumentException");
-		} catch (IllegalArgumentException e) {
-			// expected
-		}
-	}
-
-	/**
-	 * @tests java.util.Date#after(java.util.Date)
-	 */
-	public void test_afterLjava_util_Date() {
-		// Test for method boolean java.util.Date.after(java.util.Date)
-		Date d1 = new Date(0);
-		Date d2 = new Date(1900000);
-		assertTrue("Older was returned as newer", d2.after(d1));
-		assertTrue("Newer was returned as older", !d1.after(d2));
-	}
-
-	/**
-	 * @tests java.util.Date#before(java.util.Date)
-	 */
-	public void test_beforeLjava_util_Date() {
-		// Test for method boolean java.util.Date.before(java.util.Date)
-		Date d1 = new Date(0);
-		Date d2 = new Date(1900000);
-		assertTrue("Older was returned as newer", !d2.before(d1));
-		assertTrue("Newer was returned as older", d1.before(d2));
-	}
-
-	/**
-	 * @tests java.util.Date#clone()
-	 */
-	public void test_clone() {
-		// Test for method java.lang.Object java.util.Date.clone()
-		Date d1 = new Date(100000);
-		Date d2 = (Date) d1.clone();
-		assertTrue(
-				"Cloning date results in same reference--new date is equivalent",
-				d1 != d2);
-		assertTrue("Cloning date results unequal date", d1.equals(d2));
-	}
-
-	/**
-	 * @tests java.util.Date#compareTo(java.util.Date)
-	 */
-	public void test_compareToLjava_util_Date() {
-		// Test for method int java.util.Date.compareTo(java.util.Date)
-		final int someNumber = 10000;
-		Date d1 = new Date(someNumber);
-		Date d2 = new Date(someNumber);
-		Date d3 = new Date(someNumber + 1);
-		Date d4 = new Date(someNumber - 1);
-		assertEquals("Comparing a date to itself did not answer zero", 0, d1
-				.compareTo(d1));
-		assertEquals("Comparing equal dates did not answer zero", 0, d1
-				.compareTo(d2));
-		assertEquals("date1.compareTo(date2), where date1 > date2, did not result in 1",
-				1, d1.compareTo(d4));
-		assertEquals("date1.compareTo(date2), where date1 < date2, did not result in -1",
-				-1, d1.compareTo(d3));
-
-	}
-
-	/**
-	 * @tests java.util.Date#equals(java.lang.Object)
-	 */
-	public void test_equalsLjava_lang_Object() {
-		// Test for method boolean java.util.Date.equals(java.lang.Object)
-		Date d1 = new Date(0);
-		Date d2 = new Date(1900000);
-		Date d3 = new Date(1900000);
-		assertTrue("Equality test failed", d2.equals(d3));
-		assertTrue("Equality test failed", !d1.equals(d2));
-	}
-
-	/**
-	 * @tests java.util.Date#getDate()
-	 */
-	public void test_getDate() {
-		// Test for method int java.util.Date.getDate()
-		Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9)
-				.getTime();
-		assertEquals("Returned incorrect date", 13, d.getDate());
-	}
-
-	/**
-	 * @tests java.util.Date#getDay()
-	 */
-	public void test_getDay() {
-		// Test for method int java.util.Date.getDay()
-		Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9)
-				.getTime();
-		assertEquals("Returned incorrect day", 2, d.getDay());
-	}
-
-	/**
-	 * @tests java.util.Date#getHours()
-	 */
-	public void test_getHours() {
-		// Test for method int java.util.Date.getHours()
-		Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9)
-				.getTime();
-		assertEquals("Returned incorrect hours", 19, d.getHours());
-	}
-
-	/**
-	 * @tests java.util.Date#getMinutes()
-	 */
-	public void test_getMinutes() {
-		// Test for method int java.util.Date.getMinutes()
-		Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9)
-				.getTime();
-		assertEquals("Returned incorrect minutes", 9, d.getMinutes());
-	}
-
-	/**
-	 * @tests java.util.Date#getMonth()
-	 */
-	public void test_getMonth() {
-		// Test for method int java.util.Date.getMonth()
-		Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9)
-				.getTime();
-		assertEquals("Returned incorrect month", 9, d.getMonth());
-	}
-
-	/**
-	 * @tests java.util.Date#getSeconds()
-	 */
-	public void test_getSeconds() {
-		// Test for method int java.util.Date.getSeconds()
-		Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9)
-				.getTime();
-		assertEquals("Returned incorrect seconds", 0, d.getSeconds());
-	}
-
-	/**
-	 * @tests java.util.Date#getTime()
-	 */
-	public void test_getTime() {
-		// Test for method long java.util.Date.getTime()
-		Date d1 = new Date(0);
-		Date d2 = new Date(1900000);
-		assertEquals("Returned incorrect time", 1900000, d2.getTime());
-		assertEquals("Returned incorrect time", 0, d1.getTime());
-	}
-
-	/**
-	 * @tests java.util.Date#getTimezoneOffset()
-	 */
-	public void test_getTimezoneOffset() {
-		// Test for method int java.util.Date.getTimezoneOffset()
-		assertTrue("Used to test", true);
-	}
-
-	/**
-	 * @tests java.util.Date#getYear()
-	 */
-	public void test_getYear() {
-		// Test for method int java.util.Date.getYear()
-		Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9)
-				.getTime();
-		assertEquals("Returned incorrect year", 98, d.getYear());
-	}
-
-	/**
-	 * @tests java.util.Date#hashCode()
-	 */
-	public void test_hashCode() {
-		// Test for method int java.util.Date.hashCode()
-		Date d1 = new Date(0);
-		Date d2 = new Date(1900000);
-		assertEquals("Returned incorrect hash", 1900000, d2.hashCode());
-		assertEquals("Returned incorrect hash", 0, d1.hashCode());
-	}
-
-	/**
-	 * @tests java.util.Date#parse(java.lang.String)
-	 */
-	public void test_parseLjava_lang_String() {
-		// Test for method long java.util.Date.parse(java.lang.String)
-		Date d = new Date(Date.parse("13 October 1998"));
-		GregorianCalendar cal = new GregorianCalendar();
-		cal.setTime(d);
-		assertEquals("Parsed incorrect month", 9, cal.get(Calendar.MONTH));
-		assertEquals("Parsed incorrect year", 1998, cal.get(Calendar.YEAR));
-		assertEquals("Parsed incorrect date", 13, cal.get(Calendar.DATE));
-
-		d = new Date(Date.parse("Jan-12 1999"));
-		assertTrue("Wrong parsed date 1", d.equals(new GregorianCalendar(1999,
-				0, 12).getTime()));
-		d = new Date(Date.parse("Jan12-1999"));
-		assertTrue("Wrong parsed date 2", d.equals(new GregorianCalendar(1999,
-				0, 12).getTime()));
-		d = new Date(Date.parse("Jan12 69-1"));
-		cal.setTimeZone(TimeZone.getTimeZone("GMT"));
-		cal.clear();
-		cal.set(1969, Calendar.JANUARY, 12, 1, 0);
-		assertTrue("Wrong parsed date 3", d.equals(cal.getTime()));
-		d = new Date(Date.parse("6:45:13 3/2/1200 MST"));
-		cal.setTimeZone(TimeZone.getTimeZone("MST"));
-		cal.clear();
-		cal.set(1200, 2, 2, 6, 45, 13);
-		assertTrue("Wrong parsed date 4", d.equals(cal.getTime()));
-		d = new Date(Date.parse("Mon, 22 Nov 1999 12:52:06 GMT"));
-		cal.setTimeZone(TimeZone.getTimeZone("GMT"));
-		cal.clear();
-		cal.set(1999, Calendar.NOVEMBER, 22, 12, 52, 06);
-		assertTrue("Wrong parsed date 5", d.equals(cal.getTime()));
-
-		try {
-			// Regression for HARMONY-259
-			Date.parse(null);
-			fail("Date.parse(null) should throw IllegalArgumentException");
-		} catch (IllegalArgumentException e) {
-			// expected
-		}
-		
-        // Regression for HARMONY-102
-        assertEquals("Assert 0: parse failure",
-                -5400000, Date.parse("Sat, 1 Jan 1970 +0130 00:00:00"));
-        assertEquals("Assert 1: parse failure",
-                858600000, Date.parse("00:00:00 GMT +0130 Sat, 11 Jan 1970"));
-	}
-
-	/**
-	 * @tests java.util.Date#setDate(int)
-	 */
-	public void test_setDateI() {
-		// Test for method void java.util.Date.setDate(int)
-		Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9)
-				.getTime();
-		d.setDate(23);
-		assertEquals("Set incorrect date", 23, d.getDate());
-	}
-
-	/**
-	 * @tests java.util.Date#setHours(int)
-	 */
-	public void test_setHoursI() {
-		// Test for method void java.util.Date.setHours(int)
-		Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9)
-				.getTime();
-		d.setHours(23);
-		assertEquals("Set incorrect hours", 23, d.getHours());
-	}
-
-	/**
-	 * @tests java.util.Date#setMinutes(int)
-	 */
-	public void test_setMinutesI() {
-		// Test for method void java.util.Date.setMinutes(int)
-		Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9)
-				.getTime();
-		d.setMinutes(45);
-		assertEquals("Set incorrect mins", 45, d.getMinutes());
-	}
-
-	/**
-	 * @tests java.util.Date#setMonth(int)
-	 */
-	public void test_setMonthI() {
-		// Test for method void java.util.Date.setMonth(int)
-		Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9)
-				.getTime();
-		d.setMonth(0);
-		assertEquals("Set incorrect month", 0, d.getMonth());
-	}
-
-	/**
-	 * @tests java.util.Date#setSeconds(int)
-	 */
-	public void test_setSecondsI() {
-		// Test for method void java.util.Date.setSeconds(int)
-		Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9)
-				.getTime();
-		d.setSeconds(13);
-		assertEquals("Set incorrect seconds", 13, d.getSeconds());
-	}
-
-	/**
-	 * @tests java.util.Date#setTime(long)
-	 */
-	public void test_setTimeJ() {
-		// Test for method void java.util.Date.setTime(long)
-		Date d1 = new Date(0);
-		Date d2 = new Date(1900000);
-		d1.setTime(900);
-		d2.setTime(890000);
-		assertEquals("Returned incorrect time", 890000, d2.getTime());
-		assertEquals("Returned incorrect time", 900, d1.getTime());
-	}
-
-	/**
-	 * @tests java.util.Date#setYear(int)
-	 */
-	public void test_setYearI() {
-		// Test for method void java.util.Date.setYear(int)
-		Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9)
-				.getTime();
-		d.setYear(8);
-		assertEquals("Set incorrect year", 8, d.getYear());
-	}
-
-	/**
-	 * @tests java.util.Date#toGMTString()
-	 */
-	public void test_toGMTString() {
-		// Test for method java.lang.String java.util.Date.toGMTString()
-		assertEquals("Did not convert epoch to GMT string correctly", "1 Jan 1970 00:00:00 GMT", new Date(0)
-				.toGMTString());
-		assertEquals("Did not convert epoch + 1yr to GMT string correctly",
-				"1 Jan 1971 00:00:00 GMT", new Date((long) 365 * 24 * 60 * 60 * 1000).toGMTString()
-						);
-	}
-
-	/**
-	 * @tests java.util.Date#toString()
-	 */
-	public void test_toString() {
-		// Test for method java.lang.String java.util.Date.toString()
-		Calendar cal = Calendar.getInstance();
-		cal.set(Calendar.DATE, 1);
-		cal.set(Calendar.MONTH, Calendar.JANUARY);
-		cal.set(Calendar.YEAR, 1970);
-		cal.set(Calendar.HOUR_OF_DAY, 0);
-		cal.set(Calendar.MINUTE, 0);
-		cal.set(Calendar.SECOND, 0);
-		Date d = cal.getTime();
-		String result = d.toString();
-		assertTrue("Incorrect result: " + d, result
-				.startsWith("Thu Jan 01 00:00:00")
-				&& result.endsWith("1970"));
-
-		TimeZone tz = TimeZone.getDefault();
-		TimeZone.setDefault(TimeZone.getTimeZone("EST"));
-		try {
-			Date d1 = new Date(0);
-            assertTrue("Returned incorrect string: " + d1, d1.toString()
-                    .startsWith("Wed Dec 31 19:00:00")
-                    && d1.toString().endsWith("1969"));
-		} finally {
-			TimeZone.setDefault(tz);
-		}
-
-        // Test for HARMONY-5468
-        TimeZone.setDefault(TimeZone.getTimeZone("MST"));
-        Date d2 = new Date(108, 7, 27);
-        assertTrue("Returned incorrect string: " + d2, d2.toString()
-                .startsWith("Wed Aug 27 00:00:00 MST")
-                && d2.toString().endsWith("2008"));
-	}
-
-	/**
-	 * @tests java.util.Date#UTC(int, int, int, int, int, int)
-	 */
-	public void test_UTCIIIIII() {
-		// Test for method long java.util.Date.UTC(int, int, int, int, int, int)
-		assertTrue("Returned incorrect UTC value for epoch", Date.UTC(70, 0, 1,
-				0, 0, 0) == (long) 0);
-		assertTrue("Returned incorrect UTC value for epoch +1yr", Date.UTC(71,
-				0, 1, 0, 0, 0) == (long) 365 * 24 * 60 * 60 * 1000);
-	}
-	
-	static TimeZone defaultTimeZone = TimeZone.getDefault();
-
-	/**
-	 * Sets up the fixture, for example, open a network connection. This method
-	 * is called before a test is executed.
-	 */
-	protected void setUp() {
-	}
-
-	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
-	 */
-	protected void tearDown() {
-		TimeZone.setDefault(defaultTimeZone);
-	}
-}
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/util/FormatterTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/util/FormatterTest.java
deleted file mode 100644
index 7c3dad6..0000000
--- a/luni/src/test/java/org/apache/harmony/luni/tests/java/util/FormatterTest.java
+++ /dev/null
@@ -1,4333 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.harmony.luni.tests.java.util;
-
-import java.io.BufferedOutputStream;
-import java.io.Closeable;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.FilePermission;
-import java.io.Flushable;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PipedOutputStream;
-import java.io.PrintStream;
-import java.io.UnsupportedEncodingException;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.math.MathContext;
-import java.nio.charset.Charset;
-import java.security.Permission;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.DuplicateFormatFlagsException;
-import java.util.FormatFlagsConversionMismatchException;
-import java.util.Formattable;
-import java.util.FormattableFlags;
-import java.util.Formatter;
-import java.util.FormatterClosedException;
-import java.util.IllegalFormatCodePointException;
-import java.util.IllegalFormatConversionException;
-import java.util.IllegalFormatException;
-import java.util.IllegalFormatFlagsException;
-import java.util.IllegalFormatPrecisionException;
-import java.util.IllegalFormatWidthException;
-import java.util.Locale;
-import java.util.MissingFormatArgumentException;
-import java.util.MissingFormatWidthException;
-import java.util.TimeZone;
-import java.util.UnknownFormatConversionException;
-import java.util.Formatter.BigDecimalLayoutForm;
-
-import junit.framework.TestCase;
-
-public class FormatterTest extends TestCase {
-	private boolean root;
-
-    class MockAppendable implements Appendable {
-        public Appendable append(CharSequence arg0) throws IOException {
-            return null;
-        }
-
-        public Appendable append(char arg0) throws IOException {
-            return null;
-        }
-
-        public Appendable append(CharSequence arg0, int arg1, int arg2)
-                throws IOException {
-            return null;
-        }
-    }
-
-    class MockSecurityManager extends SecurityManager {
-        public void checkPermission(Permission p) {
-            if (p.getActions().equals("write") && p instanceof FilePermission) {
-                throw new SecurityException("Always throw security exception");
-            }
-        }
-
-        public void checkPermission(Permission p, Object ctx) {
-            checkPermission(p);
-        }
-    }
-
-    class MockFormattable implements Formattable {
-        public void formatTo(Formatter formatter, int flags, int width,
-                int precision) throws IllegalFormatException {
-            if ((flags & FormattableFlags.UPPERCASE) != 0) {
-                formatter.format("CUSTOMIZED FORMAT FUNCTION" + " WIDTH: "
-                        + width + " PRECISION: " + precision);
-            } else {
-                formatter.format("customized format function" + " width: "
-                        + width + " precision: " + precision);
-            }
-        }
-
-        public String toString() {
-            return "formattable object";
-        }
-
-        public int hashCode() {
-            return 0xf;
-        }
-    }
-
-    class MockDestination implements Appendable, Flushable {
-
-        private StringBuilder data = new StringBuilder();
-
-        private boolean enabled = false;
-
-        public Appendable append(char c) throws IOException {
-            if (enabled) {
-                data.append(c);
-                enabled = true; // enable it after the first append
-            } else {
-                throw new IOException();
-            }
-            return this;
-        }
-
-        public Appendable append(CharSequence csq) throws IOException {
-            if (enabled) {
-                data.append(csq);
-                enabled = true; // enable it after the first append
-            } else {
-                throw new IOException();
-            }
-            return this;
-        }
-
-        public Appendable append(CharSequence csq, int start, int end)
-                throws IOException {
-            if (enabled) {
-                data.append(csq, start, end);
-                enabled = true; // enable it after the first append
-            } else {
-                throw new IOException();
-            }
-            return this;
-        }
-
-        public void flush() throws IOException {
-            throw new IOException("Always throw IOException");
-        }
-
-        public String toString() {
-            return data.toString();
-        }
-    }
-
-    private File notExist;
-
-    private File fileWithContent;
-
-    private File readOnly;
-
-    private File secret;
-
-    private TimeZone defaultTimeZone;
-
-    /**
-     * @tests java.util.Formatter#Formatter()
-     */
-    public void test_Constructor() {
-        Formatter f = new Formatter();
-        assertNotNull(f);
-        assertTrue(f.out() instanceof StringBuilder);
-        assertEquals(f.locale(), Locale.getDefault());
-        assertNotNull(f.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(Appendable)
-     */
-    public void test_ConstructorLjava_lang_Appendable() {
-        MockAppendable ma = new MockAppendable();
-        Formatter f1 = new Formatter(ma);
-        assertEquals(ma, f1.out());
-        assertEquals(f1.locale(), Locale.getDefault());
-        assertNotNull(f1.toString());
-
-        Formatter f2 = new Formatter((Appendable) null);
-        /*
-         * If a(the input param) is null then a StringBuilder will be created
-         * and the output can be attained by invoking the out() method. But RI
-         * raises an error of FormatterClosedException when invoking out() or
-         * toString().
-         */
-        Appendable sb = f2.out();
-        assertTrue(sb instanceof StringBuilder);
-        assertNotNull(f2.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(Locale)
-     */
-    public void test_ConstructorLjava_util_Locale() {
-        Formatter f1 = new Formatter(Locale.FRANCE);
-        assertTrue(f1.out() instanceof StringBuilder);
-        assertEquals(f1.locale(), Locale.FRANCE);
-        assertNotNull(f1.toString());
-
-        Formatter f2 = new Formatter((Locale) null);
-        assertNull(f2.locale());
-        assertTrue(f2.out() instanceof StringBuilder);
-        assertNotNull(f2.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(Appendable, Locale)
-     */
-    public void test_ConstructorLjava_lang_AppendableLjava_util_Locale() {
-        MockAppendable ma = new MockAppendable();
-        Formatter f1 = new Formatter(ma, Locale.CANADA);
-        assertEquals(ma, f1.out());
-        assertEquals(f1.locale(), Locale.CANADA);
-
-        Formatter f2 = new Formatter(ma, null);
-        assertNull(f2.locale());
-        assertEquals(ma, f1.out());
-
-        Formatter f3 = new Formatter(null, Locale.GERMAN);
-        assertEquals(f3.locale(), Locale.GERMAN);
-        assertTrue(f3.out() instanceof StringBuilder);
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(String)
-     */
-    public void test_ConstructorLjava_lang_String() throws IOException {
-        Formatter f = null;
-        try {
-            f = new Formatter((String) null);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e1) {
-            // expected
-        }
-
-        f = new Formatter(notExist.getPath());
-        assertEquals(f.locale(), Locale.getDefault());
-        f.close();
-
-        f = new Formatter(fileWithContent.getPath());
-        assertEquals(0, fileWithContent.length());
-        f.close();
-
-        if(!root){
-        	try {
-                f = new Formatter(readOnly.getPath());
-                fail("should throw FileNotFoundException");
-            } catch (FileNotFoundException e) {
-                // expected
-            }
-        }
-
-        SecurityManager oldsm = System.getSecurityManager();
-        System.setSecurityManager(new MockSecurityManager());
-        try {
-            f = new Formatter(secret.getPath());
-            fail("should throw SecurityException");
-        } catch (SecurityException se) {
-            // expected
-        } finally {
-            System.setSecurityManager(oldsm);
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(String, String)
-     */
-    public void test_ConstructorLjava_lang_StringLjava_lang_String()
-            throws IOException {
-        Formatter f = null;
-        try {
-            f = new Formatter((String) null, Charset.defaultCharset().name());
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e1) {
-            // expected
-        }
-
-        try {
-            f = new Formatter(notExist.getPath(), null);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e2) {
-            // expected
-        }
-
-        f = new Formatter(notExist.getPath(), Charset.defaultCharset().name());
-        assertEquals(f.locale(), Locale.getDefault());
-        f.close();
-
-        try {
-            f = new Formatter(notExist.getPath(), "ISO 1111-1");
-            fail("should throw UnsupportedEncodingException");
-        } catch (UnsupportedEncodingException e1) {
-            // expected
-        }
-
-        f = new Formatter(fileWithContent.getPath(), "UTF-16BE");
-        assertEquals(0, fileWithContent.length());
-        f.close();
-
-        if(!root){
-        	try {
-                f = new Formatter(readOnly.getPath(), "UTF-16BE");
-                fail("should throw FileNotFoundException");
-            } catch (FileNotFoundException e) {
-                // expected
-            }
-        }
-
-        SecurityManager oldsm = System.getSecurityManager();
-        System.setSecurityManager(new MockSecurityManager());
-        try {
-            f = new Formatter(secret.getPath(), "UTF-16BE");
-            fail("should throw SecurityException");
-        } catch (SecurityException se) {
-            // expected
-        } finally {
-            System.setSecurityManager(oldsm);
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(String, String, Locale)
-     */
-    public void test_ConstructorLjava_lang_StringLjava_lang_StringLjava_util_Locale()
-            throws IOException {
-        Formatter f = null;
-        try {
-            f = new Formatter((String) null, Charset.defaultCharset().name(),
-                    Locale.KOREA);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e1) {
-            // expected
-        }
-
-        try {
-            f = new Formatter(notExist.getPath(), null, Locale.KOREA);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e2) {
-            // expected
-        }
-
-        f = new Formatter(notExist.getPath(), Charset.defaultCharset().name(),
-                null);
-        assertNotNull(f);
-        f.close();
-
-        f = new Formatter(notExist.getPath(), Charset.defaultCharset().name(),
-                Locale.KOREA);
-        assertEquals(f.locale(), Locale.KOREA);
-        f.close();
-
-        try {
-            f = new Formatter(notExist.getPath(), "ISO 1111-1", Locale.CHINA);
-            fail("should throw UnsupportedEncodingException");
-        } catch (UnsupportedEncodingException e1) {
-            // expected
-        }
-
-        f = new Formatter(fileWithContent.getPath(), "UTF-16BE",
-                Locale.CANADA_FRENCH);
-        assertEquals(0, fileWithContent.length());
-        f.close();
-
-        if(!root){
-        	try {
-                f = new Formatter(readOnly.getPath(), Charset.defaultCharset()
-                        .name(), Locale.ITALY);
-                fail("should throw FileNotFoundException");
-            } catch (FileNotFoundException e) {
-                // expected
-            }
-        }
-
-        SecurityManager oldsm = System.getSecurityManager();
-        System.setSecurityManager(new MockSecurityManager());
-        try {
-            f = new Formatter(secret.getPath(),
-                    Charset.defaultCharset().name(), Locale.SIMPLIFIED_CHINESE);
-            fail("should throw SecurityException");
-        } catch (SecurityException se) {
-            // expected
-        } finally {
-            System.setSecurityManager(oldsm);
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(File)
-     */
-    public void test_ConstructorLjava_io_File() throws IOException {
-        Formatter f = null;
-        try {
-            f = new Formatter((File) null);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e1) {
-            // expected
-        }
-
-        f = new Formatter(notExist);
-        assertEquals(f.locale(), Locale.getDefault());
-        f.close();
-
-        f = new Formatter(fileWithContent);
-        assertEquals(0, fileWithContent.length());
-        f.close();
-
-        if(!root){
-        	try {
-                f = new Formatter(readOnly);
-                fail("should throw FileNotFoundException");
-            } catch (FileNotFoundException e) {
-                // expected
-            }
-        }
-
-        SecurityManager oldsm = System.getSecurityManager();
-        System.setSecurityManager(new MockSecurityManager());
-        try {
-            f = new Formatter(secret);
-            fail("should throw SecurityException");
-        } catch (SecurityException se) {
-            // expected
-        } finally {
-            System.setSecurityManager(oldsm);
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(File, String)
-     */
-    public void test_ConstructorLjava_io_FileLjava_lang_String()
-            throws IOException {
-        Formatter f = null;
-        try {
-            f = new Formatter((File) null, Charset.defaultCharset().name());
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e1) {
-            // expected
-        }
-
-        f = new Formatter(notExist, Charset.defaultCharset().name());
-        assertEquals(f.locale(), Locale.getDefault());
-        f.close();
-
-        f = new Formatter(fileWithContent, "UTF-16BE");
-        assertEquals(0, fileWithContent.length());
-        f.close();
-
-        if(!root){
-        	try {
-                f = new Formatter(readOnly, Charset.defaultCharset().name());
-                fail("should throw FileNotFoundException");
-            } catch (FileNotFoundException e) {
-                // expected
-            }
-        }
-
-        SecurityManager oldsm = System.getSecurityManager();
-        System.setSecurityManager(new MockSecurityManager());
-        try {
-            f = new Formatter(secret, Charset.defaultCharset().name());
-            fail("should throw SecurityException");
-        } catch (SecurityException se) {
-            // expected
-        } finally {
-            System.setSecurityManager(oldsm);
-        }
-
-        try {
-            f = new Formatter(notExist, null);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e2) {
-            // expected
-        } finally {
-            if (notExist.exists()) {
-                // Fail on RI on Windows, because output stream is created and
-                // not closed when exception thrown
-                assertTrue(notExist.delete());
-            }
-        }
-
-        try {
-            f = new Formatter(notExist, "ISO 1111-1");
-            fail("should throw UnsupportedEncodingException");
-        } catch (UnsupportedEncodingException e1) {
-            // expected
-        } finally {
-            if (notExist.exists()) {
-                // Fail on RI on Windows, because output stream is created and
-                // not closed when exception thrown
-                assertTrue(notExist.delete());
-            }
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(File, String, Locale)
-     */
-    public void test_ConstructorLjava_io_FileLjava_lang_StringLjava_util_Locale()
-            throws IOException {
-        Formatter f = null;
-        try {
-            f = new Formatter((File) null, Charset.defaultCharset().name(),
-                    Locale.KOREA);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e1) {
-            // expected
-        }
-
-        try {
-            f = new Formatter(notExist, null, Locale.KOREA);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e2) {
-            // expected
-        }
-
-        f = new Formatter(notExist, Charset.defaultCharset().name(), null);
-        assertNotNull(f);
-        f.close();
-
-        f = new Formatter(notExist, Charset.defaultCharset().name(),
-                Locale.KOREA);
-        assertEquals(f.locale(), Locale.KOREA);
-        f.close();
-
-        try {
-            f = new Formatter(notExist, "ISO 1111-1", Locale.CHINA);
-            fail("should throw UnsupportedEncodingException");
-        } catch (UnsupportedEncodingException e1) {
-            // expected
-        }
-        f = new Formatter(fileWithContent.getPath(), "UTF-16BE",
-                Locale.CANADA_FRENCH);
-        assertEquals(0, fileWithContent.length());
-        f.close();
-
-        if(!root){
-        	try {
-                f = new Formatter(readOnly.getPath(), Charset.defaultCharset()
-                        .name(), Locale.ITALY);
-                fail("should throw FileNotFoundException");
-            } catch (FileNotFoundException e) {
-                // expected
-            }
-        }
-
-        SecurityManager oldsm = System.getSecurityManager();
-        System.setSecurityManager(new MockSecurityManager());
-        try {
-            f = new Formatter(secret.getPath(),
-                    Charset.defaultCharset().name(), Locale.SIMPLIFIED_CHINESE);
-            fail("should throw SecurityException");
-        } catch (SecurityException se) {
-            // expected
-        } finally {
-            System.setSecurityManager(oldsm);
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(PrintStream)
-     */
-    public void test_ConstructorLjava_io_PrintStream() throws IOException {
-        Formatter f = null;
-        try {
-            f = new Formatter((PrintStream) null);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e1) {
-            // expected
-        }
-
-        PrintStream ps = new PrintStream(notExist, "UTF-16BE");
-        f = new Formatter(ps);
-        assertEquals(Locale.getDefault(), f.locale());
-        f.close();
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(OutputStream)
-     */
-    public void test_ConstructorLjava_io_OutputStream() throws IOException {
-        Formatter f = null;
-        try {
-            f = new Formatter((OutputStream) null);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e1) {
-            // expected
-        }
-
-        OutputStream os = new FileOutputStream(notExist);
-        f = new Formatter(os);
-        assertEquals(Locale.getDefault(), f.locale());
-        f.close();
-    }
-
-    /**
-     * @tests java.util.Formatter#Formatter(OutputStream, String)
-     */
-    public void test_ConstructorLjava_io_OutputStreamLjava_lang_String()
-            throws IOException {
-        Formatter f = null;
-        try {
-            f = new Formatter((OutputStream) null, Charset.defaultCharset()
-                    .name());
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e1) {
-            // expected
-        }
-
-        OutputStream os = null;
-        try {
-            os = new FileOutputStream(notExist);
-            f = new Formatter(os, null);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e2) {
-            // expected
-        } finally {
-            os.close();
-        }
-
-        try {
-            os = new PipedOutputStream();
-            f = new Formatter(os, "TMP-1111");
-            fail("should throw UnsupportedEncodingException");
-        } catch (UnsupportedEncodingException e1) {
-            // expected
-        } finally {
-            os.close();
-        }
-
-        os = new FileOutputStream(fileWithContent);
-        f = new Formatter(os, "UTF-16BE");
-        assertEquals(Locale.getDefault(), f.locale());
-        f.close();
-    }
-
-    /**
-     * Test method for 'java.util.Formatter.Formatter(OutputStream, String,
-     * Locale)
-     */
-    public void test_ConstructorLjava_io_OutputStreamLjava_lang_StringLjava_util_Locale()
-            throws IOException {
-        Formatter f = null;
-        try {
-            f = new Formatter((OutputStream) null, Charset.defaultCharset()
-                    .name(), Locale.getDefault());
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e1) {
-            // expected
-        }
-
-        OutputStream os = null;
-        try {
-            os = new FileOutputStream(notExist);
-            f = new Formatter(os, null, Locale.getDefault());
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e2) {
-            // expected
-        } finally {
-            os.close();
-        }
-
-        os = new FileOutputStream(notExist);
-        f = new Formatter(os, Charset.defaultCharset().name(), null);
-        f.close();
-
-        try {
-            os = new PipedOutputStream();
-            f = new Formatter(os, "TMP-1111", Locale.getDefault());
-            fail("should throw UnsupportedEncodingException");
-        } catch (UnsupportedEncodingException e1) {
-            // expected
-        }
-
-        os = new FileOutputStream(fileWithContent);
-        f = new Formatter(os, "UTF-16BE", Locale.ENGLISH);
-        assertEquals(Locale.ENGLISH, f.locale());
-        f.close();
-    }
-
-    /**
-     * @tests java.util.Formatter#locale()
-     */
-    public void test_locale() {
-        Formatter f = null;
-        f = new Formatter((Locale) null);
-        assertNull(f.locale());
-
-        f.close();
-        try {
-            f.locale();
-            fail("should throw FormatterClosedException");
-        } catch (FormatterClosedException e) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#out()
-     */
-    public void test_out() {
-        Formatter f = null;
-        f = new Formatter();
-        assertNotNull(f.out());
-        assertTrue(f.out() instanceof StringBuilder);
-        f.close();
-        try {
-            f.out();
-            fail("should throw FormatterClosedException");
-        } catch (FormatterClosedException e) {
-            // expected
-        }
-
-    }
-
-    /**
-     * @tests java.util.Formatter#flush()
-     */
-    public void test_flush() throws IOException {
-        Formatter f = null;
-        f = new Formatter(notExist);
-        assertTrue(f instanceof Flushable);
-        f.close();
-        try {
-            f.flush();
-            fail("should throw FormatterClosedException");
-        } catch (FormatterClosedException e) {
-            // expected
-        }
-
-        f = new Formatter();
-        // For destination that does not implement Flushable
-        // No exception should be thrown
-        f.flush();
-    }
-
-    /**
-     * @tests java.util.Formatter#close()
-     */
-    public void test_close() throws IOException {
-        Formatter f = new Formatter(notExist);
-        assertTrue(f instanceof Closeable);
-        f.close();
-        // close next time will not throw exception
-        f.close();
-        assertNull(f.ioException());
-    }
-
-    /**
-     * @tests java.util.Formatter#toString()
-     */
-    public void test_toString() {
-        Formatter f = new Formatter();
-        assertNotNull(f.toString());
-        assertEquals(f.out().toString(), f.toString());
-        f.close();
-        try {
-            f.toString();
-            fail("should throw FormatterClosedException");
-        } catch (FormatterClosedException e) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#ioException()
-     */
-    public void test_ioException() throws IOException {
-        Formatter f = null;
-        f = new Formatter(new MockDestination());
-        assertNull(f.ioException());
-        f.flush();
-        assertNotNull(f.ioException());
-        f.close();
-
-        MockDestination md = new MockDestination();
-        f = new Formatter(md);
-        f.format("%s%s", "1", "2");
-        // format stop working after IOException
-        assertNotNull(f.ioException());
-        assertEquals("", f.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for null parameter
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_null() {
-        Formatter f = new Formatter();
-        try {
-            f.format((String) null, "parameter");
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        }
-
-        f = new Formatter();
-        f.format("hello", (Object[]) null);
-        assertEquals("hello", f.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for argument index
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_ArgIndex() {
-        Formatter formatter = new Formatter(Locale.US);
-        formatter.format("%1$s%2$s%3$s%4$s%5$s%6$s%7$s%8$s%9$s%11$s%10$s", "1",
-                "2", "3", "4", "5", "6", "7", "8", "9", "10", "11");
-        assertEquals("1234567891110", formatter.toString());
-
-        formatter = new Formatter(Locale.JAPAN);
-        formatter.format("%0$s", "hello");
-        assertEquals("hello", formatter.toString());
-
-        try {
-            formatter = new Formatter(Locale.US);
-            formatter.format("%-1$s", "1", "2");
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }
-
-        try {
-            formatter = new Formatter(Locale.US);
-            formatter.format("%$s", "hello", "2");
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }
-
-        try {
-            Formatter f = new Formatter(Locale.US);
-            f.format("%", "string");
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }
-
-        formatter = new Formatter(Locale.FRANCE);
-        formatter.format("%1$s%2$s%3$s%4$s%5$s%6$s%7$s%8$s%<s%s%s%<s", "1",
-                "2", "3", "4", "5", "6", "7", "8", "9", "10", "11");
-        assertEquals("123456788122", formatter.toString());
-
-        formatter = new Formatter(Locale.FRANCE);
-        formatter.format(
-                "xx%1$s22%2$s%s%<s%5$s%<s&%7$h%2$s%8$s%<s%s%s%<ssuffix", "1",
-                "2", "3", "4", "5", "6", 7, "8", "9", "10", "11");
-        assertEquals("xx12221155&7288233suffix", formatter.toString());
-
-        try {
-            formatter.format("%<s", "hello");
-            fail("should throw MissingFormatArgumentException");
-        } catch (MissingFormatArgumentException e) {
-            // expected
-        }
-
-        formatter = new Formatter(Locale.US);
-        try {
-            formatter.format("%123$s", "hello");
-            fail("should throw MissingFormatArgumentException");
-        } catch (MissingFormatArgumentException e) {
-            // expected
-        }
-
-        formatter = new Formatter(Locale.US);
-        try {
-            // 2147483648 is the value of Integer.MAX_VALUE + 1
-            formatter.format("%2147483648$s", "hello");
-            fail("should throw MissingFormatArgumentException");
-        } catch (MissingFormatArgumentException e) {
-            // expected
-        }
-
-        try {
-            // 2147483647 is the value of Integer.MAX_VALUE
-            formatter.format("%2147483647$s", "hello");
-            fail("should throw MissingFormatArgumentException");
-        } catch (MissingFormatArgumentException e) {
-            // expected
-        }
-
-        formatter = new Formatter(Locale.US);
-        try {
-            formatter.format("%s%s", "hello");
-            fail("should throw MissingFormatArgumentException");
-        } catch (MissingFormatArgumentException e) {
-            // expected
-        }
-
-        formatter = new Formatter(Locale.US);
-        formatter.format("$100", 100);
-        assertEquals("$100", formatter.toString());
-
-        formatter = new Formatter(Locale.UK);
-        formatter.format("%01$s", "string");
-        assertEquals("string", formatter.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for width
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_Width() {
-        Formatter f = new Formatter(Locale.US);
-        f.format("%1$8s", "1");
-        assertEquals("       1", f.toString());
-
-        f = new Formatter(Locale.US);
-        f.format("%1$-1%", "string");
-        assertEquals("%", f.toString());
-
-        f = new Formatter(Locale.ITALY);
-        // 2147483648 is the value of Integer.MAX_VALUE + 1
-        f.format("%2147483648s", "string");
-        assertEquals("string", f.toString());
-
-        // the value of Integer.MAX_VALUE will allocate about 4G bytes of
-        // memory.
-        // It may cause OutOfMemoryError, so this value is not tested
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for precision
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_Precision() {
-        Formatter f = new Formatter(Locale.US);
-        f.format("%.5s", "123456");
-        assertEquals("12345", f.toString());
-
-        f = new Formatter(Locale.US);
-        // 2147483648 is the value of Integer.MAX_VALUE + 1
-        f.format("%.2147483648s", "...");
-        assertEquals("...", f.toString());
-
-        // the value of Integer.MAX_VALUE will allocate about 4G bytes of
-        // memory.
-        // It may cause OutOfMemoryError, so this value is not tested
-
-        f = new Formatter(Locale.US);
-        f.format("%10.0b", Boolean.TRUE);
-        assertEquals("          ", f.toString());
-
-        f = new Formatter(Locale.US);
-        f.format("%10.01s", "hello");
-        assertEquals("         h", f.toString());
-
-        try {
-            f = new Formatter(Locale.US);
-            f.format("%.s", "hello", "2");
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }
-
-        try {
-            f = new Formatter(Locale.US);
-            f.format("%.-5s", "123456");
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }
-
-        try {
-            f = new Formatter(Locale.US);
-            f.format("%1.s", "hello", "2");
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }
-
-        f = new Formatter(Locale.US);
-        f.format("%5.1s", "hello");
-        assertEquals("    h", f.toString());
-
-        f = new Formatter(Locale.FRANCE);
-        f.format("%.0s", "hello", "2");
-        assertEquals("", f.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for line sperator
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_LineSeparator() {
-        Formatter f = null;
-
-        String oldSeparator = System.getProperty("line.separator");
-        System.setProperty("line.separator", "!\n");
-
-        f = new Formatter(Locale.US);
-        f.format("%1$n", 1);
-        assertEquals("!\n", f.toString());
-
-        f = new Formatter(Locale.KOREAN);
-        f.format("head%1$n%2$n", 1, new Date());
-        assertEquals("head!\n!\n", f.toString());
-
-        f = new Formatter(Locale.US);
-        f.format("%n%s", "hello");
-        assertEquals("!\nhello", f.toString());
-
-        System.setProperty("line.separator", oldSeparator);
-
-        f = new Formatter(Locale.US);
-        try {
-            f.format("%-n");
-            fail("should throw IllegalFormatFlagsException: %-n");
-        } catch (IllegalFormatFlagsException e) {
-            // expected
-        }
-        try {
-            f.format("%+n");
-            fail("should throw IllegalFormatFlagsException: %+n");
-        } catch (IllegalFormatFlagsException e) {
-            // expected
-        }
-        try {
-            f.format("%#n");
-            fail("should throw IllegalFormatFlagsException: %#n");
-        } catch (IllegalFormatFlagsException e) {
-            // expected
-        }
-        try {
-            f.format("% n");
-            fail("should throw IllegalFormatFlagsException: % n");
-        } catch (IllegalFormatFlagsException e) {
-            // expected
-        }
-        try {
-            f.format("%0n");
-            fail("should throw IllegalFormatFlagsException: %0n");
-        } catch (IllegalFormatFlagsException e) {
-            // expected
-        }
-        try {
-            f.format("%,n");
-            fail("should throw IllegalFormatFlagsException: %,n");
-        } catch (IllegalFormatFlagsException e) {
-            // expected
-        }
-        try {
-            f.format("%(n");
-            fail("should throw IllegalFormatFlagsException: %(n");
-        } catch (IllegalFormatFlagsException e) {
-            // expected
-        }
-
-        f = new Formatter(Locale.US);
-        try {
-            f.format("%4n");
-            fail("should throw IllegalFormatWidthException");
-        } catch (IllegalFormatWidthException e) {
-            // expected
-        }
-
-        f = new Formatter(Locale.US);
-        try {
-            f.format("%-4n");
-            fail("should throw IllegalFormatWidthException");
-        } catch (IllegalFormatWidthException e) {
-            // expected
-        }
-
-        f = new Formatter(Locale.US);
-        try {
-            f.format("%.9n");
-            fail("should throw IllegalFormatPrecisionException");
-        } catch (IllegalFormatPrecisionException e) {
-            // expected
-        }
-
-        f = new Formatter(Locale.US);
-        try {
-            f.format("%5.9n");
-            fail("should throw IllegalFormatPrecisionException");
-        } catch (IllegalFormatPrecisionException e) {
-            // expected
-        }
-
-        System.setProperty("line.separator", oldSeparator);
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for percent
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_Percent() {
-        Formatter f = null;
-
-        f = new Formatter(Locale.ENGLISH);
-        f.format("%1$%", 100);
-        assertEquals("%", f.toString());
-
-        f = new Formatter(Locale.CHINA);
-        f.format("%1$%%%", "hello", new Object());
-        assertEquals("%%", f.toString());
-
-        f = new Formatter(Locale.CHINA);
-        f.format("%%%s", "hello");
-        assertEquals("%hello", f.toString());
-
-        f = new Formatter(Locale.US);
-        try {
-            f.format("%.9%");
-            fail("should throw IllegalFormatPrecisionException");
-        } catch (IllegalFormatPrecisionException e) {
-            // expected
-        }
-
-        f = new Formatter(Locale.US);
-        try {
-            f.format("%5.9%");
-            fail("should throw IllegalFormatPrecisionException");
-        } catch (IllegalFormatPrecisionException e) {
-            // expected
-        }
-
-        f = new Formatter(Locale.US);
-        assertFormatFlagsConversionMismatchException(f, "%+%");
-        assertFormatFlagsConversionMismatchException(f, "%#%");
-        assertFormatFlagsConversionMismatchException(f, "% %");
-        assertFormatFlagsConversionMismatchException(f, "%0%");
-        assertFormatFlagsConversionMismatchException(f, "%,%");
-        assertFormatFlagsConversionMismatchException(f, "%(%");
-
-
-        f = new Formatter(Locale.KOREAN);
-        f.format("%4%", 1);
-        /*
-         * fail on RI the output string should be right justified by appending
-         * spaces till the whole string is 4 chars width.
-         */
-        assertEquals("   %", f.toString());
-
-        f = new Formatter(Locale.US);
-        f.format("%-4%", 100);
-        /*
-         * fail on RI, throw UnknownFormatConversionException the output string
-         * should be left justified by appending spaces till the whole string is
-         * 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
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for flag
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_Flag() {
-        Formatter f = new Formatter(Locale.US);
-        try {
-            f.format("%1$-#-8s", "something");
-            fail("should throw DuplicateFormatFlagsException");
-        } catch (DuplicateFormatFlagsException e) {
-            // expected
-        }
-
-        final char[] chars = { '-', '#', '+', ' ', '0', ',', '(', '%', '<' };
-        Arrays.sort(chars);
-        f = new Formatter(Locale.US);
-        for (char i = 0; i <= 256; i++) {
-            // test 8 bit character
-            if (Arrays.binarySearch(chars, i) >= 0 || Character.isDigit(i)
-                    || Character.isLetter(i)) {
-                // Do not test 0-9, a-z, A-Z and characters in the chars array.
-                // They are characters used as flags, width or conversions
-                continue;
-            }
-            try {
-                f.format("%" + i + "s", 1);
-                fail("should throw UnknownFormatConversionException");
-            } catch (UnknownFormatConversionException e) {
-                // expected
-            }
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for general
-     *        conversion b/B
-     */
-    public void test_format_LString$LObject_GeneralConversionB() {
-        final Object[][] triple = {
-                { Boolean.FALSE,                "%3.2b",  " fa", },
-                { Boolean.FALSE,                "%-4.6b", "false", },
-                { Boolean.FALSE,                "%.2b",   "fa", },
-                { Boolean.TRUE,                 "%3.2b",  " tr", },
-                { Boolean.TRUE,                 "%-4.6b", "true", },
-                { Boolean.TRUE,                 "%.2b",   "tr", },
-                { new Character('c'),           "%3.2b",  " tr", },
-                { new Character('c'),           "%-4.6b", "true", },
-                { new Character('c'),           "%.2b",   "tr", },
-                { new Byte((byte) 0x01),        "%3.2b",  " tr", },
-                { new Byte((byte) 0x01),        "%-4.6b", "true", },
-                { new Byte((byte) 0x01),        "%.2b",   "tr", },
-                { new Short((short) 0x0001),    "%3.2b",  " tr", },
-                { new Short((short) 0x0001),    "%-4.6b", "true", },
-                { new Short((short) 0x0001),    "%.2b",   "tr", },
-                { new Integer(1),               "%3.2b",  " tr", },
-                { new Integer(1),               "%-4.6b", "true", },
-                { new Integer(1),               "%.2b",   "tr", },
-                { new Float(1.1f),              "%3.2b",  " tr", },
-                { new Float(1.1f),              "%-4.6b", "true", },
-                { new Float(1.1f),              "%.2b",   "tr", },
-                { new Double(1.1d),             "%3.2b",  " tr", },
-                { new Double(1.1d),             "%-4.6b", "true", },
-                { new Double(1.1d),             "%.2b",   "tr", },
-                { "",                           "%3.2b",  " tr", },
-                { "",                           "%-4.6b", "true", },
-                { "",                           "%.2b",   "tr", },
-                { "string content",             "%3.2b",  " tr", },
-                { "string content",             "%-4.6b", "true", },
-                { "string content",             "%.2b",   "tr", },
-                { new MockFormattable(),        "%3.2b",  " tr", },
-                { new MockFormattable(),        "%-4.6b", "true", },
-                { new MockFormattable(),        "%.2b",   "tr", },
-                { (Object) null,                "%3.2b",  " fa", },
-                { (Object) null,                "%-4.6b", "false", },
-                { (Object) null,                "%.2b",   "fa", },
-                };
-
-
-        final int input   = 0;
-        final int pattern = 1;
-        final int output  = 2;
-        Formatter f = null;
-        for (int i = 0; i < triple.length; i++) {
-            f = new Formatter(Locale.FRANCE);
-            f.format((String)triple[i][pattern], triple[i][input]);
-            assertEquals("triple[" + i + "]:" + triple[i][input]
-                          + ",pattern[" + i + "]:" + triple[i][pattern], triple[i][output], f.toString());
-
-            f = new Formatter(Locale.GERMAN);
-            f.format(((String)triple[i][pattern]).toUpperCase(Locale.US), triple[i][input]);
-            assertEquals("triple[" + i + "]:" + triple[i][input]
-                          + ",pattern[" + i + "]:" + triple[i][pattern], ((String)triple[i][output])
-                    .toUpperCase(Locale.US), f.toString());
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for general
-     *        conversion type 's' and 'S'
-     */
-    public void test_format_LString$LObject_GeneralConversionS() {
-
-        final Object[][] triple = {
-                { Boolean.FALSE,                "%2.3s",  "fal", },
-                { Boolean.FALSE,                "%-6.4s", "fals  ", },
-                { Boolean.FALSE,                "%.5s",   "false", },
-                { Boolean.TRUE,                 "%2.3s",  "tru", },
-                { Boolean.TRUE,                 "%-6.4s", "true  ", },
-                { Boolean.TRUE,                 "%.5s",   "true", },
-                { new Character('c'),           "%2.3s",  " c", },
-                { new Character('c'),           "%-6.4s", "c     ", },
-                { new Character('c'),           "%.5s",   "c", },
-                { new Byte((byte) 0x01),        "%2.3s",  " 1", },
-                { new Byte((byte) 0x01),        "%-6.4s", "1     ", },
-                { new Byte((byte) 0x01),        "%.5s",   "1", },
-                { new Short((short) 0x0001),    "%2.3s",  " 1", },
-                { new Short((short) 0x0001),    "%-6.4s", "1     ", },
-                { new Short((short) 0x0001),    "%.5s",   "1", },
-                { new Integer(1),               "%2.3s",  " 1", },
-                { new Integer(1),               "%-6.4s", "1     ", },
-                { new Integer(1),               "%.5s",   "1", },
-                { new Float(1.1f),              "%2.3s",  "1.1", },
-                { new Float(1.1f),              "%-6.4s", "1.1   ", },
-                { new Float(1.1f),              "%.5s",   "1.1", },
-                { new Double(1.1d),             "%2.3s",  "1.1", },
-                { new Double(1.1d),             "%-6.4s", "1.1   ", },
-                { new Double(1.1d),             "%.5s",   "1.1", },
-                { "",                           "%2.3s",  "  ", },
-                { "",                           "%-6.4s", "      ", },
-                { "",                           "%.5s",   "", },
-                { "string content",             "%2.3s",  "str", },
-                { "string content",             "%-6.4s", "stri  ", },
-                { "string content",             "%.5s",   "strin", },
-                { new MockFormattable(),        "%2.3s",  "customized format function width: 2 precision: 3", },
-                { new MockFormattable(),        "%-6.4s", "customized format function width: 6 precision: 4", },
-                { new MockFormattable(),        "%.5s",   "customized format function width: -1 precision: 5", },
-                { (Object) null,                "%2.3s",  "nul", },
-                { (Object) null,                "%-6.4s", "null  ", },
-                { (Object) null,                "%.5s",   "null", },
-                };
-
-
-        final int input   = 0;
-        final int pattern = 1;
-        final int output  = 2;
-        Formatter f = null;
-        for (int i = 0; i < triple.length; i++) {
-            f = new Formatter(Locale.FRANCE);
-            f.format((String)triple[i][pattern], triple[i][input]);
-            assertEquals("triple[" + i + "]:" + triple[i][input]
-                          + ",pattern[" + i + "]:" + triple[i][pattern], triple[i][output], f.toString());
-
-            f = new Formatter(Locale.GERMAN);
-            f.format(((String)triple[i][pattern]).toUpperCase(Locale.US), triple[i][input]);
-            assertEquals("triple[" + i + "]:" + triple[i][input]
-                          + ",pattern[" + i + "]:" + triple[i][pattern], ((String)triple[i][output])
-                    .toUpperCase(Locale.US), f.toString());
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for general
-     *        conversion type 'h' and 'H'
-     */
-    public void test_format_LString$LObject_GeneralConversionH() {
-
-        final Object[] input = {
-                 Boolean.FALSE,
-                 Boolean.TRUE,
-                 new Character('c'),
-                 new Byte((byte) 0x01),
-                 new Short((short) 0x0001),
-                 new Integer(1),
-                 new Float(1.1f),
-                 new Double(1.1d),
-                 "",
-                 "string content",
-                 new MockFormattable(),
-                 (Object) null,
-                };
-
-        Formatter f = null;
-        for (int i = 0; i < input.length - 1; i++) {
-            f = new Formatter(Locale.FRANCE);
-            f.format("%h", input[i]);
-            assertEquals("triple[" + i + "]:" + input[i],
-                    Integer.toHexString(input[i].hashCode()), f.toString());
-
-            f = new Formatter(Locale.GERMAN);
-            f.format("%H", input[i]);
-            assertEquals("triple[" + i + "]:" + input[i],
-                    Integer.toHexString(input[i].hashCode()).toUpperCase(Locale.US), f.toString());
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for general
-     *        conversion other cases
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_GeneralConversionOther() {
-        /*
-         * In Turkish locale, the upper case of '\u0069' is '\u0130'. The
-         * following test indicate that '\u0069' is coverted to upper case
-         * without using the turkish locale.
-         */
-        Formatter f = new Formatter(new Locale("tr"));
-        f.format("%S", "\u0069");
-        assertEquals("\u0049", f.toString());
-
-        final Object[] input = {
-                Boolean.FALSE,
-                Boolean.TRUE,
-                new Character('c'),
-                new Byte((byte) 0x01),
-                new Short((short) 0x0001),
-                new Integer(1),
-                new Float(1.1f),
-                new Double(1.1d),
-                "",
-                "string content",
-                new MockFormattable(),
-                (Object) null,
-               };
-        f = new Formatter(Locale.GERMAN);
-        for (int i = 0; i < input.length; i++) {
-            if (!(input[i] instanceof Formattable)) {
-                try {
-                    f.format("%#s", input[i]);
-                    /*
-                     * fail on RI, spec says if the '#' flag is present and the
-                     * argument is not a Formattable , then a
-                     * FormatFlagsConversionMismatchException will be thrown.
-                     */
-                    fail("should throw FormatFlagsConversionMismatchException");
-                } catch (FormatFlagsConversionMismatchException e) {
-                    // expected
-                }
-            } else {
-                f.format("%#s%<-#8s", input[i]);
-                assertEquals(
-                        "customized format function width: -1 precision: -1customized format function width: 8 precision: -1",
-                        f.toString());
-            }
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for general
-     *        conversion exception
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_GeneralConversionException() {
-        final String[] flagMismatch = { "%#b", "%+b", "% b", "%0b", "%,b",
-                "%(b", "%#B", "%+B", "% B", "%0B", "%,B", "%(B", "%#h", "%+h",
-                "% h", "%0h", "%,h", "%(h", "%#H", "%+H", "% H", "%0H", "%,H",
-                "%(H", "%+s", "% s", "%0s", "%,s", "%(s", "%+S", "% S", "%0S",
-                "%,S", "%(S" };
-
-        Formatter f = new Formatter(Locale.US);
-
-        for (int i = 0; i < flagMismatch.length; i++) {
-            try {
-                f.format(flagMismatch[i], "something");
-                fail("should throw FormatFlagsConversionMismatchException");
-            } catch (FormatFlagsConversionMismatchException e) {
-                // expected
-            }
-        }
-
-        final String[] missingWidth = { "%-b", "%-B", "%-h", "%-H", "%-s",
-                "%-S", };
-        for (int i = 0; i < missingWidth.length; i++) {
-            try {
-                f.format(missingWidth[i], "something");
-                fail("should throw MissingFormatWidthException");
-            } catch (MissingFormatWidthException e) {
-                // expected
-            }
-        }
-
-        // Regression test
-        f = new Formatter();
-        try {
-            f.format("%c", (byte)-0x0001);
-            fail("Should throw IllegalFormatCodePointException");
-        } catch (IllegalFormatCodePointException e) {
-            // expected
-        }
-
-        f = new Formatter();
-        try {
-            f.format("%c", (short)-0x0001);
-            fail("Should throw IllegalFormatCodePointException");
-        } catch (IllegalFormatCodePointException e) {
-            // expected
-        }
-
-        f = new Formatter();
-        try {
-            f.format("%c", -0x0001);
-            fail("Should throw IllegalFormatCodePointException");
-        } catch (IllegalFormatCodePointException e) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for Character
-     *        conversion
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_CharacterConversion() {
-        Formatter f = new Formatter(Locale.US);
-        final Object[] illArgs = { Boolean.TRUE, new Float(1.1f),
-                new Double(1.1d), "string content", new Float(1.1f), new Date() };
-        for (int i = 0; i < illArgs.length; i++) {
-            try {
-                f.format("%c", illArgs[i]);
-                fail("should throw IllegalFormatConversionException");
-            } catch (IllegalFormatConversionException e) {
-                // expected
-            }
-        }
-
-        try {
-            f.format("%c", Integer.MAX_VALUE);
-            fail("should throw IllegalFormatCodePointException");
-        } catch (IllegalFormatCodePointException e) {
-            // expected
-        }
-
-        try {
-            f.format("%#c", 'c');
-            fail("should throw FormatFlagsConversionMismatchException");
-        } catch (FormatFlagsConversionMismatchException e) {
-            // expected
-        }
-
-        final Object[][] triple = {
-                {'c',               "%c",   "c"},
-                {'c',               "%-2c", "c "},
-                {'\u0123',          "%c",   "\u0123"},
-                {'\u0123',          "%-2c", "\u0123 "},
-                {(byte) 0x11,       "%c",   "\u0011"},
-                {(byte) 0x11,       "%-2c", "\u0011 "},
-                {(short) 0x1111,    "%c",   "\u1111"},
-                {(short) 0x1111,    "%-2c", "\u1111 "},
-                {0x11,              "%c",   "\u0011"},
-                {0x11,              "%-2c", "\u0011 "},
-        };
-
-        final int input   = 0;
-        final int pattern = 1;
-        final int output  = 2;
-        for (int i = 0; i < triple.length; i++) {
-                f = new Formatter(Locale.US);
-                f.format((String)triple[i][pattern], triple[i][input]);
-                assertEquals(triple[i][output], f.toString());
-        }
-
-        f = new Formatter(Locale.US);
-        f.format("%c", 0x10000);
-        assertEquals(0x10000, f.toString().codePointAt(0));
-
-        try {
-            f.format("%2.2c", 'c');
-            fail("should throw IllegalFormatPrecisionException");
-        } catch (IllegalFormatPrecisionException e) {
-            // expected
-        }
-
-        f = new Formatter(Locale.US);
-        f.format("%C", 'w');
-        // error on RI, throw UnknownFormatConversionException
-        // RI do not support converter 'C'
-        assertEquals("W", f.toString());
-
-        f = new Formatter(Locale.JAPAN);
-        f.format("%Ced", 0x1111);
-        // error on RI, throw UnknownFormatConversionException
-        // RI do not support converter 'C'
-        assertEquals("\u1111ed", f.toString());
-    }
-
-
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for legal
-     *        Byte/Short/Integer/Long conversion type 'd'
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_ByteShortIntegerLongConversionD() {
-        final Object[][] triple = {
-                { 0,                "%d",                  "0" },
-                { 0,                "%10d",       "         0" },
-                { 0,                "%-1d",                "0" },
-                { 0,                "%+d",                "+0" },
-                { 0,                "% d",                " 0" },
-                { 0,                "%,d",                 "0" },
-                { 0,                "%(d",                 "0" },
-                { 0,                "%08d",         "00000000" },
-                { 0,                "%-+,(11d",  "+0         " },
-                { 0,                "%0 ,(11d",  " 0000000000" },
-
-                { (byte) 0xff,      "%d",                 "-1" },
-                { (byte) 0xff,      "%10d",       "        -1" },
-                { (byte) 0xff,      "%-1d",               "-1" },
-                { (byte) 0xff,      "%+d",                "-1" },
-                { (byte) 0xff,      "% d",                "-1" },
-                { (byte) 0xff,      "%,d",                "-1" },
-                { (byte) 0xff,      "%(d",               "(1)" },
-                { (byte) 0xff,      "%08d",         "-0000001" },
-                { (byte) 0xff,      "%-+,(11d",  "(1)        " },
-                { (byte) 0xff,      "%0 ,(11d",  "(000000001)" },
-
-                { (short) 0xf123,   "%d",              "-3805" },
-                { (short) 0xf123,   "%10d",       "     -3805" },
-                { (short) 0xf123,   "%-1d",            "-3805" },
-                { (short) 0xf123,   "%+d",             "-3805" },
-                { (short) 0xf123,   "% d",             "-3805" },
-                { (short) 0xf123,   "%,d",            "-3.805" },
-                { (short) 0xf123,   "%(d",            "(3805)" },
-                { (short) 0xf123,   "%08d",         "-0003805" },
-                { (short) 0xf123,   "%-+,(11d",  "(3.805)    " },
-                { (short) 0xf123,   "%0 ,(11d",  "(00003.805)" },
-
-                {  0x123456,        "%d",            "1193046" },
-                {  0x123456,        "%10d",       "   1193046" },
-                {  0x123456,        "%-1d",          "1193046" },
-                {  0x123456,        "%+d",          "+1193046" },
-                {  0x123456,        "% d",          " 1193046" },
-                {  0x123456,        "%,d",         "1.193.046" },
-                {  0x123456,        "%(d",           "1193046" },
-                {  0x123456,        "%08d",         "01193046" },
-                {  0x123456,        "%-+,(11d",  "+1.193.046 " },
-                {  0x123456,        "%0 ,(11d",  " 01.193.046" },
-
-                { -3,               "%d",                 "-3" },
-                { -3,               "%10d",       "        -3" },
-                { -3,               "%-1d",               "-3" },
-                { -3,               "%+d",                "-3" },
-                { -3,               "% d",                "-3" },
-                { -3,               "%,d",                "-3" },
-                { -3,               "%(d",               "(3)" },
-                { -3,               "%08d",         "-0000003" },
-                { -3,               "%-+,(11d",  "(3)        " },
-                { -3,               "%0 ,(11d",  "(000000003)" },
-
-                { 0x7654321L,       "%d",          "124076833" },
-                { 0x7654321L,       "%10d",       " 124076833" },
-                { 0x7654321L,       "%-1d",        "124076833" },
-                { 0x7654321L,       "%+d",        "+124076833" },
-                { 0x7654321L,       "% d",        " 124076833" },
-                { 0x7654321L,       "%,d",       "124.076.833" },
-                { 0x7654321L,       "%(d",         "124076833" },
-                { 0x7654321L,       "%08d",        "124076833" },
-                { 0x7654321L,       "%-+,(11d", "+124.076.833" },
-                { 0x7654321L,       "%0 ,(11d", " 124.076.833" },
-
-                { -1L,              "%d",                 "-1" },
-                { -1L,              "%10d",       "        -1" },
-                { -1L,              "%-1d",               "-1" },
-                { -1L,              "%+d",                "-1" },
-                { -1L,              "% d",                "-1" },
-                { -1L,              "%,d",                "-1" },
-                { -1L,              "%(d",               "(1)" },
-                { -1L,              "%08d",         "-0000001" },
-                { -1L,              "%-+,(11d",  "(1)        " },
-                { -1L,              "%0 ,(11d",  "(000000001)" },
-                };
-
-        final int input = 0;
-        final int pattern = 1;
-        final int output = 2;
-        Formatter f;
-        for (int i = 0; i < triple.length; i++) {
-            f = new Formatter(Locale.GERMAN);
-            f.format((String) triple[i][pattern],
-                    triple[i][input]);
-            assertEquals("triple[" + i + "]:" + triple[i][input] + ",pattern["
-                    + i + "]:" + triple[i][pattern], triple[i][output], f
-                    .toString());
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for legal
-     *        Byte/Short/Integer/Long conversion type 'o'
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_ByteShortIntegerLongConversionO() {
-        final Object[][] triple = {
-                { 0,                "%o",                 "0" },
-                { 0,                "%-6o",          "0     " },
-                { 0,                "%08o",        "00000000" },
-                { 0,                "%#o",               "00" },
-                { 0,                "%0#11o",   "00000000000" },
-                { 0,                "%-#9o",      "00       " },
-
-                { (byte) 0xff,      "%o",               "377" },
-                { (byte) 0xff,      "%-6o",          "377   " },
-                { (byte) 0xff,      "%08o",        "00000377" },
-                { (byte) 0xff,      "%#o",             "0377" },
-                { (byte) 0xff,      "%0#11o",   "00000000377" },
-                { (byte) 0xff,      "%-#9o",      "0377     " },
-
-                { (short) 0xf123,   "%o",            "170443" },
-                { (short) 0xf123,   "%-6o",          "170443" },
-                { (short) 0xf123,   "%08o",        "00170443" },
-                { (short) 0xf123,   "%#o",          "0170443" },
-                { (short) 0xf123,   "%0#11o",   "00000170443" },
-                { (short) 0xf123,   "%-#9o",      "0170443  " },
-
-                {  0x123456,        "%o",           "4432126" },
-                {  0x123456,        "%-6o",         "4432126" },
-                {  0x123456,        "%08o",        "04432126" },
-                {  0x123456,        "%#o",         "04432126" },
-                {  0x123456,        "%0#11o",   "00004432126" },
-                {  0x123456,        "%-#9o",      "04432126 " },
-
-                { -3,               "%o",       "37777777775" },
-                { -3,               "%-6o",     "37777777775" },
-                { -3,               "%08o",     "37777777775" },
-                { -3,               "%#o",     "037777777775" },
-                { -3,               "%0#11o",  "037777777775" },
-                { -3,               "%-#9o",   "037777777775" },
-
-                { 0x7654321L,       "%o",          "731241441" },
-                { 0x7654321L,       "%-6o",        "731241441" },
-                { 0x7654321L,       "%08o",        "731241441" },
-                { 0x7654321L,       "%#o",        "0731241441" },
-                { 0x7654321L,       "%0#11o",    "00731241441" },
-                { 0x7654321L,       "%-#9o",      "0731241441" },
-
-                { -1L,              "%o",       "1777777777777777777777" },
-                { -1L,              "%-6o",     "1777777777777777777777" },
-                { -1L,              "%08o",     "1777777777777777777777" },
-                { -1L,              "%#o",     "01777777777777777777777" },
-                { -1L,              "%0#11o",  "01777777777777777777777" },
-                { -1L,              "%-#9o",   "01777777777777777777777" },
-                };
-
-        final int input = 0;
-        final int pattern = 1;
-        final int output = 2;
-        Formatter f;
-        for (int i = 0; i < triple.length; i++) {
-            f = new Formatter(Locale.ITALY);
-            f.format((String) triple[i][pattern],
-                    triple[i][input]);
-            assertEquals("triple[" + i + "]:" + triple[i][input] + ",pattern["
-                    + i + "]:" + triple[i][pattern], triple[i][output], f
-                    .toString());
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for legal
-     *        Byte/Short/Integer/Long conversion type 'x' and 'X'
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_ByteShortIntegerLongConversionX() {
-        final Object[][] triple = {
-                { 0,                "%x",                 "0" },
-                { 0,                "%-8x",        "0       " },
-                { 0,                "%06x",          "000000" },
-                { 0,                "%#x",              "0x0" },
-                { 0,                "%0#12x",  "0x0000000000" },
-                { 0,                "%-#9x",      "0x0      " },
-
-                { (byte) 0xff,      "%x",                "ff" },
-                { (byte) 0xff,      "%-8x",        "ff      " },
-                { (byte) 0xff,      "%06x",          "0000ff" },
-                { (byte) 0xff,      "%#x",             "0xff" },
-                { (byte) 0xff,      "%0#12x",  "0x00000000ff" },
-                { (byte) 0xff,      "%-#9x",      "0xff     " },
-
-                { (short) 0xf123,   "%x",              "f123" },
-                { (short) 0xf123,   "%-8x",        "f123    " },
-                { (short) 0xf123,   "%06x",          "00f123" },
-                { (short) 0xf123,   "%#x",           "0xf123" },
-                { (short) 0xf123,   "%0#12x",  "0x000000f123" },
-                { (short) 0xf123,   "%-#9x",      "0xf123   " },
-
-                {  0x123456,        "%x",            "123456" },
-                {  0x123456,        "%-8x",        "123456  " },
-                {  0x123456,        "%06x",          "123456" },
-                {  0x123456,        "%#x",         "0x123456" },
-                {  0x123456,        "%0#12x",  "0x0000123456" },
-                {  0x123456,        "%-#9x",      "0x123456 " },
-
-                { -3,               "%x",          "fffffffd" },
-                { -3,               "%-8x",        "fffffffd" },
-                { -3,               "%06x",        "fffffffd" },
-                { -3,               "%#x",       "0xfffffffd" },
-                { -3,               "%0#12x",  "0x00fffffffd" },
-                { -3,               "%-#9x",     "0xfffffffd" },
-
-                { 0x7654321L,       "%x",          "7654321" },
-                { 0x7654321L,       "%-8x",       "7654321 " },
-                { 0x7654321L,       "%06x",        "7654321" },
-                { 0x7654321L,       "%#x",       "0x7654321" },
-                { 0x7654321L,       "%0#12x", "0x0007654321" },
-                { 0x7654321L,       "%-#9x",     "0x7654321" },
-
-                { -1L,              "%x",       "ffffffffffffffff" },
-                { -1L,              "%-8x",     "ffffffffffffffff" },
-                { -1L,              "%06x",     "ffffffffffffffff" },
-                { -1L,              "%#x",    "0xffffffffffffffff" },
-                { -1L,              "%0#12x", "0xffffffffffffffff" },
-                { -1L,              "%-#9x",  "0xffffffffffffffff" },
-                };
-
-        final int input = 0;
-        final int pattern = 1;
-        final int output = 2;
-        Formatter f;
-        for (int i = 0; i < triple.length; i++) {
-            f = new Formatter(Locale.FRANCE);
-            f.format((String) triple[i][pattern],
-                    triple[i][input]);
-            assertEquals("triple[" + i + "]:" + triple[i][input] + ",pattern["
-                    + i + "]:" + triple[i][pattern], triple[i][output], f
-                    .toString());
-
-            f = new Formatter(Locale.FRANCE);
-            f.format((String) triple[i][pattern],
-                    triple[i][input]);
-            assertEquals("triple[" + i + "]:" + triple[i][input] + ",pattern["
-                    + i + "]:" + triple[i][pattern], triple[i][output], f
-                    .toString());
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for Date/Time
-     *        conversion
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_DateTimeConversion() {
-        Formatter f = null;
-        Date now = new Date(1147327147578L);
-
-        Calendar paris = Calendar.getInstance(TimeZone
-                .getTimeZone("Europe/Paris"), Locale.FRANCE);
-        paris.set(2006, 4, 8, 12, 0, 0);
-        paris.set(Calendar.MILLISECOND, 453);
-        Calendar china = Calendar.getInstance(
-                TimeZone.getTimeZone("GMT-08:00"), Locale.CHINA);
-        china.set(2006, 4, 8, 12, 0, 0);
-        china.set(Calendar.MILLISECOND, 609);
-
-        final Object[][] lowerCaseGermanTriple = {
-                {0L,                        'a', "Do."},
-                {Long.MAX_VALUE,            'a', "So."},
-                {-1000L,                    'a', "Do."},
-                {new Date(1147327147578L),  'a', "Do."},
-                {paris,                     'a', "Mo."},
-                {china,                     'a', "Mo."},
-                {0L,                        'b', "Jan"},
-                {Long.MAX_VALUE,            'b', "Aug"},
-                {-1000L,                    'b', "Jan"},
-                {new Date(1147327147578L),  'b', "Mai"},
-                {paris,                     'b', "Mai"},
-                {china,                     'b', "Mai"},
-                {0L,                        'c', "Do. Jan 01 08:00:00 GMT+08:00 1970"},
-                {Long.MAX_VALUE,            'c', "So. Aug 17 15:18:47 GMT+08:00 292278994"},
-                {-1000L,                    'c', "Do. Jan 01 07:59:59 GMT+08:00 1970"},
-                {new Date(1147327147578L),  'c', "Do. Mai 11 13:59:07 GMT+08:00 2006"},
-                {paris,                     'c', "Mo. Mai 08 12:00:00 MESZ 2006"},
-                {china,                     'c', "Mo. Mai 08 12:00:00 GMT-08:00 2006"},
-                {0L,                        'd', "01"},
-                {Long.MAX_VALUE,            'd', "17"},
-                {-1000L,                    'd', "01"},
-                {new Date(1147327147578L),  'd', "11"},
-                {paris,                     'd', "08"},
-                {china,                     'd', "08"},
-                {0L,                        'e', "1"},
-                {Long.MAX_VALUE,            'e', "17"},
-                {-1000L,                    'e', "1"},
-                {new Date(1147327147578L),  'e', "11"},
-                {paris,                     'e', "8"},
-                {china,                     'e', "8"},
-                {0L,                        'h', "Jan"},
-                {Long.MAX_VALUE,            'h', "Aug"},
-                {-1000L,                    'h', "Jan"},
-                {new Date(1147327147578L),  'h', "Mai"},
-                {paris,                     'h', "Mai"},
-                {china,                     'h', "Mai"},
-                {0L,                        'j', "001"},
-                {Long.MAX_VALUE,            'j', "229"},
-                {-1000L,                    'j', "001"},
-                {new Date(1147327147578L),  'j', "131"},
-                {paris,                     'j', "128"},
-                {china,                     'j', "128"},
-                {0L,                        'k', "8"},
-                {Long.MAX_VALUE,            'k', "15"},
-                {-1000L,                    'k', "7"},
-                {new Date(1147327147578L),  'k', "13"},
-                {paris,                     'k', "12"},
-                {china,                     'k', "12"},
-                {0L,                        'l', "8"},
-                {Long.MAX_VALUE,            'l', "3"},
-                {-1000L,                    'l', "7"},
-                {new Date(1147327147578L),  'l', "1"},
-                {paris,                     'l', "12"},
-                {china,                     'l', "12"},
-                {0L,                        'm', "01"},
-                {Long.MAX_VALUE,            'm', "08"},
-                {-1000L,                    'm', "01"},
-                {new Date(1147327147578L),  'm', "05"},
-                {paris,                     'm', "05"},
-                {china,                     'm', "05"},
-                {0L,                        'p', "vorm."},
-                {Long.MAX_VALUE,            'p', "nachm."},
-                {-1000L,                    'p', "vorm."},
-                {new Date(1147327147578L),  'p', "nachm."},
-                {paris,                     'p', "nachm."},
-                {china,                     'p', "nachm."},
-                {0L,                        'r', "08:00:00 vorm."},
-                {Long.MAX_VALUE,            'r', "03:18:47 nachm."},
-                {-1000L,                    'r', "07:59:59 vorm."},
-                {new Date(1147327147578L),  'r', "01:59:07 nachm."},
-                {paris,                     'r', "12:00:00 nachm."},
-                {china,                     'r', "12:00:00 nachm."},
-                {0L,                        's', "0"},
-                {Long.MAX_VALUE,            's', "9223372036854775"},
-                {-1000L,                    's', "-1"},
-                {new Date(1147327147578L),  's', "1147327147"},
-                {paris,                     's', "1147082400"},
-                {china,                     's', "1147118400"},
-                {0L,                        'y', "70"},
-                {Long.MAX_VALUE,            'y', "94"},
-                {-1000L,                    'y', "70"},
-                {new Date(1147327147578L),  'y', "06"},
-                {paris,                     'y', "06"},
-                {china,                     'y', "06"},
-                {0L,                        'z', "+0800"},
-                {Long.MAX_VALUE,            'z', "+0800"},
-                {-1000L,                    'z', "+0800"},
-                {new Date(1147327147578L),  'z', "+0800"},
-                {paris,                     'z', "+0100"},
-                {china,                     'z', "-0800"},
-
-        };
-
-        final Object[][] lowerCaseFranceTriple = {
-                {0L,                        'a', "jeu."},
-                {Long.MAX_VALUE,            'a', "dim."},
-                {-1000L,                    'a', "jeu."},
-                {new Date(1147327147578L),  'a', "jeu."},
-                {paris,                     'a', "lun."},
-                {china,                     'a', "lun."},
-                {0L,                        'b', "janv."},
-                {Long.MAX_VALUE,            'b', "ao\u00fbt"},
-                {-1000L,                    'b', "janv."},
-                {new Date(1147327147578L),  'b', "mai"},
-                {paris,                     'b', "mai"},
-                {china,                     'b', "mai"},
-                {0L,                        'c', "jeu. janv. 01 08:00:00 UTC+08:00 1970"},
-                {Long.MAX_VALUE,            'c', "dim. ao\u00fbt 17 15:18:47 UTC+08:00 292278994"},
-                {-1000L,                    'c', "jeu. janv. 01 07:59:59 UTC+08:00 1970"},
-                {new Date(1147327147578L),  'c', "jeu. mai 11 13:59:07 UTC+08:00 2006"},
-                {paris,                     'c', "lun. mai 08 12:00:00 HAEC 2006"},
-                {china,                     'c', "lun. mai 08 12:00:00 UTC-08:00 2006"},
-                {0L,                        'd', "01"},
-                {Long.MAX_VALUE,            'd', "17"},
-                {-1000L,                    'd', "01"},
-                {new Date(1147327147578L),  'd', "11"},
-                {paris,                     'd', "08"},
-                {china,                     'd', "08"},
-                {0L,                        'e', "1"},
-                {Long.MAX_VALUE,            'e', "17"},
-                {-1000L,                    'e', "1"},
-                {new Date(1147327147578L),  'e', "11"},
-                {paris,                     'e', "8"},
-                {china,                     'e', "8"},
-                {0L,                        'h', "janv."},
-                {Long.MAX_VALUE,            'h', "ao\u00fbt"},
-                {-1000L,                    'h', "janv."},
-                {new Date(1147327147578L),  'h', "mai"},
-                {paris,                     'h', "mai"},
-                {china,                     'h', "mai"},
-                {0L,                        'j', "001"},
-                {Long.MAX_VALUE,            'j', "229"},
-                {-1000L,                    'j', "001"},
-                {new Date(1147327147578L),  'j', "131"},
-                {paris,                     'j', "128"},
-                {china,                     'j', "128"},
-                {0L,                        'k', "8"},
-                {Long.MAX_VALUE,            'k', "15"},
-                {-1000L,                    'k', "7"},
-                {new Date(1147327147578L),  'k', "13"},
-                {paris,                     'k', "12"},
-                {china,                     'k', "12"},
-                {0L,                        'l', "8"},
-                {Long.MAX_VALUE,            'l', "3"},
-                {-1000L,                    'l', "7"},
-                {new Date(1147327147578L),  'l', "1"},
-                {paris,                     'l', "12"},
-                {china,                     'l', "12"},
-                {0L,                        'm', "01"},
-                {Long.MAX_VALUE,            'm', "08"},
-                {-1000L,                    'm', "01"},
-                {new Date(1147327147578L),  'm', "05"},
-                {paris,                     'm', "05"},
-                {china,                     'm', "05"},
-                {0L,                        'p', "am"},
-                {Long.MAX_VALUE,            'p', "pm"},
-                {-1000L,                    'p', "am"},
-                {new Date(1147327147578L),  'p', "pm"},
-                {paris,                     'p', "pm"},
-                {china,                     'p', "pm"},
-                {0L,                        'r', "08:00:00 AM"},
-                {Long.MAX_VALUE,            'r', "03:18:47 PM"},
-                {-1000L,                    'r', "07:59:59 AM"},
-                {new Date(1147327147578L),  'r', "01:59:07 PM"},
-                {paris,                     'r', "12:00:00 PM"},
-                {china,                     'r', "12:00:00 PM"},
-                {0L,                        's', "0"},
-                {Long.MAX_VALUE,            's', "9223372036854775"},
-                {-1000L,                    's', "-1"},
-                {new Date(1147327147578L),  's', "1147327147"},
-                {paris,                     's', "1147082400"},
-                {china,                     's', "1147118400"},
-                {0L,                        'y', "70"},
-                {Long.MAX_VALUE,            'y', "94"},
-                {-1000L,                    'y', "70"},
-                {new Date(1147327147578L),  'y', "06"},
-                {paris,                     'y', "06"},
-                {china,                     'y', "06"},
-                {0L,                        'z', "+0800"},
-                {Long.MAX_VALUE,            'z', "+0800"},
-                {-1000L,                    'z', "+0800"},
-                {new Date(1147327147578L),  'z', "+0800"},
-                {paris,                     'z', "+0100"},
-                {china,                     'z', "-0800"},
-
-        };
-
-        final Object[][] lowerCaseJapanTriple = {
-                {0L,                        'a', "\u6728"},
-                {Long.MAX_VALUE,            'a', "\u65e5"},
-                {-1000L,                    'a', "\u6728"},
-                {new Date(1147327147578L),  'a', "\u6728"},
-                {paris,                     'a', "\u6708"},
-                {china,                     'a', "\u6708"},
-                {0L,                        'b', "1\u6708"},
-                {Long.MAX_VALUE,            'b', "8\u6708"},
-                {-1000L,                    'b', "1\u6708"},
-                {new Date(1147327147578L),  'b', "5\u6708"},
-                {paris,                     'b', "5\u6708"},
-                {china,                     'b', "5\u6708"},
-                {0L,                        'c', "\u6728 1\u6708 01 08:00:00 GMT+08:00 1970"},
-                {Long.MAX_VALUE,            'c', "\u65e5 8\u6708 17 15:18:47 GMT+08:00 292278994"},
-                {-1000L,                    'c', "\u6728 1\u6708 01 07:59:59 GMT+08:00 1970"},
-                {new Date(1147327147578L),  'c', "\u6728 5\u6708 11 13:59:07 GMT+08:00 2006"},
-                {paris,                     'c', "\u6708 5\u6708 08 12:00:00 GMT+02:00 2006"},
-                {china,                     'c', "\u6708 5\u6708 08 12:00:00 GMT-08:00 2006"},
-                {0L,                        'd', "01"},
-                {Long.MAX_VALUE,            'd', "17"},
-                {-1000L,                    'd', "01"},
-                {new Date(1147327147578L),  'd', "11"},
-                {paris,                     'd', "08"},
-                {china,                     'd', "08"},
-                {0L,                        'e', "1"},
-                {Long.MAX_VALUE,            'e', "17"},
-                {-1000L,                    'e', "1"},
-                {new Date(1147327147578L),  'e', "11"},
-                {paris,                     'e', "8"},
-                {china,                     'e', "8"},
-                {0L,                        'h', "1\u6708"},
-                {Long.MAX_VALUE,            'h', "8\u6708"},
-                {-1000L,                    'h', "1\u6708"},
-                {new Date(1147327147578L),  'h', "5\u6708"},
-                {paris,                     'h', "5\u6708"},
-                {china,                     'h', "5\u6708"},
-                {0L,                        'j', "001"},
-                {Long.MAX_VALUE,            'j', "229"},
-                {-1000L,                    'j', "001"},
-                {new Date(1147327147578L),  'j', "131"},
-                {paris,                     'j', "128"},
-                {china,                     'j', "128"},
-                {0L,                        'k', "8"},
-                {Long.MAX_VALUE,            'k', "15"},
-                {-1000L,                    'k', "7"},
-                {new Date(1147327147578L),  'k', "13"},
-                {paris,                     'k', "12"},
-                {china,                     'k', "12"},
-                {0L,                        'l', "8"},
-                {Long.MAX_VALUE,            'l', "3"},
-                {-1000L,                    'l', "7"},
-                {new Date(1147327147578L),  'l', "1"},
-                {paris,                     'l', "12"},
-                {china,                     'l', "12"},
-                {0L,                        'm', "01"},
-                {Long.MAX_VALUE,            'm', "08"},
-                {-1000L,                    'm', "01"},
-                {new Date(1147327147578L),  'm', "05"},
-                {paris,                     'm', "05"},
-                {china,                     'm', "05"},
-                {0L,                        'p', "\u5348\u524d"},
-                {Long.MAX_VALUE,            'p', "\u5348\u5f8c"},
-                {-1000L,                    'p', "\u5348\u524d"},
-                {new Date(1147327147578L),  'p', "\u5348\u5f8c"},
-                {paris,                     'p', "\u5348\u5f8c"},
-                {china,                     'p', "\u5348\u5f8c"},
-                {0L,                        'r', "08:00:00 \u5348\u524d"},
-                {Long.MAX_VALUE,            'r', "03:18:47 \u5348\u5f8c"},
-                {-1000L,                    'r', "07:59:59 \u5348\u524d"},
-                {new Date(1147327147578L),  'r', "01:59:07 \u5348\u5f8c"},
-                {paris,                     'r', "12:00:00 \u5348\u5f8c"},
-                {china,                     'r', "12:00:00 \u5348\u5f8c"},
-                {0L,                        's', "0"},
-                {Long.MAX_VALUE,            's', "9223372036854775"},
-                {-1000L,                    's', "-1"},
-                {new Date(1147327147578L),  's', "1147327147"},
-                {paris,                     's', "1147082400"},
-                {china,                     's', "1147118400"},
-                {0L,                        'y', "70"},
-                {Long.MAX_VALUE,            'y', "94"},
-                {-1000L,                    'y', "70"},
-                {new Date(1147327147578L),  'y', "06"},
-                {paris,                     'y', "06"},
-                {china,                     'y', "06"},
-                {0L,                        'z', "+0800"},
-                {Long.MAX_VALUE,            'z', "+0800"},
-                {-1000L,                    'z', "+0800"},
-                {new Date(1147327147578L),  'z', "+0800"},
-                {paris,                     'z', "+0100"},
-                {china,                     'z', "-0800"},
-        };
-
-        final int input   = 0;
-        final int pattern = 1;
-        final int output  = 2;
-        for (int i = 0; i < 90; i++) {
-            // go through legal conversion
-            String formatSpecifier = "%t" + lowerCaseGermanTriple[i][pattern];
-            String formatSpecifierUpper = "%T" + lowerCaseGermanTriple[i][pattern];
-            // test '%t'
-            f = new Formatter(Locale.GERMAN);
-            f.format(formatSpecifier, lowerCaseGermanTriple[i][input]);
-            assertEquals("Format pattern: " + formatSpecifier
-                            + " Argument: " + lowerCaseGermanTriple[i][input],
-                            lowerCaseGermanTriple[i][output], f.toString());
-
-            f = new Formatter(Locale.GERMAN);
-            f.format(Locale.FRANCE, formatSpecifier, lowerCaseFranceTriple[i][input]);
-            assertEquals("Format pattern: " + formatSpecifier
-                            + " Argument: " + lowerCaseFranceTriple[i][input],
-                            lowerCaseFranceTriple[i][output], f.toString());
-
-            f = new Formatter(Locale.GERMAN);
-            f.format(Locale.JAPAN, formatSpecifier, lowerCaseJapanTriple[i][input]);
-            assertEquals("Format pattern: " + formatSpecifier
-                            + " Argument: " + lowerCaseJapanTriple[i][input],
-                            lowerCaseJapanTriple[i][output], f.toString());
-
-            // test '%T'
-            f = new Formatter(Locale.GERMAN);
-            f.format(formatSpecifierUpper, lowerCaseGermanTriple[i][input]);
-            assertEquals("Format pattern: " + formatSpecifierUpper
-                            + " Argument: " + lowerCaseGermanTriple[i][input],
-                            ((String)lowerCaseGermanTriple[i][output])
-                                    .toUpperCase(Locale.US), f.toString());
-
-            f = new Formatter(Locale.GERMAN);
-            f.format(Locale.FRANCE, formatSpecifierUpper, lowerCaseFranceTriple[i][input]);
-            assertEquals("Format pattern: " + formatSpecifierUpper
-                            + " Argument: " + lowerCaseFranceTriple[i][input],
-                            ((String)lowerCaseFranceTriple[i][output])
-                                    .toUpperCase(Locale.US), f.toString());
-
-            f = new Formatter(Locale.GERMAN);
-            f.format(Locale.JAPAN, formatSpecifierUpper, lowerCaseJapanTriple[i][input]);
-            assertEquals("Format pattern: " + formatSpecifierUpper
-                            + " Argument: " + lowerCaseJapanTriple[i][input],
-                            ((String)lowerCaseJapanTriple[i][output])
-                                    .toUpperCase(Locale.US), f.toString());
-        }
-
-        final Object[][] upperCaseGermanTriple = {
-                {0L,                        'A', "Donnerstag"},
-                {Long.MAX_VALUE,            'A', "Sonntag"},
-                {-1000L,                    'A', "Donnerstag"},
-                {new Date(1147327147578L),  'A', "Donnerstag"},
-                {paris,                     'A', "Montag"},
-                {china,                     'A', "Montag"},
-                {0L,                        'B', "Januar"},
-                {Long.MAX_VALUE,            'B', "August"},
-                {-1000L,                    'B', "Januar"},
-                {new Date(1147327147578L),  'B', "Mai"},
-                {paris,                     'B', "Mai"},
-                {china,                     'B', "Mai"},
-                {0L,                        'C', "19"},
-                {Long.MAX_VALUE,            'C', "2922789"},
-                {-1000L,                    'C', "19"},
-                {new Date(1147327147578L),  'C', "20"},
-                {paris,                     'C', "20"},
-                {china,                     'C', "20"},
-                {0L,                        'D', "01/01/70"},
-                {Long.MAX_VALUE,            'D', "08/17/94"},
-                {-1000L,                    'D', "01/01/70"},
-                {new Date(1147327147578L),  'D', "05/11/06"},
-                {paris,                     'D', "05/08/06"},
-                {china,                     'D', "05/08/06"},
-                {0L,                        'F', "1970-01-01"},
-                {Long.MAX_VALUE,            'F', "292278994-08-17"},
-                {-1000L,                    'F', "1970-01-01"},
-                {new Date(1147327147578L),  'F', "2006-05-11"},
-                {paris,                     'F', "2006-05-08"},
-                {china,                     'F', "2006-05-08"},
-                {0L,                        'H', "08"},
-                {Long.MAX_VALUE,            'H', "15"},
-                {-1000L,                    'H', "07"},
-                {new Date(1147327147578L),  'H', "13"},
-                {paris,                     'H', "12"},
-                {china,                     'H', "12"},
-                {0L,                        'I', "08"},
-                {Long.MAX_VALUE,            'I', "03"},
-                {-1000L,                    'I', "07"},
-                {new Date(1147327147578L),  'I', "01"},
-                {paris,                     'I', "12"},
-                {china,                     'I', "12"},
-                {0L,                        'L', "000"},
-                {Long.MAX_VALUE,            'L', "807"},
-                {-1000L,                    'L', "000"},
-                {new Date(1147327147578L),  'L', "578"},
-                {paris,                     'L', "453"},
-                {china,                     'L', "609"},
-                {0L,                        'M', "00"},
-                {Long.MAX_VALUE,            'M', "18"},
-                {-1000L,                    'M', "59"},
-                {new Date(1147327147578L),  'M', "59"},
-                {paris,                     'M', "00"},
-                {china,                     'M', "00"},
-                {0L,                        'N', "000000000"},
-                {Long.MAX_VALUE,            'N', "807000000"},
-                {-1000L,                    'N', "000000000"},
-                {new Date(1147327147578L),  'N', "578000000"},
-                {paris,                     'N', "609000000"},
-                {china,                     'N', "609000000"},
-                {0L,                        'Q', "0"},
-                {Long.MAX_VALUE,            'Q', "9223372036854775807"},
-                {-1000L,                    'Q', "-1000"},
-                {new Date(1147327147578L),  'Q', "1147327147578"},
-                {paris,                     'Q', "1147082400453"},
-                {china,                     'Q', "1147118400609"},
-                {0L,                        'R', "08:00"},
-                {Long.MAX_VALUE,            'R', "15:18"},
-                {-1000L,                    'R', "07:59"},
-                {new Date(1147327147578L),  'R', "13:59"},
-                {paris,                     'R', "12:00"},
-                {china,                     'R', "12:00"},
-                {0L,                        'S', "00"},
-                {Long.MAX_VALUE,            'S', "47"},
-                {-1000L,                    'S', "59"},
-                {new Date(1147327147578L),  'S', "07"},
-                {paris,                     'S', "00"},
-                {china,                     'S', "00"},
-                {0L,                        'T', "08:00:00"},
-                {Long.MAX_VALUE,            'T', "15:18:47"},
-                {-1000L,                    'T', "07:59:59"},
-                {new Date(1147327147578L),  'T', "13:59:07"},
-                {paris,                     'T', "12:00:00"},
-                {china,                     'T', "12:00:00"},
-                {0L,                        'Y', "1970"},
-                {Long.MAX_VALUE,            'Y', "292278994"},
-                {-1000L,                    'Y', "1970"},
-                {new Date(1147327147578L),  'Y', "2006"},
-                {paris,                     'Y', "2006"},
-                {china,                     'Y', "2006"},
-                {0L,                        'Z', "CST"},
-                {Long.MAX_VALUE,            'Z', "CST"},
-                {-1000L,                    'Z', "CST"},
-                {new Date(1147327147578L),  'Z', "CST"},
-                {paris,                     'Z', "CEST"},
-                {china,                     'Z', "GMT-08:00"},
-
-        };
-
-        final Object[][] upperCaseFranceTriple = {
-                {0L,                        'A', "jeudi"},
-                {Long.MAX_VALUE,            'A', "dimanche"},
-                {-1000L,                    'A', "jeudi"},
-                {new Date(1147327147578L),  'A', "jeudi"},
-                {paris,                     'A', "lundi"},
-                {china,                     'A', "lundi"},
-                {0L,                        'B', "janvier"},
-                {Long.MAX_VALUE,            'B', "ao\u00fbt"},
-                {-1000L,                    'B', "janvier"},
-                {new Date(1147327147578L),  'B', "mai"},
-                {paris,                     'B', "mai"},
-                {china,                     'B', "mai"},
-                {0L,                        'C', "19"},
-                {Long.MAX_VALUE,            'C', "2922789"},
-                {-1000L,                    'C', "19"},
-                {new Date(1147327147578L),  'C', "20"},
-                {paris,                     'C', "20"},
-                {china,                     'C', "20"},
-                {0L,                        'D', "01/01/70"},
-                {Long.MAX_VALUE,            'D', "08/17/94"},
-                {-1000L,                    'D', "01/01/70"},
-                {new Date(1147327147578L),  'D', "05/11/06"},
-                {paris,                     'D', "05/08/06"},
-                {china,                     'D', "05/08/06"},
-                {0L,                        'F', "1970-01-01"},
-                {Long.MAX_VALUE,            'F', "292278994-08-17"},
-                {-1000L,                    'F', "1970-01-01"},
-                {new Date(1147327147578L),  'F', "2006-05-11"},
-                {paris,                     'F', "2006-05-08"},
-                {china,                     'F', "2006-05-08"},
-                {0L,                        'H', "08"},
-                {Long.MAX_VALUE,            'H', "15"},
-                {-1000L,                    'H', "07"},
-                {new Date(1147327147578L),  'H', "13"},
-                {paris,                     'H', "12"},
-                {china,                     'H', "12"},
-                {0L,                        'I', "08"},
-                {Long.MAX_VALUE,            'I', "03"},
-                {-1000L,                    'I', "07"},
-                {new Date(1147327147578L),  'I', "01"},
-                {paris,                     'I', "12"},
-                {china,                     'I', "12"},
-                {0L,                        'L', "000"},
-                {Long.MAX_VALUE,            'L', "807"},
-                {-1000L,                    'L', "000"},
-                {new Date(1147327147578L),  'L', "578"},
-                {paris,                     'L', "453"},
-                {china,                     'L', "609"},
-                {0L,                        'M', "00"},
-                {Long.MAX_VALUE,            'M', "18"},
-                {-1000L,                    'M', "59"},
-                {new Date(1147327147578L),  'M', "59"},
-                {paris,                     'M', "00"},
-                {china,                     'M', "00"},
-                {0L,                        'N', "000000000"},
-                {Long.MAX_VALUE,            'N', "807000000"},
-                {-1000L,                    'N', "000000000"},
-                {new Date(1147327147578L),  'N', "578000000"},
-                {paris,                     'N', "453000000"},
-                {china,                     'N', "468000000"},
-                {0L,                        'Q', "0"},
-                {Long.MAX_VALUE,            'Q', "9223372036854775807"},
-                {-1000L,                    'Q', "-1000"},
-                {new Date(1147327147578L),  'Q', "1147327147578"},
-                {paris,                     'Q', "1147082400453"},
-                {china,                     'Q', "1147118400609"},
-                {0L,                        'R', "08:00"},
-                {Long.MAX_VALUE,            'R', "15:18"},
-                {-1000L,                    'R', "07:59"},
-                {new Date(1147327147578L),  'R', "13:59"},
-                {paris,                     'R', "12:00"},
-                {china,                     'R', "12:00"},
-                {0L,                        'S', "00"},
-                {Long.MAX_VALUE,            'S', "47"},
-                {-1000L,                    'S', "59"},
-                {new Date(1147327147578L),  'S', "07"},
-                {paris,                     'S', "00"},
-                {china,                     'S', "00"},
-                {0L,                        'T', "08:00:00"},
-                {Long.MAX_VALUE,            'T', "15:18:47"},
-                {-1000L,                    'T', "07:59:59"},
-                {new Date(1147327147578L),  'T', "13:59:07"},
-                {paris,                     'T', "12:00:00"},
-                {china,                     'T', "12:00:00"},
-                {0L,                        'Y', "1970"},
-                {Long.MAX_VALUE,            'Y', "292278994"},
-                {-1000L,                    'Y', "1970"},
-                {new Date(1147327147578L),  'Y', "2006"},
-                {paris,                     'Y', "2006"},
-                {china,                     'Y', "2006"},
-                {0L,                        'Z', "CST"},
-                {Long.MAX_VALUE,            'Z', "CST"},
-                {-1000L,                    'Z', "CST"},
-                {new Date(1147327147578L),  'Z', "CST"},
-                {paris,                     'Z', "CEST"},
-                {china,                     'Z', "GMT-08:00"},
-
-        };
-
-        final Object[][] upperCaseJapanTriple = {
-                {0L,                        'A', "\u6728\u66dc\u65e5"},
-                {Long.MAX_VALUE,            'A', "\u65e5\u66dc\u65e5"},
-                {-1000L,                    'A', "\u6728\u66dc\u65e5"},
-                {new Date(1147327147578L),  'A', "\u6728\u66dc\u65e5"},
-                {paris,                     'A', "\u6708\u66dc\u65e5"},
-                {china,                     'A', "\u6708\u66dc\u65e5"},
-                {0L,                        'B', "1\u6708"},
-                {Long.MAX_VALUE,            'B', "8\u6708"},
-                {-1000L,                    'B', "1\u6708"},
-                {new Date(1147327147578L),  'B', "5\u6708"},
-                {paris,                     'B', "5\u6708"},
-                {china,                     'B', "5\u6708"},
-                {0L,                        'C', "19"},
-                {Long.MAX_VALUE,            'C', "2922789"},
-                {-1000L,                    'C', "19"},
-                {new Date(1147327147578L),  'C', "20"},
-                {paris,                     'C', "20"},
-                {china,                     'C', "20"},
-                {0L,                        'D', "01/01/70"},
-                {Long.MAX_VALUE,            'D', "08/17/94"},
-                {-1000L,                    'D', "01/01/70"},
-                {new Date(1147327147578L),  'D', "05/11/06"},
-                {paris,                     'D', "05/08/06"},
-                {china,                     'D', "05/08/06"},
-                {0L,                        'F', "1970-01-01"},
-                {Long.MAX_VALUE,            'F', "292278994-08-17"},
-                {-1000L,                    'F', "1970-01-01"},
-                {new Date(1147327147578L),  'F', "2006-05-11"},
-                {paris,                     'F', "2006-05-08"},
-                {china,                     'F', "2006-05-08"},
-                {0L,                        'H', "08"},
-                {Long.MAX_VALUE,            'H', "15"},
-                {-1000L,                    'H', "07"},
-                {new Date(1147327147578L),  'H', "13"},
-                {paris,                     'H', "12"},
-                {china,                     'H', "12"},
-                {0L,                        'I', "08"},
-                {Long.MAX_VALUE,            'I', "03"},
-                {-1000L,                    'I', "07"},
-                {new Date(1147327147578L),  'I', "01"},
-                {paris,                     'I', "12"},
-                {china,                     'I', "12"},
-                {0L,                        'L', "000"},
-                {Long.MAX_VALUE,            'L', "807"},
-                {-1000L,                    'L', "000"},
-                {new Date(1147327147578L),  'L', "578"},
-                {paris,                     'L', "453"},
-                {china,                     'L', "609"},
-                {0L,                        'M', "00"},
-                {Long.MAX_VALUE,            'M', "18"},
-                {-1000L,                    'M', "59"},
-                {new Date(1147327147578L),  'M', "59"},
-                {paris,                     'M', "00"},
-                {china,                     'M', "00"},
-                {0L,                        'N', "000000000"},
-                {Long.MAX_VALUE,            'N', "807000000"},
-                {-1000L,                    'N', "000000000"},
-                {new Date(1147327147578L),  'N', "578000000"},
-                {paris,                     'N', "453000000"},
-                {china,                     'N', "468000000"},
-                {0L,                        'Q', "0"},
-                {Long.MAX_VALUE,            'Q', "9223372036854775807"},
-                {-1000L,                    'Q', "-1000"},
-                {new Date(1147327147578L),  'Q', "1147327147578"},
-                {paris,                     'Q', "1147082400453"},
-                {china,                     'Q', "1147118400609"},
-                {0L,                        'R', "08:00"},
-                {Long.MAX_VALUE,            'R', "15:18"},
-                {-1000L,                    'R', "07:59"},
-                {new Date(1147327147578L),  'R', "13:59"},
-                {paris,                     'R', "12:00"},
-                {china,                     'R', "12:00"},
-                {0L,                        'S', "00"},
-                {Long.MAX_VALUE,            'S', "47"},
-                {-1000L,                    'S', "59"},
-                {new Date(1147327147578L),  'S', "07"},
-                {paris,                     'S', "00"},
-                {china,                     'S', "00"},
-                {0L,                        'T', "08:00:00"},
-                {Long.MAX_VALUE,            'T', "15:18:47"},
-                {-1000L,                    'T', "07:59:59"},
-                {new Date(1147327147578L),  'T', "13:59:07"},
-                {paris,                     'T', "12:00:00"},
-                {china,                     'T', "12:00:00"},
-                {0L,                        'Y', "1970"},
-                {Long.MAX_VALUE,            'Y', "292278994"},
-                {-1000L,                    'Y', "1970"},
-                {new Date(1147327147578L),  'Y', "2006"},
-                {paris,                     'Y', "2006"},
-                {china,                     'Y', "2006"},
-                {0L,                        'Z', "CST"},
-                {Long.MAX_VALUE,            'Z', "CST"},
-                {-1000L,                    'Z', "CST"},
-                {new Date(1147327147578L),  'Z', "CST"},
-                {paris,                     'Z', "CEST"},
-                {china,                     'Z', "GMT-08:00"},
-        };
-
-
-        for (int i = 0; i < 90; i++) {
-            String formatSpecifier = "%t" + upperCaseGermanTriple[i][pattern];
-            String formatSpecifierUpper = "%T" + upperCaseGermanTriple[i][pattern];
-                    if ((Character)upperCaseGermanTriple[i][pattern] == 'N') {
-                        // result can't be predicted on RI, so skip this test
-                        continue;
-                    }
-                    // test '%t'
-                    f = new Formatter(Locale.JAPAN);
-                    f.format(formatSpecifier, upperCaseJapanTriple[i][input]);
-                    assertEquals("Format pattern: " + formatSpecifier
-                            + " Argument: " + upperCaseJapanTriple[i][input],
-                            upperCaseJapanTriple[i][output], f.toString());
-
-                    f = new Formatter(Locale.JAPAN);
-                    f.format(Locale.GERMAN, formatSpecifier, upperCaseGermanTriple[i][input]);
-                    assertEquals("Format pattern: " + formatSpecifier
-                            + " Argument: " + upperCaseGermanTriple[i][input],
-                            upperCaseGermanTriple[i][output], f.toString());
-
-                    f = new Formatter(Locale.JAPAN);
-                    f.format(Locale.FRANCE, formatSpecifier, upperCaseFranceTriple[i][input]);
-                    assertEquals("Format pattern: " + formatSpecifier
-                            + " Argument: " + upperCaseFranceTriple[i][input],
-                            upperCaseFranceTriple[i][output], f.toString());
-
-                    // test '%T'
-                    f = new Formatter(Locale.GERMAN);
-                    f.format(formatSpecifierUpper, upperCaseGermanTriple[i][input]);
-                    assertEquals("Format pattern: " + formatSpecifierUpper
-                            + " Argument: " + upperCaseGermanTriple[i][input],
-                            ((String)upperCaseGermanTriple[i][output])
-                                    .toUpperCase(Locale.US), f.toString());
-
-                    f = new Formatter(Locale.GERMAN);
-                    f.format(Locale.JAPAN, formatSpecifierUpper, upperCaseJapanTriple[i][input]);
-                    assertEquals("Format pattern: " + formatSpecifierUpper
-                            + " Argument: " + upperCaseJapanTriple[i][input],
-                            ((String)upperCaseJapanTriple[i][output])
-                                    .toUpperCase(Locale.US), f.toString());
-
-                    f = new Formatter(Locale.GERMAN);
-                    f.format(Locale.FRANCE, formatSpecifierUpper, upperCaseFranceTriple[i][input]);
-                    assertEquals("Format pattern: " + formatSpecifierUpper
-                            + " Argument: " + upperCaseFranceTriple[i][input],
-                            ((String)upperCaseFranceTriple[i][output])
-                                    .toUpperCase(Locale.US), f.toString());
-        }
-
-        f = new Formatter(Locale.US);
-        f.format("%-10ta", now);
-        assertEquals("Thu       ", f.toString());
-
-        f = new Formatter(Locale.US);
-        f.format("%10000000000000000000000000000000001ta", now);
-        assertEquals("Thu", f.toString().trim());
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for null argment for
-     *        Byte/Short/Integer/Long/BigInteger conversion
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_ByteShortIntegerLongNullConversion() {
-
-        Formatter f = new Formatter(Locale.FRANCE);
-        f.format("%d%<o%<x%<5X", (Integer) null);
-        assertEquals("nullnullnull NULL", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%d%<#03o %<0#4x%<6X", (Long) null);
-        assertEquals("nullnull null  NULL", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%(+,07d%<o %<x%<6X", (Byte) null);
-        assertEquals("   nullnull null  NULL", f.toString());
-
-        f = new Formatter(Locale.ITALY);
-        f.format("%(+,07d%<o %<x%<0#6X", (Short) null);
-        assertEquals("   nullnull null  NULL", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%(+,-7d%<( o%<+(x %<( 06X", (BigInteger) null);
-        assertEquals("null   nullnull   NULL", f.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for legal
-     *        BigInteger conversion type 'd'
-     */
-    public void test_formatLjava_lang_String$LBigInteger() {
-        final Object[][] tripleD = {
-                {new BigInteger("123456789012345678901234567890"),          "%d",       "123456789012345678901234567890"},
-                {new BigInteger("123456789012345678901234567890"),          "%10d",     "123456789012345678901234567890"},
-                {new BigInteger("123456789012345678901234567890"),          "%-1d",     "123456789012345678901234567890"},
-                {new BigInteger("123456789012345678901234567890"),          "%+d",      "+123456789012345678901234567890"},
-                {new BigInteger("123456789012345678901234567890"),          "% d",      " 123456789012345678901234567890"},
-                {new BigInteger("123456789012345678901234567890"),          "%,d",      "123.456.789.012.345.678.901.234.567.890"},
-                {new BigInteger("123456789012345678901234567890"),          "%(d",      "123456789012345678901234567890"},
-                {new BigInteger("123456789012345678901234567890"),          "%08d",     "123456789012345678901234567890"},
-                {new BigInteger("123456789012345678901234567890"),          "%-+,(11d", "+123.456.789.012.345.678.901.234.567.890"},
-                {new BigInteger("123456789012345678901234567890"),          "%0 ,(11d", " 123.456.789.012.345.678.901.234.567.890"},
-                {new BigInteger("-9876543210987654321098765432100000"),     "%d",       "-9876543210987654321098765432100000"},
-                {new BigInteger("-9876543210987654321098765432100000"),     "%10d",     "-9876543210987654321098765432100000"},
-                {new BigInteger("-9876543210987654321098765432100000"),     "%-1d",     "-9876543210987654321098765432100000"},
-                {new BigInteger("-9876543210987654321098765432100000"),     "%+d",      "-9876543210987654321098765432100000"},
-                {new BigInteger("-9876543210987654321098765432100000"),     "% d",      "-9876543210987654321098765432100000"},
-                {new BigInteger("-9876543210987654321098765432100000"),     "%,d",      "-9.876.543.210.987.654.321.098.765.432.100.000"},
-                {new BigInteger("-9876543210987654321098765432100000"),     "%(d",      "(9876543210987654321098765432100000)"},
-                {new BigInteger("-9876543210987654321098765432100000"),     "%08d",     "-9876543210987654321098765432100000"},
-                {new BigInteger("-9876543210987654321098765432100000"),     "%-+,(11d", "(9.876.543.210.987.654.321.098.765.432.100.000)"},
-                {new BigInteger("-9876543210987654321098765432100000"),     "%0 ,(11d", "(9.876.543.210.987.654.321.098.765.432.100.000)"},
-        };
-
-        final int input = 0;
-        final int pattern = 1;
-        final int output = 2;
-        Formatter f;
-        for (int i = 0; i < tripleD.length; i++) {
-            f = new Formatter(Locale.GERMAN);
-            f.format((String) tripleD[i][pattern],
-                    tripleD[i][input]);
-            assertEquals("triple[" + i + "]:" + tripleD[i][input] + ",pattern["
-                    + i + "]:" + tripleD[i][pattern], tripleD[i][output], f
-                    .toString());
-
-        }
-
-        final Object[][] tripleO = {
-                {new BigInteger("123456789012345678901234567890"),          "%o",       "143564417755415637016711617605322"},
-                {new BigInteger("123456789012345678901234567890"),          "%-6o",     "143564417755415637016711617605322"},
-                {new BigInteger("123456789012345678901234567890"),          "%08o",     "143564417755415637016711617605322"},
-                {new BigInteger("123456789012345678901234567890"),          "%#o",      "0143564417755415637016711617605322"},
-                {new BigInteger("123456789012345678901234567890"),          "%0#11o",   "0143564417755415637016711617605322"},
-                {new BigInteger("123456789012345678901234567890"),          "%-#9o",    "0143564417755415637016711617605322"},
-                {new BigInteger("-9876543210987654321098765432100000"),     "%o",       "-36336340043453651353467270113157312240"},
-                {new BigInteger("-9876543210987654321098765432100000"),     "%-6o",     "-36336340043453651353467270113157312240"},
-                {new BigInteger("-9876543210987654321098765432100000"),     "%08o",     "-36336340043453651353467270113157312240"},
-                {new BigInteger("-9876543210987654321098765432100000"),     "%#o",      "-036336340043453651353467270113157312240"},
-                {new BigInteger("-9876543210987654321098765432100000"),     "%0#11o",   "-036336340043453651353467270113157312240"},
-                {new BigInteger("-9876543210987654321098765432100000"),     "%-#9o",    "-036336340043453651353467270113157312240"},
-        };
-        for (int i = 0; i < tripleO.length; i++) {
-            f = new Formatter(Locale.ITALY);
-            f.format((String) tripleO[i][pattern],
-                    tripleO[i][input]);
-            assertEquals("triple[" + i + "]:" + tripleO[i][input] + ",pattern["
-                    + i + "]:" + tripleO[i][pattern], tripleO[i][output], f
-                    .toString());
-
-        }
-
-        final Object[][] tripleX = {
-                {new BigInteger("123456789012345678901234567890"),          "%x",       "18ee90ff6c373e0ee4e3f0ad2"},
-                {new BigInteger("123456789012345678901234567890"),          "%-8x",     "18ee90ff6c373e0ee4e3f0ad2"},
-                {new BigInteger("123456789012345678901234567890"),          "%06x",     "18ee90ff6c373e0ee4e3f0ad2"},
-                {new BigInteger("123456789012345678901234567890"),          "%#x",      "0x18ee90ff6c373e0ee4e3f0ad2"},
-                {new BigInteger("123456789012345678901234567890"),          "%0#12x",   "0x18ee90ff6c373e0ee4e3f0ad2"},
-                {new BigInteger("123456789012345678901234567890"),          "%-#9x",    "0x18ee90ff6c373e0ee4e3f0ad2"},
-                {new BigInteger("-9876543210987654321098765432100000"),     "%x",       "-1e6f380472bd4bae6eb8259bd94a0"},
-                {new BigInteger("-9876543210987654321098765432100000"),     "%-8x",     "-1e6f380472bd4bae6eb8259bd94a0"},
-                {new BigInteger("-9876543210987654321098765432100000"),     "%06x",     "-1e6f380472bd4bae6eb8259bd94a0"},
-                {new BigInteger("-9876543210987654321098765432100000"),     "%#x",      "-0x1e6f380472bd4bae6eb8259bd94a0"},
-                {new BigInteger("-9876543210987654321098765432100000"),     "%0#12x",   "-0x1e6f380472bd4bae6eb8259bd94a0"},
-                {new BigInteger("-9876543210987654321098765432100000"),     "%-#9x",    "-0x1e6f380472bd4bae6eb8259bd94a0"},
-        };
-
-        for (int i = 0; i < tripleX.length; i++) {
-            f = new Formatter(Locale.FRANCE);
-            f.format((String) tripleX[i][pattern],
-                    tripleX[i][input]);
-            assertEquals("triple[" + i + "]:" + tripleX[i][input] + ",pattern["
-                    + i + "]:" + tripleX[i][pattern], tripleX[i][output], f
-                    .toString());
-
-        }
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%(+,-7d%<( o%<+(x %<( 06X", (BigInteger) null);
-        assertEquals("null   nullnull   NULL", f.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for padding of
-     *        BigInteger conversion
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_BigIntegerPaddingConversion() {
-        Formatter f = null;
-
-        BigInteger bigInt = new BigInteger("123456789012345678901234567890");
-        f = new Formatter(Locale.GERMAN);
-        f.format("%32d", bigInt);
-        assertEquals("  123456789012345678901234567890", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%+32x", bigInt);
-        assertEquals("      +18ee90ff6c373e0ee4e3f0ad2", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("% 32o", bigInt);
-        assertEquals(" 143564417755415637016711617605322", f.toString());
-
-        BigInteger negBigInt = new BigInteger(
-                "-1234567890123456789012345678901234567890");
-        f = new Formatter(Locale.GERMAN);
-        f.format("%( 040X", negBigInt);
-        assertEquals("(000003A0C92075C0DBF3B8ACBC5F96CE3F0AD2)", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%+(045d", negBigInt);
-        assertEquals("(0001234567890123456789012345678901234567890)", f
-                .toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%+,-(60d", negBigInt);
-        assertEquals(
-                "(1.234.567.890.123.456.789.012.345.678.901.234.567.890)     ",
-                f.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for BigInteger
-     *        conversion exception
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_BigIntegerConversionException() {
-        Formatter f = null;
-
-        final String[] flagsConversionMismatches = { "%#d", "%,o", "%,x", "%,X" };
-        for (int i = 0; i < flagsConversionMismatches.length; i++) {
-            try {
-                f = new Formatter(Locale.CHINA);
-                f.format(flagsConversionMismatches[i], new BigInteger("1"));
-                fail("should throw FormatFlagsConversionMismatchException");
-            } catch (FormatFlagsConversionMismatchException e) {
-                // expected
-            }
-        }
-
-        final String[] missingFormatWidths = { "%-0d", "%0d", "%-d", "%-0o",
-                "%0o", "%-o", "%-0x", "%0x", "%-x", "%-0X", "%0X", "%-X" };
-        for (int i = 0; i < missingFormatWidths.length; i++) {
-            try {
-                f = new Formatter(Locale.KOREA);
-                f.format(missingFormatWidths[i], new BigInteger("1"));
-                fail("should throw MissingFormatWidthException");
-            } catch (MissingFormatWidthException e) {
-                // expected
-            }
-        }
-
-        final String[] illFlags = { "%+ d", "%-08d", "%+ o", "%-08o", "%+ x",
-                "%-08x", "%+ X", "%-08X" };
-        for (int i = 0; i < illFlags.length; i++) {
-            try {
-                f = new Formatter(Locale.CANADA);
-                f.format(illFlags[i], new BigInteger("1"));
-                fail("should throw IllegalFormatFlagsException");
-            } catch (IllegalFormatFlagsException e) {
-                // expected
-            }
-        }
-
-        final String[] precisionExceptions = { "%.4d", "%2.5o", "%8.6x",
-                "%11.17X" };
-        for (int i = 0; i < precisionExceptions.length; i++) {
-            try {
-                f = new Formatter(Locale.US);
-                f.format(precisionExceptions[i], new BigInteger("1"));
-                fail("should throw IllegalFormatPrecisionException");
-            } catch (IllegalFormatPrecisionException e) {
-                // expected
-            }
-        }
-
-        f = new Formatter(Locale.US);
-        try {
-            f.format("%D", new BigInteger("1"));
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }
-
-        f = new Formatter(Locale.US);
-        try {
-            f.format("%O", new BigInteger("1"));
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }
-
-        try {
-            f = new Formatter();
-            f.format("%010000000000000000000000000000000001d", new BigInteger(
-                    "1"));
-            fail("should throw MissingFormatWidthException");
-        } catch (MissingFormatWidthException e) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for BigInteger
-     *        exception throwing order
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_BigIntegerExceptionOrder() {
-        Formatter f = null;
-        BigInteger big = new BigInteger("100");
-
-        /*
-         * Order summary: UnknownFormatConversionException >
-         * MissingFormatWidthException > IllegalFormatFlagsException >
-         * IllegalFormatPrecisionException > IllegalFormatConversionException >
-         * FormatFlagsConversionMismatchException
-         *
-         */
-        f = new Formatter(Locale.US);
-        try {
-            // compare IllegalFormatConversionException and
-            // FormatFlagsConversionMismatchException
-            f.format("%(o", false);
-            fail("should throw IllegalFormatConversionException");
-        } catch (IllegalFormatConversionException e) {
-            // expected
-        }
-
-        try {
-            // compare IllegalFormatPrecisionException and
-            // IllegalFormatConversionException
-            f.format("%.4o", false);
-            fail("should throw IllegalFormatPrecisionException");
-        } catch (IllegalFormatPrecisionException e) {
-            // expected
-        }
-
-        try {
-            // compare IllegalFormatFlagsException and
-            // IllegalFormatPrecisionException
-            f.format("%+ .4o", big);
-            fail("should throw IllegalFormatFlagsException");
-        } catch (IllegalFormatFlagsException e) {
-            // expected
-        }
-
-        try {
-            // compare MissingFormatWidthException and
-            // IllegalFormatFlagsException
-            f.format("%+ -o", big);
-            fail("should throw MissingFormatWidthException");
-        } catch (MissingFormatWidthException e) {
-            // expected
-        }
-
-        try {
-            // compare UnknownFormatConversionException and
-            // MissingFormatWidthException
-            f.format("%-O", big);
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for Float/Double
-     *        conversion type 'e' and 'E'
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatConversionE() {
-        Formatter f = null;
-        final Object[][] tripleE = {
-                {0f, "%e",          "0.000000e+00"},
-                {0f, "%#.0e",       "0.e+00"},
-                {0f, "%#- (9.8e",   " 0.00000000e+00"},
-                {0f, "%#+0(8.4e",   "+0.0000e+00"},
-                {0f, "%-+(1.6e",    "+0.000000e+00"},
-                {0f, "% 0(12e",     " 0.000000e+00"},
-
-                {101f, "%e",          "1.010000e+02"},
-                {101f, "%#.0e",       "1.e+02"},
-                {101f, "%#- (9.8e",   " 1.01000000e+02"},
-                {101f, "%#+0(8.4e",   "+1.0100e+02"},
-                {101f, "%-+(1.6e",    "+1.010000e+02"},
-                {101f, "% 0(12e",     " 1.010000e+02"},
-
-                {1.f, "%e",          "1.000000e+00"},
-                {1.f, "%#.0e",       "1.e+00"},
-                {1.f, "%#- (9.8e",   " 1.00000000e+00"},
-                {1.f, "%#+0(8.4e",   "+1.0000e+00"},
-                {1.f, "%-+(1.6e",    "+1.000000e+00"},
-                {1.f, "% 0(12e",     " 1.000000e+00"},
-
-                {-98f, "%e",          "-9.800000e+01"},
-                {-98f, "%#.0e",       "-1.e+02"},
-                {-98f, "%#- (9.8e",   "(9.80000000e+01)"},
-                {-98f, "%#+0(8.4e",   "(9.8000e+01)"},
-                {-98f, "%-+(1.6e",    "(9.800000e+01)"},
-                {-98f, "% 0(12e",     "(9.800000e+01)"},
-
-                {1.23f, "%e",          "1.230000e+00"},
-                {1.23f, "%#.0e",       "1.e+00"},
-                {1.23f, "%#- (9.8e",   " 1.23000002e+00"},
-                {1.23f, "%#+0(8.4e",   "+1.2300e+00"},
-                {1.23f, "%-+(1.6e",    "+1.230000e+00"},
-                {1.23f, "% 0(12e",     " 1.230000e+00"},
-
-                {34.1234567f, "%e",          "3.412346e+01"},
-                {34.1234567f, "%#.0e",       "3.e+01"},
-                {34.1234567f, "%#- (9.8e",   " 3.41234550e+01"},
-                {34.1234567f, "%#+0(8.4e",   "+3.4123e+01"},
-                {34.1234567f, "%-+(1.6e",    "+3.412346e+01"},
-                {34.1234567f, "% 0(12e",     " 3.412346e+01"},
-
-                {-.12345f, "%e",          "-1.234500e-01"},
-                {-.12345f, "%#.0e",       "-1.e-01"},
-                {-.12345f, "%#- (9.8e",   "(1.23450004e-01)"},
-                {-.12345f, "%#+0(8.4e",   "(1.2345e-01)"},
-                {-.12345f, "%-+(1.6e",    "(1.234500e-01)"},
-                {-.12345f, "% 0(12e",     "(1.234500e-01)"},
-
-                {-9876.1234567f, "%e",          "-9.876123e+03"},
-                {-9876.1234567f, "%#.0e",       "-1.e+04"},
-                {-9876.1234567f, "%#- (9.8e",   "(9.87612305e+03)"},
-                {-9876.1234567f, "%#+0(8.4e",   "(9.8761e+03)"},
-                {-9876.1234567f, "%-+(1.6e",    "(9.876123e+03)"},
-                {-9876.1234567f, "% 0(12e",     "(9.876123e+03)"},
-
-                {Float.MAX_VALUE, "%e",          "3.402823e+38"},
-                {Float.MAX_VALUE, "%#.0e",       "3.e+38"},
-                {Float.MAX_VALUE, "%#- (9.8e",   " 3.40282347e+38"},
-                {Float.MAX_VALUE, "%#+0(8.4e",   "+3.4028e+38"},
-                {Float.MAX_VALUE, "%-+(1.6e",    "+3.402823e+38"},
-                {Float.MAX_VALUE, "% 0(12e",     " 3.402823e+38"},
-
-                {Float.MIN_VALUE, "%e",          "1.401298e-45"},
-                {Float.MIN_VALUE, "%#.0e",       "1.e-45"},
-                {Float.MIN_VALUE, "%#- (9.8e",   " 1.40129846e-45"},
-                {Float.MIN_VALUE, "%#+0(8.4e",   "+1.4013e-45"},
-                {Float.MIN_VALUE, "%-+(1.6e",    "+1.401298e-45"},
-                {Float.MIN_VALUE, "% 0(12e",     " 1.401298e-45"},
-
-                {Float.NaN, "%e",          "NaN"},
-                {Float.NaN, "%#.0e",       "NaN"},
-                {Float.NaN, "%#- (9.8e",   "NaN      "},
-                {Float.NaN, "%#+0(8.4e",   "     NaN"},
-                {Float.NaN, "%-+(1.6e",    "NaN"},
-                {Float.NaN, "% 0(12e",     "         NaN"},
-
-
-                {Float.NEGATIVE_INFINITY, "%e",          "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%#.0e",       "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%#- (9.8e",   "(Infinity)"},
-                {Float.NEGATIVE_INFINITY, "%#+0(8.4e",   "(Infinity)"},
-                {Float.NEGATIVE_INFINITY, "%-+(1.6e",    "(Infinity)"},
-                {Float.NEGATIVE_INFINITY, "% 0(12e",     "  (Infinity)"},
-
-                {Float.NEGATIVE_INFINITY, "%e",          "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%#.0e",       "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%#- (9.8e",   "(Infinity)"},
-                {Float.NEGATIVE_INFINITY, "%#+0(8.4e",   "(Infinity)"},
-                {Float.NEGATIVE_INFINITY, "%-+(1.6e",    "(Infinity)"},
-                {Float.NEGATIVE_INFINITY, "% 0(12e",     "  (Infinity)"},
-
-                {0d, "%e",          "0.000000e+00"},
-                {0d, "%#.0e",       "0.e+00"},
-                {0d, "%#- (9.8e",   " 0.00000000e+00"},
-                {0d, "%#+0(8.4e",   "+0.0000e+00"},
-                {0d, "%-+(1.6e",    "+0.000000e+00"},
-                {0d, "% 0(12e",     " 0.000000e+00"},
-
-                {1d, "%e",          "1.000000e+00"},
-                {1d, "%#.0e",       "1.e+00"},
-                {1d, "%#- (9.8e",   " 1.00000000e+00"},
-                {1d, "%#+0(8.4e",   "+1.0000e+00"},
-                {1d, "%-+(1.6e",    "+1.000000e+00"},
-                {1d, "% 0(12e",     " 1.000000e+00"},
-
-                {-1d, "%e",          "-1.000000e+00"},
-                {-1d, "%#.0e",       "-1.e+00"},
-                {-1d, "%#- (9.8e",   "(1.00000000e+00)"},
-                {-1d, "%#+0(8.4e",   "(1.0000e+00)"},
-                {-1d, "%-+(1.6e",    "(1.000000e+00)"},
-                {-1d, "% 0(12e",     "(1.000000e+00)"},
-
-
-                {.00000001d, "%e",          "1.000000e-08"},
-                {.00000001d, "%#.0e",       "1.e-08"},
-                {.00000001d, "%#- (9.8e",   " 1.00000000e-08"},
-                {.00000001d, "%#+0(8.4e",   "+1.0000e-08"},
-                {.00000001d, "%-+(1.6e",    "+1.000000e-08"},
-                {.00000001d, "% 0(12e",     " 1.000000e-08"},
-
-                {9122.10d, "%e",          "9.122100e+03"},
-                {9122.10d, "%#.0e",       "9.e+03"},
-                {9122.10d, "%#- (9.8e",   " 9.12210000e+03"},
-                {9122.10d, "%#+0(8.4e",   "+9.1221e+03"},
-                {9122.10d, "%-+(1.6e",    "+9.122100e+03"},
-                {9122.10d, "% 0(12e",     " 9.122100e+03"},
-
-                {0.1d, "%e",          "1.000000e-01"},
-                {0.1d, "%#.0e",       "1.e-01"},
-                {0.1d, "%#- (9.8e",   " 1.00000000e-01"},
-                {0.1d, "%#+0(8.4e",   "+1.0000e-01"},
-                {0.1d, "%-+(1.6e",    "+1.000000e-01"},
-                {0.1d, "% 0(12e",     " 1.000000e-01"},
-
-                {-2.d, "%e",          "-2.000000e+00"},
-                {-2.d, "%#.0e",       "-2.e+00"},
-                {-2.d, "%#- (9.8e",   "(2.00000000e+00)"},
-                {-2.d, "%#+0(8.4e",   "(2.0000e+00)"},
-                {-2.d, "%-+(1.6e",    "(2.000000e+00)"},
-                {-2.d, "% 0(12e",     "(2.000000e+00)"},
-
-                {-.39d, "%e",          "-3.900000e-01"},
-                {-.39d, "%#.0e",       "-4.e-01"},
-                {-.39d, "%#- (9.8e",   "(3.90000000e-01)"},
-                {-.39d, "%#+0(8.4e",   "(3.9000e-01)"},
-                {-.39d, "%-+(1.6e",    "(3.900000e-01)"},
-                {-.39d, "% 0(12e",     "(3.900000e-01)"},
-
-                {-1234567890.012345678d, "%e",          "-1.234568e+09"},
-                {-1234567890.012345678d, "%#.0e",       "-1.e+09"},
-                {-1234567890.012345678d, "%#- (9.8e",   "(1.23456789e+09)"},
-                {-1234567890.012345678d, "%#+0(8.4e",   "(1.2346e+09)"},
-                {-1234567890.012345678d, "%-+(1.6e",    "(1.234568e+09)"},
-                {-1234567890.012345678d, "% 0(12e",     "(1.234568e+09)"},
-
-                {Double.MAX_VALUE, "%e",          "1.797693e+308"},
-                {Double.MAX_VALUE, "%#.0e",       "2.e+308"},
-                {Double.MAX_VALUE, "%#- (9.8e",   " 1.79769313e+308"},
-                {Double.MAX_VALUE, "%#+0(8.4e",   "+1.7977e+308"},
-                {Double.MAX_VALUE, "%-+(1.6e",    "+1.797693e+308"},
-                {Double.MAX_VALUE, "% 0(12e",     " 1.797693e+308"},
-
-                {Double.MIN_VALUE, "%e",          "4.900000e-324"},
-                {Double.MIN_VALUE, "%#.0e",       "5.e-324"},
-                {Double.MIN_VALUE, "%#- (9.8e",   " 4.90000000e-324"},
-                {Double.MIN_VALUE, "%#+0(8.4e",   "+4.9000e-324"},
-                {Double.MIN_VALUE, "%-+(1.6e",    "+4.900000e-324"},
-                {Double.MIN_VALUE, "% 0(12e",     " 4.900000e-324"},
-
-                {Double.NaN, "%e",          "NaN"},
-                {Double.NaN, "%#.0e",       "NaN"},
-                {Double.NaN, "%#- (9.8e",   "NaN      "},
-                {Double.NaN, "%#+0(8.4e",   "     NaN"},
-                {Double.NaN, "%-+(1.6e",    "NaN"},
-                {Double.NaN, "% 0(12e",     "         NaN"},
-
-                {Double.NEGATIVE_INFINITY, "%e",          "-Infinity"},
-                {Double.NEGATIVE_INFINITY, "%#.0e",       "-Infinity"},
-                {Double.NEGATIVE_INFINITY, "%#- (9.8e",   "(Infinity)"},
-                {Double.NEGATIVE_INFINITY, "%#+0(8.4e",   "(Infinity)"},
-                {Double.NEGATIVE_INFINITY, "%-+(1.6e",    "(Infinity)"},
-                {Double.NEGATIVE_INFINITY, "% 0(12e",     "  (Infinity)"},
-
-                {Double.POSITIVE_INFINITY, "%e",          "Infinity"},
-                {Double.POSITIVE_INFINITY, "%#.0e",       "Infinity"},
-                {Double.POSITIVE_INFINITY, "%#- (9.8e",   " Infinity"},
-                {Double.POSITIVE_INFINITY, "%#+0(8.4e",   "+Infinity"},
-                {Double.POSITIVE_INFINITY, "%-+(1.6e",    "+Infinity"},
-                {Double.POSITIVE_INFINITY, "% 0(12e",     "    Infinity"},
-        };
-        final int input   = 0;
-        final int pattern = 1;
-        final int output  = 2;
-            for (int i = 0; i < tripleE.length; i++) {
-                f = new Formatter(Locale.US);
-                f.format((String)tripleE[i][pattern], tripleE[i][input]);
-                assertEquals("triple[" + i + "]:" + tripleE[i][input] + ",pattern["
-                        + i + "]:" + tripleE[i][pattern],
-                        tripleE[i][output], f.toString());
-
-                // test for conversion type 'E'
-                f = new Formatter(Locale.US);
-                f.format(((String)tripleE[i][pattern]).toUpperCase(), tripleE[i][input]);
-                assertEquals("triple[" + i + "]:" + tripleE[i][input] + ",pattern["
-                        + i + "]:" + tripleE[i][pattern], ((String)tripleE[i][output])
-                        .toUpperCase(Locale.UK), f.toString());
-            }
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%e", 1001f);
-        /*
-         * fail on RI, spec says 'e' requires the output to be formatted in
-         * general scientific notation and the localization algorithm is
-         * applied. But RI format this case to 1.001000e+03, which does not
-         * conform to the German Locale
-         */
-        assertEquals("1,001000e+03", f.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for Float/Double
-     *        conversion type 'g' and 'G'
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatConversionG() {
-        Formatter f = null;
-        final Object[][] tripleG = {
-                {1001f, "%g",           "1001.00"},
-                {1001f, "%- (,9.8g",    " 1,001.0000"},
-                {1001f, "%+0(,8.4g",    "+001,001"},
-                {1001f, "%-+(,1.6g",    "+1,001.00"},
-                {1001f, "% 0(,12.0g",   " 0000001e+03"},
-
-                {1.f, "%g",           "1.00000"},
-                {1.f, "%- (,9.8g",    " 1.0000000"},
-                {1.f, "%+0(,8.4g",    "+001.000"},
-                {1.f, "%-+(,1.6g",    "+1.00000"},
-                {1.f, "% 0(,12.0g",   " 00000000001"},
-
-                {-98f, "%g",           "-98.0000"},
-                {-98f, "%- (,9.8g",    "(98.000000)"},
-                {-98f, "%+0(,8.4g",    "(098.00)"},
-                {-98f, "%-+(,1.6g",    "(98.0000)"},
-                {-98f, "% 0(,12.0g",   "(000001e+02)"},
-
-                {0.000001f, "%g",           "1.00000e-06"},
-                {0.000001f, "%- (,9.8g",    " 1.0000000e-06"},
-                {0.000001f, "%+0(,8.4g",    "+1.000e-06"},
-                {0.000001f, "%-+(,1.6g",    "+1.00000e-06"},
-                {0.000001f, "% 0(,12.0g",   " 0000001e-06"},
-
-                {345.1234567f, "%g",           "345.123"},
-                {345.1234567f, "%- (,9.8g",    " 345.12344"},
-                {345.1234567f, "%+0(,8.4g",    "+00345.1"},
-                {345.1234567f, "%-+(,1.6g",    "+345.123"},
-                {345.1234567f, "% 0(,12.0g",   " 0000003e+02"},
-
-                {-.00000012345f, "%g",           "-1.23450e-07"},
-                {-.00000012345f, "%- (,9.8g",    "(1.2344999e-07)"},
-                {-.00000012345f, "%+0(,8.4g",    "(1.234e-07)"},
-                {-.00000012345f, "%-+(,1.6g",    "(1.23450e-07)"},
-                {-.00000012345f, "% 0(,12.0g",   "(000001e-07)"},
-
-                {-987.1234567f, "%g",           "-987.123"},
-                {-987.1234567f, "%- (,9.8g",    "(987.12347)"},
-                {-987.1234567f, "%+0(,8.4g",    "(0987.1)"},
-                {-987.1234567f, "%-+(,1.6g",    "(987.123)"},
-                {-987.1234567f, "% 0(,12.0g",   "(000001e+03)"},
-
-                {Float.MAX_VALUE, "%g",           "3.40282e+38"},
-                {Float.MAX_VALUE, "%- (,9.8g",    " 3.4028235e+38"},
-                {Float.MAX_VALUE, "%+0(,8.4g",    "+3.403e+38"},
-                {Float.MAX_VALUE, "%-+(,1.6g",    "+3.40282e+38"},
-                {Float.MAX_VALUE, "% 0(,12.0g",   " 0000003e+38"},
-
-                {Float.MIN_VALUE, "%g",           "1.40130e-45"},
-                {Float.MIN_VALUE, "%- (,9.8g",    " 1.4012985e-45"},
-                {Float.MIN_VALUE, "%+0(,8.4g",    "+1.401e-45"},
-                {Float.MIN_VALUE, "%-+(,1.6g",    "+1.40130e-45"},
-                {Float.MIN_VALUE, "% 0(,12.0g",   " 0000001e-45"},
-
-                {Float.NaN, "%g",           "NaN"},
-                {Float.NaN, "%- (,9.8g",    "NaN      "},
-                {Float.NaN, "%+0(,8.4g",    "     NaN"},
-                {Float.NaN, "%-+(,1.6g",    "NaN"},
-                {Float.NaN, "% 0(,12.0g",   "         NaN"},
-
-                {Float.NEGATIVE_INFINITY, "%g",           "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%- (,9.8g",    "(Infinity)"},
-                {Float.NEGATIVE_INFINITY, "%+0(,8.4g",    "(Infinity)"},
-                {Float.NEGATIVE_INFINITY, "%-+(,1.6g",    "(Infinity)"},
-                {Float.NEGATIVE_INFINITY, "% 0(,12.0g",   "  (Infinity)"},
-
-                {Float.POSITIVE_INFINITY, "%g",           "Infinity"},
-                {Float.POSITIVE_INFINITY, "%- (,9.8g",    " Infinity"},
-                {Float.POSITIVE_INFINITY, "%+0(,8.4g",    "+Infinity"},
-                {Float.POSITIVE_INFINITY, "%-+(,1.6g",    "+Infinity"},
-                {Float.POSITIVE_INFINITY, "% 0(,12.0g",   "    Infinity"},
-
-                {1d, "%g",           "1.00000"},
-                {1d, "%- (,9.8g",    " 1.0000000"},
-                {1d, "%+0(,8.4g",    "+001.000"},
-                {1d, "%-+(,1.6g",    "+1.00000"},
-                {1d, "% 0(,12.0g",   " 00000000001"},
-
-                {-1d, "%g",           "-1.00000"},
-                {-1d, "%- (,9.8g",    "(1.0000000)"},
-                {-1d, "%+0(,8.4g",    "(01.000)"},
-                {-1d, "%-+(,1.6g",    "(1.00000)"},
-                {-1d, "% 0(,12.0g",   "(0000000001)"},
-
-                {.00000001d, "%g",           "1.00000e-08"},
-                {.00000001d, "%- (,9.8g",    " 1.0000000e-08"},
-                {.00000001d, "%+0(,8.4g",    "+1.000e-08"},
-                {.00000001d, "%-+(,1.6g",    "+1.00000e-08"},
-                {.00000001d, "% 0(,12.0g",   " 0000001e-08"},
-
-                {1912.10d, "%g",           "1912.10"},
-                {1912.10d, "%- (,9.8g",    " 1,912.1000"},
-                {1912.10d, "%+0(,8.4g",    "+001,912"},
-                {1912.10d, "%-+(,1.6g",    "+1,912.10"},
-                {1912.10d, "% 0(,12.0g",   " 0000002e+03"},
-
-                {0.1d, "%g",           "0.100000"},
-                {0.1d, "%- (,9.8g",    " 0.10000000"},
-                {0.1d, "%+0(,8.4g",    "+00.1000"},
-                {0.1d, "%-+(,1.6g",    "+0.100000"},
-                {0.1d, "% 0(,12.0g",   " 000000000.1"},
-
-                {-2.d, "%g",           "-2.00000"},
-                {-2.d, "%- (,9.8g",    "(2.0000000)"},
-                {-2.d, "%+0(,8.4g",    "(02.000)"},
-                {-2.d, "%-+(,1.6g",    "(2.00000)"},
-                {-2.d, "% 0(,12.0g",   "(0000000002)"},
-
-                {-.00039d, "%g",           "-0.000390000"},
-                {-.00039d, "%- (,9.8g",    "(0.00039000000)"},
-                {-.00039d, "%+0(,8.4g",    "(0.0003900)"},
-                {-.00039d, "%-+(,1.6g",    "(0.000390000)"},
-                {-.00039d, "% 0(,12.0g",   "(00000.0004)"},
-
-                {-1234567890.012345678d, "%g",           "-1.23457e+09"},
-                {-1234567890.012345678d, "%- (,9.8g",    "(1.2345679e+09)"},
-                {-1234567890.012345678d, "%+0(,8.4g",    "(1.235e+09)"},
-                {-1234567890.012345678d, "%-+(,1.6g",    "(1.23457e+09)"},
-                {-1234567890.012345678d, "% 0(,12.0g",   "(000001e+09)"},
-
-                {Double.MAX_VALUE, "%g",           "1.79769e+308"},
-                {Double.MAX_VALUE, "%- (,9.8g",    " 1.7976931e+308"},
-                {Double.MAX_VALUE, "%+0(,8.4g",    "+1.798e+308"},
-                {Double.MAX_VALUE, "%-+(,1.6g",    "+1.79769e+308"},
-                {Double.MAX_VALUE, "% 0(,12.0g",   " 000002e+308"},
-
-                {Double.MIN_VALUE, "%g",           "4.90000e-324"},
-                {Double.MIN_VALUE, "%- (,9.8g",    " 4.9000000e-324"},
-                {Double.MIN_VALUE, "%+0(,8.4g",    "+4.900e-324"},
-                {Double.MIN_VALUE, "%-+(,1.6g",    "+4.90000e-324"},
-                {Double.MIN_VALUE, "% 0(,12.0g",   " 000005e-324"},
-
-                {Double.NaN, "%g",           "NaN"},
-                {Double.NaN, "%- (,9.8g",    "NaN      "},
-                {Double.NaN, "%+0(,8.4g",    "     NaN"},
-                {Double.NaN, "%-+(,1.6g",    "NaN"},
-                {Double.NaN, "% 0(,12.0g",   "         NaN"},
-
-                {Double.NEGATIVE_INFINITY, "%g",           "-Infinity"},
-                {Double.NEGATIVE_INFINITY, "%- (,9.8g",    "(Infinity)"},
-                {Double.NEGATIVE_INFINITY, "%+0(,8.4g",    "(Infinity)"},
-                {Double.NEGATIVE_INFINITY, "%-+(,1.6g",    "(Infinity)"},
-                {Double.NEGATIVE_INFINITY, "% 0(,12.0g",   "  (Infinity)"},
-
-                {Double.POSITIVE_INFINITY, "%g",           "Infinity"},
-                {Double.POSITIVE_INFINITY, "%- (,9.8g",    " Infinity"},
-                {Double.POSITIVE_INFINITY, "%+0(,8.4g",    "+Infinity"},
-                {Double.POSITIVE_INFINITY, "%-+(,1.6g",    "+Infinity"},
-                {Double.POSITIVE_INFINITY, "% 0(,12.0g",   "    Infinity"},
-
-        };
-        final int input   = 0;
-        final int pattern = 1;
-        final int output  = 2;
-            for (int i = 0; i < tripleG.length; i++) {
-
-                f = new Formatter(Locale.US);
-                f.format((String)tripleG[i][pattern], tripleG[i][input]);
-                assertEquals("triple[" + i + "]:" + tripleG[i][input] + ",pattern["
-                        + i + "]:" + tripleG[i][pattern],
-                        tripleG[i][output], f.toString());
-
-                // test for conversion type 'G'
-                f = new Formatter(Locale.US);
-                f.format(((String)tripleG[i][pattern]).toUpperCase(), tripleG[i][input]);
-                assertEquals("triple[" + i + "]:" + tripleG[i][input] + ",pattern["
-                        + i + "]:" + tripleG[i][pattern], ((String)tripleG[i][output])
-                        .toUpperCase(Locale.UK), f.toString());
-            }
-
-        f = new Formatter(Locale.US);
-        f.format("%.5g", 0f);
-        assertEquals("0.0000", f.toString());
-
-        f = new Formatter(Locale.US);
-        f.format("%.0g", 0f);
-        /*
-         * fail on RI, spec says if the precision is 0, then it is taken to be
-         * 1. but RI throws ArrayIndexOutOfBoundsException.
-         */
-        assertEquals("0", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%g", 1001f);
-        /*
-         * fail on RI, spec says 'g' requires the output to be formatted in
-         * general scientific notation and the localization algorithm is
-         * applied. But RI format this case to 1001.00, which does not conform
-         * to the German Locale
-         */
-        assertEquals("1001,00", f.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for Float/Double
-     *        conversion type 'g' and 'G' overflow
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatConversionG_Overflow() {
-        Formatter f = new Formatter();
-        f.format("%g", 999999.5);
-        assertEquals("1.00000e+06", f.toString());
-
-        f = new Formatter();
-        f.format("%g", 99999.5);
-        assertEquals("99999.5", f.toString());
-
-        f = new Formatter();
-        f.format("%.4g", 99.95);
-        assertEquals("99.95", f.toString());
-
-        f = new Formatter();
-        f.format("%g", 99.95);
-        assertEquals("99.9500", f.toString());
-
-        f = new Formatter();
-        f.format("%g", 0.9);
-        assertEquals("0.900000", f.toString());
-
-        f = new Formatter();
-        f.format("%.0g", 0.000095);
-        assertEquals("0.0001", f.toString());
-
-        f = new Formatter();
-        f.format("%g", 0.0999999);
-        assertEquals("0.0999999", f.toString());
-
-        f = new Formatter();
-        f.format("%g", 0.00009);
-        assertEquals("9.00000e-05", f.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for Float/Double
-     *        conversion type 'f'
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatConversionF() {
-        Formatter f = null;
-
-        final Object[][] tripleF = {
-                {0f, "%f",          "0,000000"},
-                {0f, "%#.3f",       "0,000"},
-                {0f, "%,5f",        "0,000000"},
-                {0f, "%- (12.0f",   " 0          "},
-                {0f, "%#+0(1.6f",   "+0,000000"},
-                {0f, "%-+(8.4f",    "+0,0000 "},
-                {0f, "% 0#(9.8f",   " 0,00000000"},
-
-                {1234f, "%f",          "1234,000000"},
-                {1234f, "%#.3f",       "1234,000"},
-                {1234f, "%,5f",        "1.234,000000"},
-                {1234f, "%- (12.0f",   " 1234       "},
-                {1234f, "%#+0(1.6f",   "+1234,000000"},
-                {1234f, "%-+(8.4f",    "+1234,0000"},
-                {1234f, "% 0#(9.8f",   " 1234,00000000"},
-
-                {1.f, "%f",          "1,000000"},
-                {1.f, "%#.3f",       "1,000"},
-                {1.f, "%,5f",        "1,000000"},
-                {1.f, "%- (12.0f",   " 1          "},
-                {1.f, "%#+0(1.6f",   "+1,000000"},
-                {1.f, "%-+(8.4f",    "+1,0000 "},
-                {1.f, "% 0#(9.8f",   " 1,00000000"},
-
-                {-98f, "%f",          "-98,000000"},
-                {-98f, "%#.3f",       "-98,000"},
-                {-98f, "%,5f",        "-98,000000"},
-                {-98f, "%- (12.0f",   "(98)        "},
-                {-98f, "%#+0(1.6f",   "(98,000000)"},
-                {-98f, "%-+(8.4f",    "(98,0000)"},
-                {-98f, "% 0#(9.8f",   "(98,00000000)"},
-
-                {0.000001f, "%f",          "0,000001"},
-                {0.000001f, "%#.3f",       "0,000"},
-                {0.000001f, "%,5f",        "0,000001"},
-                {0.000001f, "%- (12.0f",   " 0          "},
-                {0.000001f, "%#+0(1.6f",   "+0,000001"},
-                {0.000001f, "%-+(8.4f",    "+0,0000 "},
-                {0.000001f, "% 0#(9.8f",   " 0,00000100"},
-
-                {345.1234567f, "%f",          "345,123444"},
-                {345.1234567f, "%#.3f",       "345,123"},
-                {345.1234567f, "%,5f",        "345,123444"},
-                {345.1234567f, "%- (12.0f",   " 345        "},
-                {345.1234567f, "%#+0(1.6f",   "+345,123444"},
-                {345.1234567f, "%-+(8.4f",    "+345,1234"},
-                {345.1234567f, "% 0#(9.8f",   " 345,12344360"},
-
-                {-.00000012345f, "%f",          "-0,000000"},
-                {-.00000012345f, "%#.3f",       "-0,000"},
-                {-.00000012345f, "%,5f",        "-0,000000"},
-                {-.00000012345f, "%- (12.0f",   "(0)         "},
-                {-.00000012345f, "%#+0(1.6f",   "(0,000000)"},
-                {-.00000012345f, "%-+(8.4f",    "(0,0000)"},
-                {-.00000012345f, "% 0#(9.8f",   "(0,00000012)"},
-
-                {-987654321.1234567f, "%f",          "-987654336,000000"},
-                {-987654321.1234567f, "%#.3f",       "-987654336,000"},
-                {-987654321.1234567f, "%,5f",        "-987.654.336,000000"},
-                {-987654321.1234567f, "%- (12.0f",   "(987654336) "},
-                {-987654321.1234567f, "%#+0(1.6f",   "(987654336,000000)"},
-                {-987654321.1234567f, "%-+(8.4f",    "(987654336,0000)"},
-                {-987654321.1234567f, "% 0#(9.8f",   "(987654336,00000000)"},
-
-                {Float.MAX_VALUE, "%f",          "340282346638528860000000000000000000000,000000"},
-                {Float.MAX_VALUE, "%#.3f",       "340282346638528860000000000000000000000,000"},
-                {Float.MAX_VALUE, "%,5f",        "340.282.346.638.528.860.000.000.000.000.000.000.000,000000"},
-                {Float.MAX_VALUE, "%- (12.0f",   " 340282346638528860000000000000000000000"},
-                {Float.MAX_VALUE, "%#+0(1.6f",   "+340282346638528860000000000000000000000,000000"},
-                {Float.MAX_VALUE, "%-+(8.4f",    "+340282346638528860000000000000000000000,0000"},
-                {Float.MAX_VALUE, "% 0#(9.8f",   " 340282346638528860000000000000000000000,00000000"},
-
-                {Float.MIN_VALUE, "%f",          "0,000000"},
-                {Float.MIN_VALUE, "%#.3f",       "0,000"},
-                {Float.MIN_VALUE, "%,5f",        "0,000000"},
-                {Float.MIN_VALUE, "%- (12.0f",   " 0          "},
-                {Float.MIN_VALUE, "%#+0(1.6f",   "+0,000000"},
-                {Float.MIN_VALUE, "%-+(8.4f",    "+0,0000 "},
-                {Float.MIN_VALUE, "% 0#(9.8f",   " 0,00000000"},
-
-                {Float.NaN, "%f",          "NaN"},
-                {Float.NaN, "%#.3f",       "NaN"},
-                {Float.NaN, "%,5f",        "  NaN"},
-                {Float.NaN, "%- (12.0f",   "NaN         "},
-                {Float.NaN, "%#+0(1.6f",   "NaN"},
-                {Float.NaN, "%-+(8.4f",    "NaN     "},
-                {Float.NaN, "% 0#(9.8f",   "      NaN"},
-
-                {Float.NEGATIVE_INFINITY, "%f",          "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%#.3f",       "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%,5f",        "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%- (12.0f",   "(Infinity)  "},
-                {Float.NEGATIVE_INFINITY, "%#+0(1.6f",   "(Infinity)"},
-                {Float.NEGATIVE_INFINITY, "%-+(8.4f",    "(Infinity)"},
-                {Float.NEGATIVE_INFINITY, "% 0#(9.8f",   "(Infinity)"},
-
-                {Float.POSITIVE_INFINITY, "%f",          "Infinity"},
-                {Float.POSITIVE_INFINITY, "%#.3f",       "Infinity"},
-                {Float.POSITIVE_INFINITY, "%,5f",        "Infinity"},
-                {Float.POSITIVE_INFINITY, "%- (12.0f",   " Infinity   "},
-                {Float.POSITIVE_INFINITY, "%#+0(1.6f",   "+Infinity"},
-                {Float.POSITIVE_INFINITY, "%-+(8.4f",    "+Infinity"},
-                {Float.POSITIVE_INFINITY, "% 0#(9.8f",   " Infinity"},
-
-
-                {0d, "%f",          "0,000000"},
-                {0d, "%#.3f",       "0,000"},
-                {0d, "%,5f",        "0,000000"},
-                {0d, "%- (12.0f",   " 0          "},
-                {0d, "%#+0(1.6f",   "+0,000000"},
-                {0d, "%-+(8.4f",    "+0,0000 "},
-                {0d, "% 0#(9.8f",   " 0,00000000"},
-
-                {1d, "%f",          "1,000000"},
-                {1d, "%#.3f",       "1,000"},
-                {1d, "%,5f",        "1,000000"},
-                {1d, "%- (12.0f",   " 1          "},
-                {1d, "%#+0(1.6f",   "+1,000000"},
-                {1d, "%-+(8.4f",    "+1,0000 "},
-                {1d, "% 0#(9.8f",   " 1,00000000"},
-
-                {-1d, "%f",          "-1,000000"},
-                {-1d, "%#.3f",       "-1,000"},
-                {-1d, "%,5f",        "-1,000000"},
-                {-1d, "%- (12.0f",   "(1)         "},
-                {-1d, "%#+0(1.6f",   "(1,000000)"},
-                {-1d, "%-+(8.4f",    "(1,0000)"},
-                {-1d, "% 0#(9.8f",   "(1,00000000)"},
-
-                {.00000001d, "%f",          "0,000000"},
-                {.00000001d, "%#.3f",       "0,000"},
-                {.00000001d, "%,5f",        "0,000000"},
-                {.00000001d, "%- (12.0f",   " 0          "},
-                {.00000001d, "%#+0(1.6f",   "+0,000000"},
-                {.00000001d, "%-+(8.4f",    "+0,0000 "},
-                {.00000001d, "% 0#(9.8f",   " 0,00000001"},
-
-                {1000.10d, "%f",          "1000,100000"},
-                {1000.10d, "%#.3f",       "1000,100"},
-                {1000.10d, "%,5f",        "1.000,100000"},
-                {1000.10d, "%- (12.0f",   " 1000       "},
-                {1000.10d, "%#+0(1.6f",   "+1000,100000"},
-                {1000.10d, "%-+(8.4f",    "+1000,1000"},
-                {1000.10d, "% 0#(9.8f",   " 1000,10000000"},
-
-                {0.1d, "%f",          "0,100000"},
-                {0.1d, "%#.3f",       "0,100"},
-                {0.1d, "%,5f",        "0,100000"},
-                {0.1d, "%- (12.0f",   " 0          "},
-                {0.1d, "%#+0(1.6f",   "+0,100000"},
-                {0.1d, "%-+(8.4f",    "+0,1000 "},
-                {0.1d, "% 0#(9.8f",   " 0,10000000"},
-
-                {-2.d, "%f",          "-2,000000"},
-                {-2.d, "%#.3f",       "-2,000"},
-                {-2.d, "%,5f",        "-2,000000"},
-                {-2.d, "%- (12.0f",   "(2)         "},
-                {-2.d, "%#+0(1.6f",   "(2,000000)"},
-                {-2.d, "%-+(8.4f",    "(2,0000)"},
-                {-2.d, "% 0#(9.8f",   "(2,00000000)"},
-
-                {-.00009d, "%f",          "-0,000090"},
-                {-.00009d, "%#.3f",       "-0,000"},
-                {-.00009d, "%,5f",        "-0,000090"},
-                {-.00009d, "%- (12.0f",   "(0)         "},
-                {-.00009d, "%#+0(1.6f",   "(0,000090)"},
-                {-.00009d, "%-+(8.4f",    "(0,0001)"},
-                {-.00009d, "% 0#(9.8f",   "(0,00009000)"},
-
-                {-1234567890.012345678d, "%f",          "-1234567890,012346"},
-                {-1234567890.012345678d, "%#.3f",       "-1234567890,012"},
-                {-1234567890.012345678d, "%,5f",        "-1.234.567.890,012346"},
-                {-1234567890.012345678d, "%- (12.0f",   "(1234567890)"},
-                {-1234567890.012345678d, "%#+0(1.6f",   "(1234567890,012346)"},
-                {-1234567890.012345678d, "%-+(8.4f",    "(1234567890,0123)"},
-                {-1234567890.012345678d, "% 0#(9.8f",   "(1234567890,01234580)"},
-
-                {Double.MAX_VALUE, "%f",          "179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,000000"},
-                {Double.MAX_VALUE, "%#.3f",       "179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,000"},
-                {Double.MAX_VALUE, "%,5f",        "179.769.313.486.231.570.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000,000000"},
-                {Double.MAX_VALUE, "%- (12.0f",   " 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"},
-                {Double.MAX_VALUE, "%#+0(1.6f",   "+179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,000000"},
-                {Double.MAX_VALUE, "%-+(8.4f",    "+179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,0000"},
-                {Double.MAX_VALUE, "% 0#(9.8f",   " 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,00000000"},
-
-                {Double.MIN_VALUE, "%f",          "0,000000"},
-                {Double.MIN_VALUE, "%#.3f",       "0,000"},
-                {Double.MIN_VALUE, "%,5f",        "0,000000"},
-                {Double.MIN_VALUE, "%- (12.0f",   " 0          "},
-                {Double.MIN_VALUE, "%#+0(1.6f",   "+0,000000"},
-                {Double.MIN_VALUE, "%-+(8.4f",    "+0,0000 "},
-                {Double.MIN_VALUE, "% 0#(9.8f",   " 0,00000000"},
-
-                {Double.NaN, "%f",          "NaN"},
-                {Double.NaN, "%#.3f",       "NaN"},
-                {Double.NaN, "%,5f",        "  NaN"},
-                {Double.NaN, "%- (12.0f",   "NaN         "},
-                {Double.NaN, "%#+0(1.6f",   "NaN"},
-                {Double.NaN, "%-+(8.4f",    "NaN     "},
-                {Double.NaN, "% 0#(9.8f",   "      NaN"},
-
-                {Double.POSITIVE_INFINITY, "%f",          "Infinity"},
-                {Double.POSITIVE_INFINITY, "%#.3f",       "Infinity"},
-                {Double.POSITIVE_INFINITY, "%,5f",        "Infinity"},
-                {Double.POSITIVE_INFINITY, "%- (12.0f",   " Infinity   "},
-                {Double.POSITIVE_INFINITY, "%#+0(1.6f",   "+Infinity"},
-                {Double.POSITIVE_INFINITY, "%-+(8.4f",    "+Infinity"},
-                {Double.POSITIVE_INFINITY, "% 0#(9.8f",   " Infinity"},
-
-                {Double.NEGATIVE_INFINITY, "%f",          "-Infinity"},
-                {Double.NEGATIVE_INFINITY, "%#.3f",       "-Infinity"},
-                {Double.NEGATIVE_INFINITY, "%,5f",        "-Infinity"},
-                {Double.NEGATIVE_INFINITY, "%- (12.0f",   "(Infinity)  "},
-                {Double.NEGATIVE_INFINITY, "%#+0(1.6f",   "(Infinity)"},
-                {Double.NEGATIVE_INFINITY, "%-+(8.4f",    "(Infinity)"},
-                {Double.NEGATIVE_INFINITY, "% 0#(9.8f",   "(Infinity)"},
-        };
-        final int input   = 0;
-        final int pattern = 1;
-        final int output  = 2;
-            for (int i = 0; i < tripleF.length; i++) {
-                f = new Formatter(Locale.GERMAN);
-                f.format((String)tripleF[i][pattern], tripleF[i][input]);
-                assertEquals("triple[" + i + "]:" + tripleF[i][input] + ",pattern["
-                        + i + "]:" + tripleF[i][pattern],
-                        tripleF[i][output], f.toString());
-            }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for Float/Double
-     *        conversion type 'a' and 'A'
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatConversionA() {
-        Formatter f = null;
-        final Object[][] tripleA = {
-                {-0f, "%a",         "-0x0.0p0"},
-                {-0f, "%#.3a",      "-0x0.000p0"},
-                {-0f, "%5a",        "-0x0.0p0"},
-                {-0f, "%- 12.0a",   "-0x0.0p0    "},
-                {-0f, "%#+01.6a",   "-0x0.000000p0"},
-                {-0f, "%-+8.4a",    "-0x0.0000p0"},
-
-                {0f, "%a",         "0x0.0p0"},
-                {0f, "%#.3a",      "0x0.000p0"},
-                {0f, "%5a",        "0x0.0p0"},
-                {0f, "%- 12.0a",   " 0x0.0p0    "},
-                {0f, "%#+01.6a",   "+0x0.000000p0"},
-                {0f, "%-+8.4a",    "+0x0.0000p0"},
-
-                {1234f, "%a",         "0x1.348p10"},
-                {1234f, "%#.3a",      "0x1.348p10"},
-                {1234f, "%5a",        "0x1.348p10"},
-                {1234f, "%- 12.0a",   " 0x1.3p10   "},
-                {1234f, "%#+01.6a",   "+0x1.348000p10"},
-                {1234f, "%-+8.4a",    "+0x1.3480p10"},
-
-                {1.f, "%a",         "0x1.0p0"},
-                {1.f, "%#.3a",      "0x1.000p0"},
-                {1.f, "%5a",        "0x1.0p0"},
-                {1.f, "%- 12.0a",   " 0x1.0p0    "},
-                {1.f, "%#+01.6a",   "+0x1.000000p0"},
-                {1.f, "%-+8.4a",    "+0x1.0000p0"},
-
-                {-98f, "%a",         "-0x1.88p6"},
-                {-98f, "%#.3a",      "-0x1.880p6"},
-                {-98f, "%5a",        "-0x1.88p6"},
-                {-98f, "%- 12.0a",   "-0x1.8p6    "},
-                {-98f, "%#+01.6a",   "-0x1.880000p6"},
-                {-98f, "%-+8.4a",    "-0x1.8800p6"},
-
-                {345.1234567f, "%a",         "0x1.591f9ap8"},
-                {345.1234567f, "%5a",        "0x1.591f9ap8"},
-                {345.1234567f, "%#+01.6a",   "+0x1.591f9ap8"},
-
-                {-987654321.1234567f, "%a",         "-0x1.d6f346p29"},
-                {-987654321.1234567f, "%#.3a",      "-0x1.d6fp29"},
-                {-987654321.1234567f, "%5a",        "-0x1.d6f346p29"},
-                {-987654321.1234567f, "%- 12.0a",   "-0x1.dp29   "},
-                {-987654321.1234567f, "%#+01.6a",   "-0x1.d6f346p29"},
-                {-987654321.1234567f, "%-+8.4a",    "-0x1.d6f3p29"},
-
-                {Float.MAX_VALUE, "%a",         "0x1.fffffep127"},
-                {Float.MAX_VALUE, "%5a",        "0x1.fffffep127"},
-                {Float.MAX_VALUE, "%#+01.6a",   "+0x1.fffffep127"},
-
-                {Float.NaN, "%a",         "NaN"},
-                {Float.NaN, "%#.3a",      "NaN"},
-                {Float.NaN, "%5a",        "  NaN"},
-                {Float.NaN, "%- 12.0a",   "NaN         "},
-                {Float.NaN, "%#+01.6a",   "NaN"},
-                {Float.NaN, "%-+8.4a",    "NaN     "},
-
-                {Float.NEGATIVE_INFINITY, "%a",         "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%#.3a",      "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%5a",        "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%- 12.0a",   "-Infinity   "},
-                {Float.NEGATIVE_INFINITY, "%#+01.6a",   "-Infinity"},
-                {Float.NEGATIVE_INFINITY, "%-+8.4a",    "-Infinity"},
-
-                {Float.POSITIVE_INFINITY, "%a",         "Infinity"},
-                {Float.POSITIVE_INFINITY, "%#.3a",      "Infinity"},
-                {Float.POSITIVE_INFINITY, "%5a",        "Infinity"},
-                {Float.POSITIVE_INFINITY, "%- 12.0a",   " Infinity   "},
-                {Float.POSITIVE_INFINITY, "%#+01.6a",   "+Infinity"},
-                {Float.POSITIVE_INFINITY, "%-+8.4a",    "+Infinity"},
-
-                {-0d, "%a",         "-0x0.0p0"},
-                {-0d, "%#.3a",      "-0x0.000p0"},
-                {-0d, "%5a",        "-0x0.0p0"},
-                {-0d, "%- 12.0a",   "-0x0.0p0    "},
-                {-0d, "%#+01.6a",   "-0x0.000000p0"},
-                {-0d, "%-+8.4a",    "-0x0.0000p0"},
-
-                {0d, "%a",         "0x0.0p0"},
-                {0d, "%#.3a",      "0x0.000p0"},
-                {0d, "%5a",        "0x0.0p0"},
-                {0d, "%- 12.0a",   " 0x0.0p0    "},
-                {0d, "%#+01.6a",   "+0x0.000000p0"},
-                {0d, "%-+8.4a",    "+0x0.0000p0"},
-
-                {1d, "%a",         "0x1.0p0"},
-                {1d, "%#.3a",      "0x1.000p0"},
-                {1d, "%5a",        "0x1.0p0"},
-                {1d, "%- 12.0a",   " 0x1.0p0    "},
-                {1d, "%#+01.6a",   "+0x1.000000p0"},
-                {1d, "%-+8.4a",    "+0x1.0000p0"},
-
-                {-1d, "%a",         "-0x1.0p0"},
-                {-1d, "%#.3a",      "-0x1.000p0"},
-                {-1d, "%5a",        "-0x1.0p0"},
-                {-1d, "%- 12.0a",   "-0x1.0p0    "},
-                {-1d, "%#+01.6a",   "-0x1.000000p0"},
-                {-1d, "%-+8.4a",    "-0x1.0000p0"},
-
-                {.00000001d, "%a",         "0x1.5798ee2308c3ap-27"},
-                {.00000001d, "%5a",        "0x1.5798ee2308c3ap-27"},
-                {.00000001d, "%- 12.0a",   " 0x1.5p-27  "},
-                {.00000001d, "%#+01.6a",   "+0x1.5798eep-27"},
-
-                {1000.10d, "%a",         "0x1.f40cccccccccdp9"},
-                {1000.10d, "%5a",        "0x1.f40cccccccccdp9"},
-                {1000.10d, "%- 12.0a",   " 0x1.fp9    "},
-
-                {0.1d, "%a",         "0x1.999999999999ap-4"},
-                {0.1d, "%5a",        "0x1.999999999999ap-4"},
-
-                {-2.d, "%a",         "-0x1.0p1"},
-                {-2.d, "%#.3a",      "-0x1.000p1"},
-                {-2.d, "%5a",        "-0x1.0p1"},
-                {-2.d, "%- 12.0a",   "-0x1.0p1    "},
-                {-2.d, "%#+01.6a",   "-0x1.000000p1"},
-                {-2.d, "%-+8.4a",    "-0x1.0000p1"},
-
-                {-.00009d, "%a",         "-0x1.797cc39ffd60fp-14"},
-                {-.00009d, "%5a",        "-0x1.797cc39ffd60fp-14"},
-
-                {-1234567890.012345678d, "%a",         "-0x1.26580b480ca46p30"},
-                {-1234567890.012345678d, "%5a",        "-0x1.26580b480ca46p30"},
-                {-1234567890.012345678d, "%- 12.0a",   "-0x1.2p30   "},
-                {-1234567890.012345678d, "%#+01.6a",   "-0x1.26580bp30"},
-                {-1234567890.012345678d, "%-+8.4a",    "-0x1.2658p30"},
-
-                {Double.MAX_VALUE, "%a",         "0x1.fffffffffffffp1023"},
-                {Double.MAX_VALUE, "%5a",        "0x1.fffffffffffffp1023"},
-
-                {Double.MIN_VALUE, "%a",         "0x0.0000000000001p-1022"},
-                {Double.MIN_VALUE, "%5a",        "0x0.0000000000001p-1022"},
-
-                {Double.NaN, "%a",         "NaN"},
-                {Double.NaN, "%#.3a",      "NaN"},
-                {Double.NaN, "%5a",        "  NaN"},
-                {Double.NaN, "%- 12.0a",   "NaN         "},
-                {Double.NaN, "%#+01.6a",   "NaN"},
-                {Double.NaN, "%-+8.4a",    "NaN     "},
-
-                {Double.NEGATIVE_INFINITY, "%a",         "-Infinity"},
-                {Double.NEGATIVE_INFINITY, "%#.3a",      "-Infinity"},
-                {Double.NEGATIVE_INFINITY, "%5a",        "-Infinity"},
-                {Double.NEGATIVE_INFINITY, "%- 12.0a",   "-Infinity   "},
-                {Double.NEGATIVE_INFINITY, "%#+01.6a",   "-Infinity"},
-                {Double.NEGATIVE_INFINITY, "%-+8.4a",    "-Infinity"},
-
-                {Double.POSITIVE_INFINITY, "%a",         "Infinity"},
-                {Double.POSITIVE_INFINITY, "%#.3a",      "Infinity"},
-                {Double.POSITIVE_INFINITY, "%5a",        "Infinity"},
-                {Double.POSITIVE_INFINITY, "%- 12.0a",   " Infinity   "},
-                {Double.POSITIVE_INFINITY, "%#+01.6a",   "+Infinity"},
-                {Double.POSITIVE_INFINITY, "%-+8.4a",    "+Infinity"},
-
-        };
-        final int input   = 0;
-        final int pattern = 1;
-        final int output  = 2;
-            for (int i = 0; i < tripleA.length; i++) {
-                f = new Formatter(Locale.UK);
-                f.format((String)tripleA[i][pattern], tripleA[i][input]);
-                assertEquals("triple[" + i + "]:" + tripleA[i][input] + ",pattern["
-                        + i + "]:" + tripleA[i][pattern],
-                        tripleA[i][output], f.toString());
-
-                // test for conversion type 'A'
-                f = new Formatter(Locale.UK);
-                f.format(((String)tripleA[i][pattern]).toUpperCase(), tripleA[i][input]);
-                assertEquals("triple[" + i + "]:" + tripleA[i][input] + ",pattern["
-                        + i + "]:" + tripleA[i][pattern], ((String)tripleA[i][output])
-                        .toUpperCase(Locale.UK), f.toString());
-            }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for BigDecimal
-     *        conversion type 'e' and 'E'
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_BigDecimalConversionE() {
-        Formatter f = null;
-        final Object[][] tripleE = {
-                {BigDecimal.ZERO, "%e",         "0.000000e+00"},
-                {BigDecimal.ZERO, "%#.0e",      "0.e+00"},
-                {BigDecimal.ZERO, "%# 9.8e",    " 0.00000000e+00"},
-                {BigDecimal.ZERO, "%#+0(8.4e",  "+0.0000e+00"},
-                {BigDecimal.ZERO, "%-+17.6e",   "+0.000000e+00    "},
-                {BigDecimal.ZERO, "% 0(20e",    " 00000000.000000e+00"},
-
-                {BigDecimal.ONE, "%e",         "1.000000e+00"},
-                {BigDecimal.ONE, "%#.0e",      "1.e+00"},
-                {BigDecimal.ONE, "%# 9.8e",    " 1.00000000e+00"},
-                {BigDecimal.ONE, "%#+0(8.4e",  "+1.0000e+00"},
-                {BigDecimal.ONE, "%-+17.6e",   "+1.000000e+00    "},
-                {BigDecimal.ONE, "% 0(20e",    " 00000001.000000e+00"},
-
-                {BigDecimal.TEN, "%e",         "1.000000e+01"},
-                {BigDecimal.TEN, "%#.0e",      "1.e+01"},
-                {BigDecimal.TEN, "%# 9.8e",    " 1.00000000e+01"},
-                {BigDecimal.TEN, "%#+0(8.4e",  "+1.0000e+01"},
-                {BigDecimal.TEN, "%-+17.6e",   "+1.000000e+01    "},
-                {BigDecimal.TEN, "% 0(20e",    " 00000001.000000e+01"},
-
-                {new BigDecimal(-1), "%e",         "-1.000000e+00"},
-                {new BigDecimal(-1), "%#.0e",      "-1.e+00"},
-                {new BigDecimal(-1), "%# 9.8e",    "-1.00000000e+00"},
-                {new BigDecimal(-1), "%#+0(8.4e",  "(1.0000e+00)"},
-                {new BigDecimal(-1), "%-+17.6e",   "-1.000000e+00    "},
-                {new BigDecimal(-1), "% 0(20e",    "(0000001.000000e+00)"},
-
-                {new BigDecimal("5.000E999"), "%e",         "5.000000e+999"},
-                {new BigDecimal("5.000E999"), "%#.0e",      "5.e+999"},
-                {new BigDecimal("5.000E999"), "%# 9.8e",    " 5.00000000e+999"},
-                {new BigDecimal("5.000E999"), "%#+0(8.4e",  "+5.0000e+999"},
-                {new BigDecimal("5.000E999"), "%-+17.6e",   "+5.000000e+999   "},
-                {new BigDecimal("5.000E999"), "% 0(20e",    " 0000005.000000e+999"},
-
-                {new BigDecimal("-5.000E999"), "%e",         "-5.000000e+999"},
-                {new BigDecimal("-5.000E999"), "%#.0e",      "-5.e+999"},
-                {new BigDecimal("-5.000E999"), "%# 9.8e",    "-5.00000000e+999"},
-                {new BigDecimal("-5.000E999"), "%#+0(8.4e",  "(5.0000e+999)"},
-                {new BigDecimal("-5.000E999"), "%-+17.6e",   "-5.000000e+999   "},
-                {new BigDecimal("-5.000E999"), "% 0(20e",    "(000005.000000e+999)"},
-        };
-        final int input   = 0;
-        final int pattern = 1;
-        final int output  = 2;
-            for (int i = 0; i < tripleE.length; i++) {
-                f = new Formatter(Locale.US);
-                f.format((String)tripleE[i][pattern], tripleE[i][input]);
-                assertEquals("triple[" + i + "]:" + tripleE[i][input] + ",pattern["
-                        + i + "]:" + tripleE[i][pattern],
-                        tripleE[i][output], f.toString());
-
-                // test for conversion type 'E'
-                f = new Formatter(Locale.US);
-                f.format(((String)tripleE[i][pattern]).toUpperCase(), tripleE[i][input]);
-                assertEquals("triple[" + i + "]:" + tripleE[i][input] + ",pattern["
-                        + i + "]:" + tripleE[i][pattern], ((String)tripleE[i][output])
-                        .toUpperCase(Locale.US), f.toString());
-            }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for BigDecimal
-     *        conversion type 'g' and 'G'
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_BigDecimalConversionG() {
-        Formatter f = null;
-        final Object[][] tripleG = {
-                {BigDecimal.ZERO, "%g",         "0.00000"},
-                {BigDecimal.ZERO, "%.5g",       "0.0000"},
-                {BigDecimal.ZERO, "%- (,9.8g",  " 0.0000000"},
-                {BigDecimal.ZERO, "%+0(,8.4g",  "+000.000"},
-                {BigDecimal.ZERO, "%-+10.6g",   "+0.00000  "},
-                {BigDecimal.ZERO, "% 0(,12.0g", " 00000000000"},
-                {BigDecimal.ONE, "%g",          "1.00000"},
-                {BigDecimal.ONE, "%.5g",        "1.0000"},
-                {BigDecimal.ONE, "%- (,9.8g",   " 1.0000000"},
-                {BigDecimal.ONE, "%+0(,8.4g",   "+001.000"},
-                {BigDecimal.ONE, "%-+10.6g",    "+1.00000  "},
-                {BigDecimal.ONE, "% 0(,12.0g",  " 00000000001"},
-
-                {new BigDecimal(-1), "%g",          "-1.00000"},
-                {new BigDecimal(-1), "%.5g",        "-1.0000"},
-                {new BigDecimal(-1), "%- (,9.8g",   "(1.0000000)"},
-                {new BigDecimal(-1), "%+0(,8.4g",   "(01.000)"},
-                {new BigDecimal(-1), "%-+10.6g",    "-1.00000  "},
-                {new BigDecimal(-1), "% 0(,12.0g",  "(0000000001)"},
-
-                {new BigDecimal(-0.000001), "%g",           "-1.00000e-06"},
-                {new BigDecimal(-0.000001), "%.5g",         "-1.0000e-06"},
-                {new BigDecimal(-0.000001), "%- (,9.8g",    "(1.0000000e-06)"},
-                {new BigDecimal(-0.000001), "%+0(,8.4g",    "(1.000e-06)"},
-                {new BigDecimal(-0.000001), "%-+10.6g",     "-1.00000e-06"},
-                {new BigDecimal(-0.000001), "% 0(,12.0g",   "(000001e-06)"},
-
-                {new BigDecimal(0.0002), "%g",          "0.000200000"},
-                {new BigDecimal(0.0002), "%.5g",        "0.00020000"},
-                {new BigDecimal(0.0002), "%- (,9.8g",   " 0.00020000000"},
-                {new BigDecimal(0.0002), "%+0(,8.4g",   "+0.0002000"},
-                {new BigDecimal(0.0002), "%-+10.6g",    "+0.000200000"},
-                {new BigDecimal(0.0002), "% 0(,12.0g",  " 000000.0002"},
-
-                {new BigDecimal(-0.003), "%g",          "-0.00300000"},
-                {new BigDecimal(-0.003), "%.5g",        "-0.0030000"},
-                {new BigDecimal(-0.003), "%- (,9.8g",   "(0.0030000000)"},
-                {new BigDecimal(-0.003), "%+0(,8.4g",   "(0.003000)"},
-                {new BigDecimal(-0.003), "%-+10.6g",    "-0.00300000"},
-                {new BigDecimal(-0.003), "% 0(,12.0g",  "(000000.003)"},
-
-                {new BigDecimal("5.000E999"), "%g",             "5.00000e+999"},
-                {new BigDecimal("5.000E999"), "%.5g",           "5.0000e+999"},
-                {new BigDecimal("5.000E999"), "%- (,9.8g",      " 5.0000000e+999"},
-                {new BigDecimal("5.000E999"), "%+0(,8.4g",      "+5.000e+999"},
-                {new BigDecimal("5.000E999"), "%-+10.6g",       "+5.00000e+999"},
-                {new BigDecimal("5.000E999"), "% 0(,12.0g",     " 000005e+999"},
-
-                {new BigDecimal("-5.000E999"), "%g",            "-5.00000e+999"},
-                {new BigDecimal("-5.000E999"), "%.5g",          "-5.0000e+999"},
-                {new BigDecimal("-5.000E999"), "%- (,9.8g",     "(5.0000000e+999)"},
-                {new BigDecimal("-5.000E999"), "%+0(,8.4g",     "(5.000e+999)"},
-                {new BigDecimal("-5.000E999"), "%-+10.6g",      "-5.00000e+999"},
-                {new BigDecimal("-5.000E999"), "% 0(,12.0g",    "(00005e+999)"},
-        };
-        final int input   = 0;
-        final int pattern = 1;
-        final int output  = 2;
-            for (int i = 0; i < tripleG.length; i++) {
-                f = new Formatter(Locale.US);
-                f.format((String)tripleG[i][pattern], tripleG[i][input]);
-                assertEquals("triple[" + i + "]:" + tripleG[i][input] + ",pattern["
-                        + i + "]:" + tripleG[i][pattern],
-                        tripleG[i][output], f.toString());
-
-                // test for conversion type 'G'
-                f = new Formatter(Locale.US);
-                f.format(((String)tripleG[i][pattern]).toUpperCase(), tripleG[i][input]);
-                assertEquals("triple[" + i + "]:" + tripleG[i][input] + ",pattern["
-                        + i + "]:" + tripleG[i][pattern], ((String)tripleG[i][output])
-                        .toUpperCase(Locale.US), f.toString());
-            }
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%- (,9.6g", new BigDecimal("4E6"));
-        /*
-         * fail on RI, spec says 'g' requires the output to be formatted in
-         * general scientific notation and the localization algorithm is
-         * applied. But RI format this case to 4.00000e+06, which does not
-         * conform to the German Locale
-         */
-        assertEquals(" 4,00000e+06", f.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for BigDecimal
-     *        conversion type 'f'
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_BigDecimalConversionF() {
-
-        Formatter f = null;
-        final int input   = 0;
-        final int pattern = 1;
-        final int output  = 2;
-        final Object[][] tripleF = {
-                {BigDecimal.ZERO,                                               "%f",           "0.000000"},
-                {BigDecimal.ZERO,                                               "%#.3f",        "0.000"},
-                {BigDecimal.ZERO,                                               "%#,5f",        "0.000000"},
-                {BigDecimal.ZERO,                                               "%- #(12.0f",   " 0.         "},
-                {BigDecimal.ZERO,                                               "%#+0(1.6f",    "+0.000000"},
-                {BigDecimal.ZERO,                                               "%-+(8.4f",     "+0.0000 "},
-                {BigDecimal.ZERO,                                               "% 0#(9.8f",    " 0.00000000"},
-                {BigDecimal.ONE,                                                "%f",           "1.000000"},
-                {BigDecimal.ONE,                                                "%#.3f",        "1.000"},
-                {BigDecimal.ONE,                                                "%#,5f",        "1.000000"},
-                {BigDecimal.ONE,                                                "%- #(12.0f",   " 1.         "},
-                {BigDecimal.ONE,                                                "%#+0(1.6f",    "+1.000000"},
-                {BigDecimal.ONE,                                                "%-+(8.4f",     "+1.0000 "},
-                {BigDecimal.ONE,                                                "% 0#(9.8f",    " 1.00000000"},
-                {BigDecimal.TEN,                                                "%f",           "10.000000"},
-                {BigDecimal.TEN,                                                "%#.3f",        "10.000"},
-                {BigDecimal.TEN,                                                "%#,5f",        "10.000000"},
-                {BigDecimal.TEN,                                                "%- #(12.0f",   " 10.        "},
-                {BigDecimal.TEN,                                                "%#+0(1.6f",    "+10.000000"},
-                {BigDecimal.TEN,                                                "%-+(8.4f",     "+10.0000"},
-                {BigDecimal.TEN,                                                "% 0#(9.8f",    " 10.00000000"},
-                {new BigDecimal(-1),                                            "%f",           "-1.000000"},
-                {new BigDecimal(-1),                                            "%#.3f",        "-1.000"},
-                {new BigDecimal(-1),                                            "%#,5f",        "-1.000000"},
-                {new BigDecimal(-1),                                            "%- #(12.0f",   "(1.)        "},
-                {new BigDecimal(-1),                                            "%#+0(1.6f",    "(1.000000)"},
-                {new BigDecimal(-1),                                            "%-+(8.4f",     "(1.0000)"},
-                {new BigDecimal(-1),                                            "% 0#(9.8f",    "(1.00000000)"},
-                {new BigDecimal("9999999999999999999999999999999999999999999"), "%f",           "9999999999999999999999999999999999999999999.000000"},
-                {new BigDecimal("9999999999999999999999999999999999999999999"), "%#.3f",        "9999999999999999999999999999999999999999999.000"},
-                {new BigDecimal("9999999999999999999999999999999999999999999"), "%#,5f",        "9,999,999,999,999,999,999,999,999,999,999,999,999,999,999.000000"},
-                {new BigDecimal("9999999999999999999999999999999999999999999"), "%- #(12.0f",   " 9999999999999999999999999999999999999999999."},
-                {new BigDecimal("9999999999999999999999999999999999999999999"), "%#+0(1.6f",    "+9999999999999999999999999999999999999999999.000000"},
-                {new BigDecimal("9999999999999999999999999999999999999999999"), "%-+(8.4f",     "+9999999999999999999999999999999999999999999.0000"},
-                {new BigDecimal("9999999999999999999999999999999999999999999"), "% 0#(9.8f",    " 9999999999999999999999999999999999999999999.00000000"},
-                {new BigDecimal("-9999999999999999999999999999999999999999999"), "%f",          "-9999999999999999999999999999999999999999999.000000"},
-                {new BigDecimal("-9999999999999999999999999999999999999999999"), "%#.3f",       "-9999999999999999999999999999999999999999999.000"},
-                {new BigDecimal("-9999999999999999999999999999999999999999999"), "%#,5f",       "-9,999,999,999,999,999,999,999,999,999,999,999,999,999,999.000000"},
-                {new BigDecimal("-9999999999999999999999999999999999999999999"), "%- #(12.0f",  "(9999999999999999999999999999999999999999999.)"},
-                {new BigDecimal("-9999999999999999999999999999999999999999999"), "%#+0(1.6f",   "(9999999999999999999999999999999999999999999.000000)"},
-                {new BigDecimal("-9999999999999999999999999999999999999999999"), "%-+(8.4f",    "(9999999999999999999999999999999999999999999.0000)"},
-                {new BigDecimal("-9999999999999999999999999999999999999999999"), "% 0#(9.8f",   "(9999999999999999999999999999999999999999999.00000000)"},
-        };
-        for (int i = 0; i < tripleF.length; i++) {
-            f = new Formatter(Locale.US);
-            f.format((String)tripleF[i][pattern], tripleF[i][input]);
-            assertEquals("triple[" + i + "]:" + tripleF[i][input] + ",pattern["
-                    + i + "]:" + tripleF[i][pattern], tripleF[i][output], f.toString());
-        }
-
-        f = new Formatter(Locale.US);
-        f.format("%f", new BigDecimal("5.0E9"));
-        // error on RI
-        // RI throw ArrayIndexOutOfBoundsException
-        assertEquals("5000000000.000000", f.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for exceptions in
-     *        Float/Double/BigDecimal conversion type 'e', 'E', 'g', 'G', 'f', 'a', 'A'
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatDoubleBigDecimalConversionException() {
-        Formatter f = null;
-
-        final char[] conversions = { 'e', 'E', 'g', 'G', 'f', 'a', 'A' };
-        final Object[] illArgs = { false, (byte) 1, (short) 2, 3, (long) 4,
-                new BigInteger("5"), new Character('c'), new Object(),
-                new Date() };
-        for (int i = 0; i < illArgs.length; i++) {
-            for (int j = 0; j < conversions.length; j++) {
-                try {
-                    f = new Formatter(Locale.UK);
-                    f.format("%" + conversions[j], illArgs[i]);
-                    fail("should throw IllegalFormatConversionException");
-                } catch (IllegalFormatConversionException e) {
-                    // expected
-                }
-            }
-        }
-
-        try {
-            f = new Formatter(Locale.UK);
-            f.format("%a", new BigDecimal(1));
-            fail("should throw IllegalFormatConversionException");
-        } catch (IllegalFormatConversionException e) {
-            // expected
-        }
-
-        try {
-            f = new Formatter(Locale.UK);
-            f.format("%A", new BigDecimal(1));
-            fail("should throw IllegalFormatConversionException");
-        } catch (IllegalFormatConversionException e) {
-            // expected
-        }
-
-        final String[] flagsConversionMismatches = { "%,e", "%,E", "%#g",
-                "%#G", "%,a", "%,A", "%(a", "%(A" };
-        for (int i = 0; i < flagsConversionMismatches.length; i++) {
-            try {
-                f = new Formatter(Locale.CHINA);
-                f.format(flagsConversionMismatches[i], new BigDecimal(1));
-                fail("should throw FormatFlagsConversionMismatchException");
-            } catch (FormatFlagsConversionMismatchException e) {
-                // expected
-            }
-            try {
-                f = new Formatter(Locale.JAPAN);
-                f.format(flagsConversionMismatches[i], (BigDecimal) null);
-                fail("should throw FormatFlagsConversionMismatchException");
-            } catch (FormatFlagsConversionMismatchException e) {
-                // expected
-            }
-        }
-
-        final String[] missingFormatWidths = { "%-0e", "%0e", "%-e", "%-0E",
-                "%0E", "%-E", "%-0g", "%0g", "%-g", "%-0G", "%0G", "%-G",
-                "%-0f", "%0f", "%-f", "%-0a", "%0a", "%-a", "%-0A", "%0A",
-                "%-A" };
-        for (int i = 0; i < missingFormatWidths.length; i++) {
-            try {
-                f = new Formatter(Locale.KOREA);
-                f.format(missingFormatWidths[i], 1f);
-                fail("should throw MissingFormatWidthException");
-            } catch (MissingFormatWidthException e) {
-                // expected
-            }
-
-            try {
-                f = new Formatter(Locale.KOREA);
-                f.format(missingFormatWidths[i], (Float) null);
-                fail("should throw MissingFormatWidthException");
-            } catch (MissingFormatWidthException e) {
-                // expected
-            }
-        }
-
-        final String[] illFlags = { "%+ e", "%+ E", "%+ g", "%+ G", "%+ f",
-                "%+ a", "%+ A", "%-03e", "%-03E", "%-03g", "%-03G", "%-03f",
-                "%-03a", "%-03A" };
-        for (int i = 0; i < illFlags.length; i++) {
-            try {
-                f = new Formatter(Locale.CANADA);
-                f.format(illFlags[i], 1.23d);
-                fail("should throw IllegalFormatFlagsException");
-            } catch (IllegalFormatFlagsException e) {
-                // expected
-            }
-
-            try {
-                f = new Formatter(Locale.CANADA);
-                f.format(illFlags[i], (Double) null);
-                fail("should throw IllegalFormatFlagsException");
-            } catch (IllegalFormatFlagsException e) {
-                // expected
-            }
-        }
-
-        f = new Formatter(Locale.US);
-        try {
-            f.format("%F", 1);
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for
-     *        Float/Double/BigDecimal exception throwing order
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatDoubleBigDecimalExceptionOrder() {
-        Formatter f = null;
-
-        /*
-         * Summary: UnknownFormatConversionException >
-         * MissingFormatWidthException > IllegalFormatFlagsException >
-         * FormatFlagsConversionMismatchException >
-         * IllegalFormatConversionException
-         *
-         */
-        try {
-            // compare FormatFlagsConversionMismatchException and
-            // IllegalFormatConversionException
-            f = new Formatter(Locale.US);
-            f.format("%,e", (byte) 1);
-            fail("should throw FormatFlagsConversionMismatchException");
-        } catch (FormatFlagsConversionMismatchException e) {
-            // expected
-        }
-
-        try {
-            // compare IllegalFormatFlagsException and
-            // FormatFlagsConversionMismatchException
-            f = new Formatter(Locale.US);
-            f.format("%+ ,e", 1f);
-            fail("should throw IllegalFormatFlagsException");
-        } catch (IllegalFormatFlagsException e) {
-            // expected
-        }
-
-        try {
-            // compare MissingFormatWidthException and
-            // IllegalFormatFlagsException
-            f = new Formatter(Locale.US);
-            f.format("%+ -e", 1f);
-            fail("should throw MissingFormatWidthException");
-        } catch (MissingFormatWidthException e) {
-            // expected
-        }
-
-        try {
-            // compare UnknownFormatConversionException and
-            // MissingFormatWidthException
-            f = new Formatter(Locale.US);
-            f.format("%-F", 1f);
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for BigDecimal
-     *        exception throwing order
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_BigDecimalExceptionOrder() {
-        Formatter f = null;
-        BigDecimal bd = new BigDecimal("1.0");
-
-        /*
-         * Summary: UnknownFormatConversionException >
-         * MissingFormatWidthException > IllegalFormatFlagsException >
-         * FormatFlagsConversionMismatchException >
-         * IllegalFormatConversionException
-         *
-         */
-        try {
-            // compare FormatFlagsConversionMismatchException and
-            // IllegalFormatConversionException
-            f = new Formatter(Locale.US);
-            f.format("%,e", (byte) 1);
-            fail("should throw FormatFlagsConversionMismatchException");
-        } catch (FormatFlagsConversionMismatchException e) {
-            // expected
-        }
-
-        try {
-            // compare IllegalFormatFlagsException and
-            // FormatFlagsConversionMismatchException
-            f = new Formatter(Locale.US);
-            f.format("%+ ,e", bd);
-            fail("should throw IllegalFormatFlagsException");
-        } catch (IllegalFormatFlagsException e) {
-            // expected
-        }
-
-        try {
-            // compare MissingFormatWidthException and
-            // IllegalFormatFlagsException
-            f = new Formatter(Locale.US);
-            f.format("%+ -e", bd);
-            fail("should throw MissingFormatWidthException");
-        } catch (MissingFormatWidthException e) {
-            // expected
-        }
-
-        // compare UnknownFormatConversionException and
-        // MissingFormatWidthException
-        try {
-            f = new Formatter(Locale.US);
-            f.format("%-F", bd);
-            fail("should throw UnknownFormatConversionException");
-        } catch (UnknownFormatConversionException e) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests java.util.Formatter#format(String, Object...) for null argment for
-     *        Float/Double/BigDecimal conversion
-     */
-    public void test_formatLjava_lang_String$Ljava_lang_Object_FloatDoubleBigDecimalNullConversion() {
-        Formatter f = null;
-
-        // test (Float)null
-        f = new Formatter(Locale.FRANCE);
-        f.format("%#- (9.0e", (Float) null);
-        assertEquals("         ", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%-+(1.6E", (Float) null);
-        assertEquals("NULL", f.toString());
-
-        f = new Formatter(Locale.UK);
-        f.format("%+0(,8.4g", (Float) null);
-        assertEquals("    null", f.toString());
-
-        f = new Formatter(Locale.FRANCE);
-        f.format("%- (9.8G", (Float) null);
-        assertEquals("NULL     ", f.toString());
-
-        f = new Formatter(Locale.FRANCE);
-        f.format("%- (12.1f", (Float) null);
-        assertEquals("n           ", f.toString());
-
-        f = new Formatter(Locale.FRANCE);
-        f.format("% .4a", (Float) null);
-        assertEquals("null", f.toString());
-
-        f = new Formatter(Locale.FRANCE);
-        f.format("%06A", (Float) null);
-        assertEquals("  NULL", f.toString());
-
-        // test (Double)null
-        f = new Formatter(Locale.GERMAN);
-        f.format("%- (9e", (Double) null);
-        assertEquals("null     ", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%#-+(1.6E", (Double) null);
-        assertEquals("NULL", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%+0(6.4g", (Double) null);
-        assertEquals("  null", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%- (,5.8G", (Double) null);
-        assertEquals("NULL ", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("% (.4f", (Double) null);
-        assertEquals("null", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("%#.6a", (Double) null);
-        assertEquals("null", f.toString());
-
-        f = new Formatter(Locale.GERMAN);
-        f.format("% 2.5A", (Double) null);
-        assertEquals("NULL", f.toString());
-
-        // test (BigDecimal)null
-        f = new Formatter(Locale.UK);
-        f.format("%#- (6.2e", (BigDecimal) null);
-        assertEquals("nu    ", f.toString());
-
-        f = new Formatter(Locale.UK);
-        f.format("%-+(1.6E", (BigDecimal) null);
-        assertEquals("NULL", f.toString());
-
-        f = new Formatter(Locale.UK);
-        f.format("%+-(,5.3g", (BigDecimal) null);
-        assertEquals("nul  ", f.toString());
-
-        f = new Formatter(Locale.UK);
-        f.format("%0 3G", (BigDecimal) null);
-        assertEquals("NULL", f.toString());
-
-        f = new Formatter(Locale.UK);
-        f.format("%0 (9.0G", (BigDecimal) null);
-        assertEquals("         ", f.toString());
-
-        f = new Formatter(Locale.UK);
-        f.format("% (.5f", (BigDecimal) null);
-        assertEquals("null", f.toString());
-
-        f = new Formatter(Locale.UK);
-        f.format("%06a", (BigDecimal) null);
-        assertEquals("  null", f.toString());
-
-        f = new Formatter(Locale.UK);
-        f.format("% .5A", (BigDecimal) null);
-        assertEquals("NULL", f.toString());
-    }
-
-    /**
-     * @tests java.util.Formatter.BigDecimalLayoutForm#values()
-     */
-    public void test_values() {
-        BigDecimalLayoutForm[] vals = BigDecimalLayoutForm.values();
-        assertEquals("Invalid length of enum values", 2, vals.length);
-        assertEquals("Wrong scientific value in enum", BigDecimalLayoutForm.SCIENTIFIC, vals[0]);
-        assertEquals("Wrong dec float value in enum", BigDecimalLayoutForm.DECIMAL_FLOAT, vals[1]);
-    }
-
-    /**
-     * @tests java.util.Formatter.BigDecimalLayoutForm#valueOf(String)
-     */
-    public void test_valueOfLjava_lang_String() {
-        BigDecimalLayoutForm sci = BigDecimalLayoutForm.valueOf("SCIENTIFIC");
-        assertEquals("Wrong scientific value in enum", BigDecimalLayoutForm.SCIENTIFIC, sci);
-
-        BigDecimalLayoutForm decFloat = BigDecimalLayoutForm.valueOf("DECIMAL_FLOAT");
-        assertEquals("Wrong dec float value from valueOf ", BigDecimalLayoutForm.DECIMAL_FLOAT, decFloat);
-    }
-
-    /*
-     * Regression test for Harmony-5845
-     * test the short name for timezone whether uses DaylightTime or not
-     */
-    public void test_DaylightTime() {
-        Calendar c1 = new GregorianCalendar(2007, 0, 1);
-        Calendar c2 = new GregorianCalendar(2007, 7, 1);
-
-        for (String tz : TimeZone.getAvailableIDs()) {
-            if (tz.equals("America/Los_Angeles")) {
-                c1.setTimeZone(TimeZone.getTimeZone(tz));
-                c2.setTimeZone(TimeZone.getTimeZone(tz));
-                assertTrue(String.format("%1$tZ%2$tZ", c1, c2).equals("PSTPDT"));
-            }
-            if (tz.equals("America/Panama")) {
-                c1.setTimeZone(TimeZone.getTimeZone(tz));
-                c2.setTimeZone(TimeZone.getTimeZone(tz));
-                assertTrue(String.format("%1$tZ%2$tZ", c1, c2).equals("ESTEST"));
-            }
-        }
-    }
-
-    /*
-     * Regression test for Harmony-5845
-     * test scientific notation to follow RI's behavior
-     */
-    public void test_ScientificNotation() {
-        Formatter f = new Formatter();
-        MathContext mc = new MathContext(30);
-        BigDecimal value = new BigDecimal(0.1, mc);
-        f.format("%.30G", value);
-
-        String result = f.toString();
-        String expected = "0.100000000000000005551115123126";
-        assertEquals(expected, result);
-    }
-
-
-    /**
-     * Setup resource files for testing
-     */
-    protected void setUp() throws IOException {
-        root = System.getProperty("user.name").equalsIgnoreCase("root");
-        notExist = File.createTempFile("notexist", null);
-        notExist.delete();
-
-        fileWithContent = File.createTempFile("filewithcontent", null);
-        BufferedOutputStream bw = new BufferedOutputStream(
-                new FileOutputStream(fileWithContent));
-        bw.write(1);// write something into the file
-        bw.close();
-
-        readOnly = File.createTempFile("readonly", null);
-        readOnly.setReadOnly();
-
-        secret = File.createTempFile("secret", null);
-
-        defaultTimeZone = TimeZone.getDefault();
-        TimeZone cst = TimeZone.getTimeZone("Asia/Shanghai");
-        TimeZone.setDefault(cst);
-    }
-
-    /**
-     * Delete the resource files if they exist
-     */
-    protected void tearDown() {
-        if (notExist.exists()) {
-            notExist.delete();
-        }
-
-        if (fileWithContent.exists()) {
-            fileWithContent.delete();
-        }
-        if (readOnly.exists()) {
-            readOnly.delete();
-        }
-        if (secret.exists()) {
-            secret.delete();
-        }
-
-        TimeZone.setDefault(defaultTimeZone);
-    }
-}
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/util/LocaleTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/util/LocaleTest.java
deleted file mode 100644
index facf53e..0000000
--- a/luni/src/test/java/org/apache/harmony/luni/tests/java/util/LocaleTest.java
+++ /dev/null
@@ -1,408 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.harmony.luni.tests.java.util;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Locale;
-import java.util.Set;
-
-public class LocaleTest extends junit.framework.TestCase {
-
-	Locale testLocale;
-
-	Locale l;
-	
-	Locale defaultLocale;
-
-	/**
-	 * @tests java.util.Locale#Locale(java.lang.String, java.lang.String)
-	 */
-	public void test_ConstructorLjava_lang_StringLjava_lang_String() {
-		// Test for method java.util.Locale(java.lang.String, java.lang.String)
-		Locale x = new Locale("xx", "CV");
-		assertTrue("Failed to create Locale", x.getCountry().equals("CV")
-				&& x.getVariant().equals(""));
-	}
-
-	/**
-	 * @tests java.util.Locale#Locale(java.lang.String, java.lang.String,
-	 *        java.lang.String)
-	 */
-	public void test_ConstructorLjava_lang_StringLjava_lang_StringLjava_lang_String() {
-		// Test for method java.util.Locale(java.lang.String, java.lang.String,
-		// java.lang.String)
-		Locale x = new Locale("xx", "CV", "ZZ");
-		assertTrue("Failed to create Locale", x.getLanguage().equals("xx")
-				&& (x.getCountry().equals("CV") && x.getVariant().equals("ZZ")));
-                try {
-                   new Locale(null, "CV", "ZZ");
-                   fail("expected NullPointerException with 1st parameter == null");
-                } catch(NullPointerException e) {
-                }
-
-                try {
-                   new Locale("xx", null, "ZZ");
-                   fail("expected NullPointerException with 2nd parameter == null");
-                } catch(NullPointerException e) {
-                }
-
-                try {
-                   new Locale("xx", "CV", null);
-                   fail("expected NullPointerException with 3rd parameter == null");
-                } catch(NullPointerException e) {
-                }
-	}
-
-	/**
-	 * @tests java.util.Locale#clone()
-	 */
-	public void test_clone() {
-		// Test for method java.lang.Object java.util.Locale.clone()
-		assertTrue("Clone failed", l.clone().equals(l));
-	}
-
-	/**
-	 * @tests java.util.Locale#equals(java.lang.Object)
-	 */
-	public void test_equalsLjava_lang_Object() {
-		// Test for method boolean java.util.Locale.equals(java.lang.Object)
-		Locale l2 = new Locale("en", "CA", "WIN32");
-		assertTrue("Same object returned false", testLocale.equals(testLocale));
-		assertTrue("Same values returned false", testLocale.equals(l2));
-		assertTrue("Different locales returned true", !testLocale.equals(l));
-
-	}
-
-	/**
-     * @tests java.util.Locale#getAvailableLocales()
-     */
-    public void test_getAvailableLocales() {
-        // Test for method java.util.Locale []
-        // java.util.Locale.getAvailableLocales()
-        // Assumes there will generally be about 100+ available locales...
-        Locale[] locales = Locale.getAvailableLocales();
-        assertTrue("Wrong number of locales: ", locales.length > 100);
-        // regression test for HARMONY-1514
-        // HashSet can filter duplicate locales
-        Set<Locale> localesSet = new HashSet<Locale>(Arrays.asList(locales));
-        // Non-bug difference for HARMONY-5442
-        assertTrue(localesSet.size() <= locales.length);
-    }
-
-	/**
-     * @tests java.util.Locale#getCountry()
-     */
-	public void test_getCountry() {
-		// Test for method java.lang.String java.util.Locale.getCountry()
-		assertTrue("Returned incorrect country: " + testLocale.getCountry(),
-				testLocale.getCountry().equals("CA"));
-	}
-
-	/**
-	 * @tests java.util.Locale#getDefault()
-	 */
-	public void test_getDefault() {
-		// Test for method java.util.Locale java.util.Locale.getDefault()
-		assertTrue("returns copy", Locale.getDefault() == Locale.getDefault());
-		Locale org = Locale.getDefault();
-		Locale.setDefault(l);
-		Locale x = Locale.getDefault();
-		Locale.setDefault(org);
-		assertEquals("Failed to get locale", "fr_CA_WIN32", x.toString());
-	}
-
-	/**
-	 * @tests java.util.Locale#getDisplayCountry()
-	 */
-	public void test_getDisplayCountry() {
-		// Test for method java.lang.String java.util.Locale.getDisplayCountry()
-		assertTrue("Returned incorrect country: "
-				+ testLocale.getDisplayCountry(), testLocale
-				.getDisplayCountry().equals("Canada"));
-
-        // Regression for Harmony-1146
-        // Non-bug difference for HARMONY-5442
-        Locale l_countryCD = new Locale("", "CD");
-                assertEquals("Congo - Kinshasa",
-                        l_countryCD.getDisplayCountry());
-	}
-
-	/**
-	 * @tests java.util.Locale#getDisplayCountry(java.util.Locale)
-	 */
-	public void test_getDisplayCountryLjava_util_Locale() {
-		// Test for method java.lang.String
-		// java.util.Locale.getDisplayCountry(java.util.Locale)
-		assertEquals("Returned incorrect country", "Italie", Locale.ITALY
-				.getDisplayCountry(l));
-	}
-
-	/**
-	 * @tests java.util.Locale#getDisplayLanguage()
-	 */
-	public void test_getDisplayLanguage() {
-		// Test for method java.lang.String
-		// java.util.Locale.getDisplayLanguage()
-		assertTrue("Returned incorrect language: "
-				+ testLocale.getDisplayLanguage(), testLocale
-				.getDisplayLanguage().equals("English"));
-
-		// Regression for Harmony-1146
-        Locale l_languageAE = new Locale("ae", "");
-        assertEquals("Avestan", l_languageAE.getDisplayLanguage());
-
-        // Regression for HARMONY-4402
-        Locale defaultLocale = Locale.getDefault();
-        try {
-            Locale locale = new Locale("no", "NO");
-            Locale.setDefault(locale);
-            assertEquals("norsk", locale.getDisplayLanguage());
-        } finally {
-            Locale.setDefault(defaultLocale);
-        }
-	}
-
-	/**
-	 * @tests java.util.Locale#getDisplayLanguage(java.util.Locale)
-	 */
-	public void test_getDisplayLanguageLjava_util_Locale() {
-		// Test for method java.lang.String
-		// java.util.Locale.getDisplayLanguage(java.util.Locale)
-		assertTrue("Returned incorrect language: "
-				+ testLocale.getDisplayLanguage(l), testLocale
-				.getDisplayLanguage(l).equals("anglais"));
-	}
-
-	/**
-	 * @tests java.util.Locale#getDisplayName()
-	 */
-	public void test_getDisplayName() {
-		// Test for method java.lang.String java.util.Locale.getDisplayName()
-		assertTrue("Returned incorrect name: " + testLocale.getDisplayName(),
-				testLocale.getDisplayName().equals("English (Canada,WIN32)"));
-	}
-
-	/**
-	 * @tests java.util.Locale#getDisplayName(java.util.Locale)
-	 */
-	public void test_getDisplayNameLjava_util_Locale() {
-		// Test for method java.lang.String
-		// java.util.Locale.getDisplayName(java.util.Locale)
-		assertTrue("Returned incorrect name: " + testLocale.getDisplayName(l),
-				testLocale.getDisplayName(l).equals("anglais (Canada,WIN32)"));
-	}
-
-	/**
-	 * @tests java.util.Locale#getDisplayVariant()
-	 */
-	public void test_getDisplayVariant() {
-		// Test for method java.lang.String java.util.Locale.getDisplayVariant()
-		assertTrue("Returned incorrect variant: "
-				+ testLocale.getDisplayVariant(), testLocale
-				.getDisplayVariant().equals("WIN32"));
-	}
-
-	/**
-	 * @tests java.util.Locale#getDisplayVariant(java.util.Locale)
-	 */
-	public void test_getDisplayVariantLjava_util_Locale() {
-		// Test for method java.lang.String
-		// java.util.Locale.getDisplayVariant(java.util.Locale)
-		assertTrue("Returned incorrect variant: "
-				+ testLocale.getDisplayVariant(l), testLocale
-				.getDisplayVariant(l).equals("WIN32"));
-	}
-
-	/**
-	 * @tests java.util.Locale#getISO3Country()
-	 */
-	public void test_getISO3Country() {
-		// Test for method java.lang.String java.util.Locale.getISO3Country()
-		assertTrue("Returned incorrect ISO3 country: "
-				+ testLocale.getISO3Country(), testLocale.getISO3Country()
-				.equals("CAN"));
-
-        Locale l = new Locale("", "CD");
-        assertEquals("COD", l.getISO3Country());
-	}
-
-	/**
-	 * @tests java.util.Locale#getISO3Language()
-	 */
-	public void test_getISO3Language() {
-		// Test for method java.lang.String java.util.Locale.getISO3Language()
-		assertTrue("Returned incorrect ISO3 language: "
-				+ testLocale.getISO3Language(), testLocale.getISO3Language()
-				.equals("eng"));
-
-        Locale l = new Locale("ae");
-        assertEquals("ave", l.getISO3Language());
-
-        // Regression for Harmony-1146
-
-        // Non-bug difference for HARMONY-5442
-        Locale l_CountryCS = new Locale("", "CS");
-        assertEquals("SCG", l_CountryCS.getISO3Country());
-
-        // Regression for Harmony-1129
-        l = new Locale("ak", "");
-        assertEquals("aka", l.getISO3Language());
-	}
-
-	/**
-	 * @tests java.util.Locale#getISOCountries()
-	 */
-	public void test_getISOCountries() {
-		// Test for method java.lang.String []
-		// java.util.Locale.getISOCountries()
-		// Assumes all countries are 2 digits, and that there will always be
-		// 230 countries on the list...
-		String[] isoCountries = Locale.getISOCountries();
-		int length = isoCountries.length;
-		int familiarCount = 0;
-		for (int i = 0; i < length; i++) {
-			if (isoCountries[i].length() != 2) {
-				fail("Wrong format for ISOCountries.");
-			}
-			if (isoCountries[i].equals("CA") || isoCountries[i].equals("BB")
-					|| isoCountries[i].equals("US")
-					|| isoCountries[i].equals("KR"))
-				familiarCount++;
-		}
-		assertTrue("ISOCountries missing.", familiarCount == 4 && length > 230);
-	}
-
-	/**
-	 * @tests java.util.Locale#getISOLanguages()
-	 */
-	public void test_getISOLanguages() {
-		// Test for method java.lang.String []
-		// java.util.Locale.getISOLanguages()
-		// Assumes always at least 131 ISOlanguages...
-		String[] isoLang = Locale.getISOLanguages();
-		int length = isoLang.length;
-		
-		// Non-bug difference for HARMONY-5442
-		assertTrue(isoLang[length / 2].length() == 3);
-		assertTrue(isoLang[length / 2].toLowerCase().equals(isoLang[length / 2]));
-		assertTrue("Wrong number of ISOLanguages.", length > 130);
-	}
-
-	/**
-	 * @tests java.util.Locale#getLanguage()
-	 */
-	public void test_getLanguage() {
-		// Test for method java.lang.String java.util.Locale.getLanguage()
-		assertTrue("Returned incorrect language: " + testLocale.getLanguage(),
-				testLocale.getLanguage().equals("en"));
-	}
-
-	/**
-	 * @tests java.util.Locale#getVariant()
-	 */
-	public void test_getVariant() {
-		// Test for method java.lang.String java.util.Locale.getVariant()
-		assertTrue("Returned incorrect variant: " + testLocale.getVariant(),
-				testLocale.getVariant().equals("WIN32"));
-	}
-
-	/**
-	 * @tests java.util.Locale#setDefault(java.util.Locale)
-	 */
-	public void test_setDefaultLjava_util_Locale() {
-		// Test for method void java.util.Locale.setDefault(java.util.Locale)
-
-		Locale org = Locale.getDefault();
-		Locale.setDefault(l);
-		Locale x = Locale.getDefault();
-		Locale.setDefault(org);
-		assertEquals("Failed to set locale", "fr_CA_WIN32", x.toString());
-
-		Locale.setDefault(new Locale("tr", ""));
-		String res1 = "\u0069".toUpperCase();
-		String res2 = "\u0049".toLowerCase();
-		Locale.setDefault(org);
-		assertEquals("Wrong toUppercase conversion", "\u0130", res1);
-		assertEquals("Wrong toLowercase conversion", "\u0131", res2);
-	}
-
-	/**
-	 * @tests java.util.Locale#toString()
-	 */
-	public void test_toString() {
-		// Test for method java.lang.String java.util.Locale.toString()
-		assertEquals("Returned incorrect string representation", "en_CA_WIN32", testLocale
-				.toString());
-
-		Locale l = new Locale("en", "");
-		assertEquals("Wrong representation 1", "en", l.toString());
-		l = new Locale("", "CA");
-		assertEquals("Wrong representation 2", "_CA", l.toString());
-		
-		// Non-bug difference for HARMONY-5442
-		l = new Locale("", "CA", "var");
-		assertEquals("Wrong representation 2.5", "_CA_var", l.toString());
-		l = new Locale("en", "", "WIN");
-		assertEquals("Wrong representation 4", "en__WIN", l.toString());
-		l = new Locale("en", "CA");
-		assertEquals("Wrong representation 6", "en_CA", l.toString());
-		l = new Locale("en", "CA", "VAR");
-		assertEquals("Wrong representation 7", "en_CA_VAR", l.toString());
-
-        l = new Locale("", "", "var");
-        assertEquals("Wrong representation 8", "", l.toString());
-
-	}
-
-    // Regression Test for HARMONY-2953
-    public void test_getISO() {
-        Locale locale = new Locale("an");
-        assertEquals("arg", locale.getISO3Language());
-
-        locale = new Locale("PS");
-        assertEquals("pus", locale.getISO3Language());
-
-        List<String> languages = Arrays.asList(Locale.getISOLanguages());
-        assertTrue(languages.contains("ak"));
-
-		// Non-bug difference for HARMONY-5442
-        List<String> countries = Arrays.asList(Locale.getISOCountries());
-        assertFalse(countries.contains("CS"));
-    }
-
-	/**
-	 * Sets up the fixture, for example, open a network connection. This method
-	 * is called before a test is executed.
-	 */
-	protected void setUp() {
-		defaultLocale = Locale.getDefault();
-		Locale.setDefault(Locale.US);
-		testLocale = new Locale("en", "CA", "WIN32");
-		l = new Locale("fr", "CA", "WIN32");
-	}
-
-	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
-	 */
-	protected void tearDown() {
-		Locale.setDefault(defaultLocale);
-	}
-}
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/util/UnknownFormatConversionExceptionTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/util/UnknownFormatConversionExceptionTest.java
deleted file mode 100644
index 7a778d1..0000000
--- a/luni/src/test/java/org/apache/harmony/luni/tests/java/util/UnknownFormatConversionExceptionTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.harmony.luni.tests.java.util;
-
-import java.io.Serializable;
-import java.util.UnknownFormatConversionException;
-
-import junit.framework.TestCase;
-
-import org.apache.harmony.testframework.serialization.SerializationTest;
-import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
-
-public class UnknownFormatConversionExceptionTest extends TestCase {
-
-    /**
-     * @tests java.util.UnknownFormatConversionException#UnknownFormatConversionException(String)
-     */
-    public void test_unknownFormatConversionException() {
-
-        // RI 5.0 will not throw NullPointerException, it is the bug according
-        // to spec.
-        try {
-            new UnknownFormatConversionException(null);
-        } catch (NullPointerException e) {
-            fail("should not throw NullPointerExcepiton");
-        }
-    }
-
-    /**
-     * @tests java.util.UnknownFormatConversionException#getConversion()
-     */
-    public void test_getConversion() {
-        String s = "MYTESTSTRING";
-        UnknownFormatConversionException UnknownFormatConversionException = new UnknownFormatConversionException(
-                s);
-        assertEquals(s, UnknownFormatConversionException.getConversion());
-    }
-
-    /**
-     * @tests java.util.UnknownFormatConversionException#getMessage()
-     */
-    public void test_getMessage() {
-        String s = "MYTESTSTRING";
-        UnknownFormatConversionException UnknownFormatConversionException = new UnknownFormatConversionException(
-                s);
-        assertTrue(null != UnknownFormatConversionException.getMessage());
-    }
-
-    // comparator for comparing UnknownFormatConversionException objects
-    private static final SerializableAssert exComparator = new SerializableAssert() {
-        public void assertDeserialized(Serializable initial,
-                Serializable deserialized) {
-
-            SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
-                    deserialized);
-
-            UnknownFormatConversionException initEx = (UnknownFormatConversionException) initial;
-            UnknownFormatConversionException desrEx = (UnknownFormatConversionException) deserialized;
-
-            assertEquals("Conversion", initEx.getConversion(), desrEx
-                    .getConversion());
-        }
-    };
-
-    /**
-     * @tests serialization/deserialization.
-     */
-    public void testSerializationSelf() throws Exception {
-
-        SerializationTest.verifySelf(new UnknownFormatConversionException(
-                "MYTESTSTRING"), exComparator);
-    }
-
-    /**
-     * @tests serialization/deserialization compatibility with RI.
-     */
-    public void testSerializationCompatibility() throws Exception {
-
-        SerializationTest.verifyGolden(this,
-                new UnknownFormatConversionException("MYTESTSTRING"),
-                exComparator);
-    }
-}
diff --git a/luni/src/test/java/org/apache/harmony/nio/tests/java/nio/channels/AllTests.java b/luni/src/test/java/org/apache/harmony/nio/tests/java/nio/channels/AllTests.java
index cbf7cd6..0f6c837 100644
--- a/luni/src/test/java/org/apache/harmony/nio/tests/java/nio/channels/AllTests.java
+++ b/luni/src/test/java/org/apache/harmony/nio/tests/java/nio/channels/AllTests.java
@@ -47,9 +47,7 @@
         suite.addTestSuite(SelectableChannelTest.class);
         suite.addTestSuite(SelectionKeyTest.class);
         suite.addTestSuite(SelectorTest.class);
-        suite.addTestSuite(ServerSocketChannelTest.class);
         suite.addTestSuite(SinkChannelTest.class);
-        suite.addTestSuite(SocketChannelTest.class);
         suite.addTestSuite(SourceChannelTest.class);
         suite.addTestSuite(UnresolvedAddressExceptionTest.class);
         suite.addTestSuite(UnsupportedAddressTypeExceptionTest.class);
diff --git a/luni/src/test/java/org/apache/harmony/nio/tests/java/nio/channels/ServerSocketChannelTest.java b/luni/src/test/java/org/apache/harmony/nio/tests/java/nio/channels/ServerSocketChannelTest.java
deleted file mode 100644
index 88d0d4d..0000000
--- a/luni/src/test/java/org/apache/harmony/nio/tests/java/nio/channels/ServerSocketChannelTest.java
+++ /dev/null
@@ -1,888 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.harmony.nio.tests.java.nio.channels;
-
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.BrokenTest;
-import dalvik.annotation.KnownFailure;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.InetSocketAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.nio.ByteBuffer;
-import java.nio.channels.AsynchronousCloseException;
-import java.nio.channels.ClosedByInterruptException;
-import java.nio.channels.ClosedChannelException;
-import java.nio.channels.IllegalBlockingModeException;
-import java.nio.channels.NotYetBoundException;
-import java.nio.channels.SelectionKey;
-import java.nio.channels.ServerSocketChannel;
-import java.nio.channels.SocketChannel;
-import java.nio.channels.spi.SelectorProvider;
-
-import junit.framework.TestCase;
-
-import tests.support.Support_PortManager;
-
-/*
- * test for ServerSocketChannel
- */
-@TestTargetClass(ServerSocketChannel.class)
-public class ServerSocketChannelTest extends TestCase {
-
-    private static final int CAPACITY_NORMAL = 200;
-
-    private static final int CAPACITY_64KB = 65536;
-
-    private static final int TIME_UNIT = 200;
-
-    private InetSocketAddress localAddr1;
-
-    private ServerSocketChannel serverChannel;
-
-    private SocketChannel clientChannel;
-
-    protected void setUp() throws Exception {
-        super.setUp();
-        this.localAddr1 = new InetSocketAddress(
-                "127.0.0.1", Support_PortManager
-                        .getNextPort());
-        this.serverChannel = ServerSocketChannel.open();
-        this.clientChannel = SocketChannel.open();
-    }
-
-    protected void tearDown() throws Exception {
-        if (null != this.serverChannel) {
-            try {
-                this.serverChannel.close();
-            } catch (Exception e) {
-                //ignore
-            }
-
-        }
-        if (null != this.clientChannel) {
-            try {
-                this.clientChannel.close();
-            } catch (Exception e) {
-                //ignore
-            }
-        }
-        super.tearDown();
-    }
-
-    // -------------------------------------------------------------------
-    // Test for methods in abstract class.
-    // -------------------------------------------------------------------
-    /*
-     * Test method for 'java.nio.channels.ServerSocketChannel()'
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "ServerSocketChannel",
-        args = {java.nio.channels.spi.SelectorProvider.class}
-    )
-    public void testConstructor() throws IOException {
-        ServerSocketChannel channel =
-                SelectorProvider.provider().openServerSocketChannel();
-        assertNotNull(channel);
-        assertSame(SelectorProvider.provider(),channel.provider());
-    }
-
-    /*
-     * Test method for 'java.nio.channels.ServerSocketChannel.validOps()'
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "validOps",
-        args = {}
-    )
-    public void test_validOps() {
-        MockServerSocketChannel testMSChnlnull = new MockServerSocketChannel(
-                null);
-        MockServerSocketChannel testMSChnl = new MockServerSocketChannel(
-                SelectorProvider.provider());
-        assertEquals(SelectionKey.OP_ACCEPT, this.serverChannel.validOps());
-        assertEquals(SelectionKey.OP_ACCEPT, testMSChnl.validOps());
-        assertEquals(SelectionKey.OP_ACCEPT, testMSChnlnull.validOps());
-
-    }
-
-    /*
-     * Test method for 'java.nio.channels.ServerSocketChannel.open()'
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "Verifies in setUp method.",
-        method = "open",
-        args = {}
-    )
-    public void test_open() {
-        MockServerSocketChannel testMSChnl = new MockServerSocketChannel(null);
-        MockServerSocketChannel testMSChnlnotnull = new MockServerSocketChannel(
-                SelectorProvider.provider());
-        assertEquals(SelectionKey.OP_ACCEPT, testMSChnlnotnull.validOps());
-        assertNull(testMSChnl.provider());
-        assertNotNull(testMSChnlnotnull.provider());
-        assertEquals(testMSChnlnotnull.provider(), this.serverChannel
-                .provider());
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "isOpen",
-        args = {}
-    )
-    public void testIsOpen() throws Exception {
-        assertTrue(this.serverChannel.isOpen());
-        this.serverChannel.close();
-        assertFalse(this.serverChannel.isOpen());
-    }
-
-    // -------------------------------------------------------------------
-    // Test for socket()
-    // -------------------------------------------------------------------
-
-    /*
-     * Test method for 'com.ibm.io.nio.ServerSocketChannelImpl.socket()'
-     * Test method for 'com.ibm.io.nio.ServerSocketChannelImpl.isOpen()'
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "socket",
-            args = {}
-        ),@TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "isOpen",
-            args = {}
-        )
-    })
-    public void test_socket_Block_BeforeClose() throws Exception {
-        assertTrue(this.serverChannel.isOpen());
-        assertTrue(this.serverChannel.isBlocking());
-        ServerSocket s1 = this.serverChannel.socket();
-        assertFalse(s1.isClosed());
-        assertSocketNotAccepted(s1);
-        ServerSocket s2 = this.serverChannel.socket();
-        // same
-        assertSame(s1, s2);
-
-        // socket close makes the channel close
-        s1.close();
-        assertFalse(this.serverChannel.isOpen());
-
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "socket",
-        args = {}
-    )
-    public void test_socket_NonBlock_BeforeClose() throws Exception {
-        assertTrue(this.serverChannel.isOpen());
-        this.serverChannel.configureBlocking(false);
-        ServerSocket s1 = this.serverChannel.socket();
-        assertFalse(s1.isClosed());
-        assertSocketNotAccepted(s1);
-        ServerSocket s2 = this.serverChannel.socket();
-        // same
-        assertSame(s1, s2);
-
-        // socket close makes the channel close
-        s1.close();
-        assertFalse(this.serverChannel.isOpen());
-
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "socket",
-        args = {}
-    )
-    public void test_socket_Block_Closed() throws Exception {
-        this.serverChannel.close();
-        assertFalse(this.serverChannel.isOpen());
-        assertTrue(this.serverChannel.isBlocking());
-        ServerSocket s1 = this.serverChannel.socket();
-        assertTrue(s1.isClosed());
-        assertSocketNotAccepted(s1);
-        ServerSocket s2 = this.serverChannel.socket();
-        // same
-        assertSame(s1, s2);
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "socket",
-        args = {}
-    )
-    public void test_socket_NonBlock_Closed() throws Exception {
-        this.serverChannel.configureBlocking(false);
-        this.serverChannel.close();
-        assertFalse(this.serverChannel.isBlocking());
-        assertFalse(this.serverChannel.isOpen());
-        ServerSocket s1 = this.serverChannel.socket();
-        assertTrue(s1.isClosed());
-        assertSocketNotAccepted(s1);
-        ServerSocket s2 = this.serverChannel.socket();
-        // same
-        assertSame(s1, s2);
-    }
-
-    private void assertSocketNotAccepted(ServerSocket s) throws IOException {
-        assertFalse(s.isBound());
-        assertNull(s.getInetAddress());
-        assertEquals(-1, s.getLocalPort());
-        assertNull(s.getLocalSocketAddress());
-        assertEquals(0, s.getSoTimeout());
-    }
-
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "Verifies default status of ServerSocketChannel.",
-            method = "validOps",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "Verifies default status of ServerSocketChannel.",
-            method = "provider",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "Verifies default status of ServerSocketChannel.",
-            method = "isRegistered",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "Verifies default status of ServerSocketChannel.",
-            method = "isBlocking",
-            args = {}
-        )
-    })
-    public void testChannelBasicStatus() {
-        ServerSocket gotSocket = this.serverChannel.socket();
-        assertFalse(gotSocket.isClosed());
-        assertTrue(this.serverChannel.isBlocking());
-        assertFalse(this.serverChannel.isRegistered());
-        assertEquals(SelectionKey.OP_ACCEPT, this.serverChannel.validOps());
-        assertEquals(SelectorProvider.provider(), this.serverChannel.provider());
-    }
-
-    // -------------------------------------------------------------------
-    // Test for accept()
-    // -------------------------------------------------------------------
-
-    /*
-     * Test method for 'com.ibm.io.nio.ServerSocketChannelImpl.accept()'
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies NotYetBoundException.",
-        method = "accept",
-        args = {}
-    )
-    public void test_accept_Block_NotYetBound() throws IOException {
-        assertTrue(this.serverChannel.isOpen());
-        assertTrue(this.serverChannel.isBlocking());
-        try {
-            this.serverChannel.accept();
-            fail("Should throw NotYetBoundException");
-        } catch (NotYetBoundException e) {
-            // correct
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies NotYetBoundException.",
-        method = "accept",
-        args = {}
-    )
-    public void test_accept_NonBlock_NotYetBound() throws IOException {
-        assertTrue(this.serverChannel.isOpen());
-        this.serverChannel.configureBlocking(false);
-        try {
-            this.serverChannel.accept();
-            fail("Should throw NotYetBoundException");
-        } catch (NotYetBoundException e) {
-            // correct
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies ClosedChannelException.",
-        method = "accept",
-        args = {}
-    )
-    public void test_accept_ClosedChannel() throws Exception {
-        this.serverChannel.close();
-        assertFalse(this.serverChannel.isOpen());
-        try {
-            this.serverChannel.accept();
-            fail("Should throw ClosedChannelException");
-        } catch (ClosedChannelException e) {
-            // OK.
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies AsynchronousCloseException.",
-        method = "accept",
-        args = {}
-    )
-    public void test_accept_Block_NoConnect_close() throws IOException {
-        assertTrue(this.serverChannel.isBlocking());
-        ServerSocket gotSocket = this.serverChannel.socket();
-        gotSocket.bind(localAddr1);
-        // blocking mode , will block and wait for ever...
-        // so must close the server channel with another thread.
-        new Thread() {
-            public void run() {
-                try {
-                    Thread.sleep(TIME_UNIT);
-                    ServerSocketChannelTest.this.serverChannel.close();
-                } catch (Exception e) {
-                    fail("Fail to close the server channel because of"
-                            + e.getClass().getName());
-                }
-            }
-        }.start();
-        try {
-            this.serverChannel.accept();
-            fail("Should throw a AsynchronousCloseException");
-        } catch (AsynchronousCloseException e) {
-            // OK.
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies ClosedByInterruptException.",
-        method = "accept",
-        args = {}
-    )
-    public void test_accept_Block_NoConnect_interrupt() throws IOException {
-        assertTrue(this.serverChannel.isBlocking());
-        ServerSocket gotSocket = this.serverChannel.socket();
-        gotSocket.bind(localAddr1);
-
-        class MyThread extends Thread {
-            public String errMsg = null;
-            public void run() {
-                try {
-                    serverChannel.accept();
-                    errMsg = "should throw ClosedByInterruptException";
-                } catch (ClosedByInterruptException e) {
-                    // expected
-                } catch (Exception e) {
-                    errMsg = "caught wrong Exception: " + e.getClass() + ": " +
-                            e.getMessage();
-                }
-            }
-        }
-        MyThread thread = new MyThread();
-        thread.start();
-        try {
-            Thread.currentThread().sleep(TIME_UNIT);
-            thread.interrupt();
-        } catch (InterruptedException e) {
-            fail("Should not throw a InterruptedException");
-        }
-        if (thread.errMsg != null) {
-            fail(thread.errMsg);
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies that accept() returns null if the channel is in non-blocking mode and no connection is available to be accepted.",
-        method = "accept",
-        args = {}
-    )
-    public void test_accept_NonBlock_NoConnect() throws IOException {
-        ServerSocket gotSocket = this.serverChannel.socket();
-        gotSocket.bind(localAddr1);
-        this.serverChannel.configureBlocking(false);
-        // non-blocking mode , will immediately return
-        assertNull(this.serverChannel.accept());
-    }
-
-    /**
-     * @tests ServerSocketChannel#accept().socket()
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "accept",
-        args = {}
-    )
-    public void test_accept_socket_read_Block() throws IOException {
-        serverChannel.socket().bind(localAddr1);
-        ByteBuffer buf = ByteBuffer.allocate(CAPACITY_NORMAL);
-
-        for (int i = 0; i < CAPACITY_NORMAL; i++) {
-            buf.put((byte) i);
-        }
-        clientChannel.connect(localAddr1);
-        Socket serverSocket = serverChannel.accept().socket();
-        InputStream in = serverSocket.getInputStream();
-        buf.flip();
-        clientChannel.write(buf);
-        clientChannel.close();
-        assertReadResult(in,CAPACITY_NORMAL);
-    }
-
-    /**
-     * Asserts read content. The read content should contain <code>size</code>
-     * bytes, and the value should be a sequence from 0 to size-1
-     * ([0,1,...size-1]). Otherwise, the method throws Exception.
-     *
-     */
-    private void assertReadResult(InputStream in, int size) throws IOException{
-        byte[] readContent = new byte[size + 1];
-        int count = 0;
-        int total = 0;
-        while ((count = in.read(readContent, total, size + 1 - total)) != -1) {
-            total = total + count;
-        }
-        assertEquals(size, total);
-        for (int i = 0; i < size; i++) {
-            assertEquals((byte) i, readContent[i]);
-        }
-    }
-
-    /**
-     * @tests ServerSocketChannel#accept().socket()
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "accept",
-        args = {}
-    )
-    public void test_accept_socket_read_NonBlock() throws Exception {
-        serverChannel.configureBlocking(false);
-        serverChannel.socket().bind(localAddr1);
-        ByteBuffer buf = ByteBuffer.allocate(CAPACITY_NORMAL);
-        for (int i = 0; i < CAPACITY_NORMAL; i++) {
-            buf.put((byte) i);
-        }
-        buf.flip();
-        clientChannel.connect(localAddr1);
-        Socket serverSocket = serverChannel.accept().socket();
-        InputStream in = serverSocket.getInputStream();
-        clientChannel.write(buf);
-        clientChannel.close();
-        assertReadResult(in,CAPACITY_NORMAL);
-    }
-
-    /**
-     * @tests ServerSocketChannel#accept().socket()
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "accept",
-        args = {}
-    )
-    public void test_accept_socket_write_Block() throws IOException {
-        assertTrue(serverChannel.isBlocking());
-        ServerSocket serverSocket = serverChannel.socket();
-        serverSocket.bind(localAddr1);
-
-        byte[] writeContent = new byte[CAPACITY_NORMAL];
-        for (int i = 0; i < writeContent.length; i++) {
-            writeContent[i] = (byte) i;
-        }
-        clientChannel.connect(localAddr1);
-        Socket socket = serverChannel.accept().socket();
-        OutputStream out = socket.getOutputStream();
-        out.write(writeContent);
-        out.flush();
-        socket.close();
-        assertWriteResult(CAPACITY_NORMAL);
-    }
-
-
-    /**
-     * @tests ServerSocketChannel#accept().socket()
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "accept",
-        args = {}
-    )
-    public void test_accept_socket_write_NonBlock() throws Exception {
-        serverChannel.configureBlocking(false);
-        ServerSocket serverSocket = serverChannel.socket();
-        serverSocket.bind(localAddr1);
-
-        byte[] writeContent = new byte[CAPACITY_NORMAL];
-        for (int i = 0; i < CAPACITY_NORMAL; i++) {
-            writeContent[i] = (byte) i;
-        }
-        clientChannel.connect(localAddr1);
-        Socket clientSocket = serverChannel.accept().socket();
-        OutputStream out = clientSocket.getOutputStream();
-        out.write(writeContent);
-        clientSocket.close();
-        assertWriteResult(CAPACITY_NORMAL);
-    }
-
-    /**
-     * @tests ServerSocketChannel#accept().socket()
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "accept",
-        args = {}
-    )
-    @BrokenTest("Sporadic timeouts in CTS, but not in CoreTestRunner")
-    public void test_accept_socket_read_Block_RWLargeData() throws IOException {
-        serverChannel.socket().bind(localAddr1);
-        ByteBuffer buf = ByteBuffer.allocate(CAPACITY_64KB);
-        for (int i = 0; i < CAPACITY_64KB; i++) {
-            buf.put((byte) i);
-        }
-        buf.flip();
-        clientChannel.connect(localAddr1);
-        clientChannel.write(buf);
-        clientChannel.close();
-        Socket socket = serverChannel.accept().socket();
-        InputStream in = socket.getInputStream();
-        assertReadResult(in,CAPACITY_64KB);
-    }
-
-    /**
-     * @tests ServerSocketChannel#accept().socket()
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "accept",
-        args = {}
-    )
-    @BrokenTest("Sporadic timeouts in CTS, but not in CoreTestRunner")
-    public void test_accept_socket_read_NonBlock_RWLargeData()
-            throws Exception {
-        serverChannel.configureBlocking(false);
-        serverChannel.socket().bind(localAddr1);
-        ByteBuffer buf = ByteBuffer.allocate(CAPACITY_64KB);
-        for (int i = 0; i < CAPACITY_64KB; i++) {
-            buf.put((byte) i);
-        }
-        buf.flip();
-        clientChannel.connect(localAddr1);
-        clientChannel.write(buf);
-        clientChannel.close();
-        Socket socket = serverChannel.accept().socket();
-        InputStream in = socket.getInputStream();
-        assertReadResult(in,CAPACITY_64KB);
-    }
-
-    /**
-     * @tests ServerSocketChannel#accept().socket()
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "accept",
-        args = {}
-    )
-    @BrokenTest("Sporadic timeouts in CTS, but not in CoreTestRunner")
-    public void test_accept_socket_write_NonBlock_RWLargeData()
-            throws Exception {
-        serverChannel.configureBlocking(false);
-        serverChannel.socket().bind(localAddr1);
-        byte[] writeContent = new byte[CAPACITY_64KB];
-        for (int i = 0; i < writeContent.length; i++) {
-            writeContent[i] = (byte) i;
-        }
-        clientChannel.connect(localAddr1);
-        Socket socket = serverChannel.accept().socket();
-        OutputStream out = socket.getOutputStream();
-        out.write(writeContent);
-        socket.close();
-        assertWriteResult(CAPACITY_64KB);
-    }
-
-    /**
-     * @tests ServerSocketChannel#accept().socket()
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "accept",
-        args = {}
-    )
-    @BrokenTest("Sporadic timeouts in CTS, but not in CoreTestRunner")
-    public void test_accept_socket_write_Block_RWLargeData() throws Exception {
-        serverChannel.socket().bind(localAddr1);
-        byte[] writeContent = new byte[CAPACITY_64KB];
-        for (int i = 0; i < writeContent.length; i++) {
-            writeContent[i] = (byte) i;
-        }
-        clientChannel.connect(localAddr1);
-        Socket socket = serverChannel.accept().socket();
-        OutputStream out = socket.getOutputStream();
-        out.write(writeContent);
-        socket.close();
-        assertWriteResult(CAPACITY_64KB);
-    }
-
-    /**
-     * Uses SocketChannel.read(ByteBuffer) to verify write result.
-     */
-    private void assertWriteResult(int size) throws IOException{
-        ByteBuffer buf = ByteBuffer.allocate(size + 1);
-        int count = 0;
-        int total = 0;
-        long beginTime = System.currentTimeMillis();
-        while ((count = clientChannel.read(buf)) != -1) {
-            total = total + count;
-            // 10s timeout to avoid dead loop
-            if (System.currentTimeMillis() - beginTime > 10000){
-                break;
-            }
-        }
-        assertEquals(total, size);
-        buf.flip();
-        for (int i = 0; i < count; i++) {
-            assertEquals((byte) i, buf.get(i));
-        }
-    }
-
-    /**
-     * @tests ServerSocketChannel#socket().getSoTimeout()
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies that accept method  returns null since there are no pending connections. Doesn't verify exceptions.",
-        method = "accept",
-        args = {}
-    )
-    public void test_accept_SOTIMEOUT() throws IOException {
-        // regression test for Harmony-707
-        final int SO_TIMEOUT = 10;
-        ServerSocketChannel ssc = ServerSocketChannel.open();
-        try {
-            ServerSocket ss = ssc.socket();
-            ss.bind(localAddr1);
-            ssc.configureBlocking(false);
-            ss.setSoTimeout(SO_TIMEOUT);
-            SocketChannel client = ssc.accept();
-            // non blocking mode, returns null since there are no pending connections.
-            assertNull(client);
-            int soTimeout = ss.getSoTimeout();
-            // Harmony failed here.
-            assertEquals(SO_TIMEOUT, soTimeout);
-        } finally {
-            ssc.close();
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "accept",
-        args = {}
-    )
-    @KnownFailure("http://b/1952042 - issues with sockets forgetting their local and remote addresses")
-    public void test_accept_Security() throws IOException {
-        this.clientChannel.configureBlocking(true);
-        this.serverChannel.configureBlocking(true);
-        SecurityManager sm = System.getSecurityManager();
-        MockSecurityManager mockManager = new MockSecurityManager("127.0.0.1");
-        System.setSecurityManager(mockManager);
-
-        Thread t = new Thread() {
-            public void run() {
-                try {
-                    try {
-                        Thread.sleep(1000);
-                    } catch (InterruptedException e) {
-                    }
-                    clientChannel.connect(localAddr1);
-                } catch (IOException e) {
-                }
-            }
-        };
-        t.start();
-
-        try {
-            ServerSocket ss = this.serverChannel.socket();
-            ss.bind(localAddr1);
-            this.serverChannel.accept();
-        } finally {
-            System.setSecurityManager(sm);
-        }
-
-        assertTrue(mockManager.checkAcceptCalled);
-    }
-
-    /**
-     * @tests ServerSocket#socket().accept()
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Regression test. Verifies IllegalBlockingModeException.",
-        method = "socket",
-        args = {}
-    )
-    public void test_socket_accept_Blocking_NotBound() throws IOException {
-        // regression test for Harmony-748
-        ServerSocket gotSocket = serverChannel.socket();
-        serverChannel.configureBlocking(true);
-        try {
-            gotSocket.accept();
-            fail("Should throw an IllegalBlockingModeException");
-        } catch (IllegalBlockingModeException e) {
-            // expected
-        }
-        serverChannel.close();
-        try {
-            gotSocket.accept();
-            fail("Should throw an IllegalBlockingModeException");
-        } catch (IllegalBlockingModeException e) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests ServerSocket#socket().accept()
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Regression test. Verifies IllegalBlockingModeException.",
-        method = "socket",
-        args = {}
-    )
-    public void test_socket_accept_Nonblocking_NotBound() throws IOException {
-        // regression test for Harmony-748
-        ServerSocket gotSocket = serverChannel.socket();
-        serverChannel.configureBlocking(false);
-        try {
-            gotSocket.accept();
-            fail("Should throw an IllegalBlockingModeException");
-        } catch (IllegalBlockingModeException e) {
-            // expected
-        }
-        serverChannel.close();
-        try {
-            gotSocket.accept();
-            fail("Should throw an IllegalBlockingModeException");
-        } catch (IllegalBlockingModeException e) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests ServerSocket#socket().accept()
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Regression test. Verifies IllegalBlockingModeException, ClosedChannelException.",
-        method = "socket",
-        args = {}
-    )
-    public void test_socket_accept_Nonblocking_Bound() throws IOException {
-        // regression test for Harmony-748
-        serverChannel.configureBlocking(false);
-        ServerSocket gotSocket = serverChannel.socket();
-        gotSocket.bind(localAddr1);
-        try {
-            gotSocket.accept();
-            fail("Should throw an IllegalBlockingModeException");
-        } catch (IllegalBlockingModeException e) {
-            // expected
-        }
-        serverChannel.close();
-        try {
-            gotSocket.accept();
-            fail("Should throw a ClosedChannelException");
-        } catch (ClosedChannelException e) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests ServerSocket#socket().accept()
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Regression test. Verifies ClosedChannelException.",
-        method = "socket",
-        args = {}
-    )
-    public void test_socket_accept_Blocking_Bound() throws IOException {
-        // regression test for Harmony-748
-        serverChannel.configureBlocking(true);
-        ServerSocket gotSocket = serverChannel.socket();
-        gotSocket.bind(localAddr1);
-        serverChannel.close();
-        try {
-            gotSocket.accept();
-            fail("Should throw a ClosedChannelException");
-        } catch (ClosedChannelException e) {
-            // expected
-        }
-    }
-
-    /**
-     * Regression test for HARMONY-4961
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Regression test. Verifies that returned socket returns correct local port.",
-        method = "socket",
-        args = {}
-    )
-    public void test_socket_getLocalPort() throws IOException {
-        // regression test for Harmony-4961
-        serverChannel.socket().bind(localAddr1);
-        clientChannel.connect(localAddr1);
-        SocketChannel myChannel = serverChannel.accept();
-        int port = myChannel.socket().getLocalPort();
-        assertEquals(localAddr1.getPort(), port);
-        myChannel.close();
-        clientChannel.close();
-        serverChannel.close();
-    }
-}
diff --git a/luni/src/test/java/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java b/luni/src/test/java/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java
deleted file mode 100644
index 37f63fe..0000000
--- a/luni/src/test/java/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java
+++ /dev/null
@@ -1,4385 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.harmony.nio.tests.java.nio.channels;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.AndroidOnly;
-import dalvik.annotation.BrokenTest;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.BindException;
-import java.net.ConnectException;
-import java.net.Inet4Address;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.SocketAddress;
-import java.net.SocketException;
-import java.nio.ByteBuffer;
-import java.nio.channels.AlreadyConnectedException;
-import java.nio.channels.ClosedChannelException;
-import java.nio.channels.ConnectionPendingException;
-import java.nio.channels.IllegalBlockingModeException;
-import java.nio.channels.NoConnectionPendingException;
-import java.nio.channels.NotYetConnectedException;
-import java.nio.channels.SelectableChannel;
-import java.nio.channels.SelectionKey;
-import java.nio.channels.ServerSocketChannel;
-import java.nio.channels.SocketChannel;
-import java.nio.channels.UnresolvedAddressException;
-import java.nio.channels.UnsupportedAddressTypeException;
-import java.nio.channels.spi.SelectorProvider;
-
-import junit.framework.TestCase;
-import tests.support.Support_PortManager;
-
-@TestTargetClass(SocketChannel.class)
-/**
- * Tests for SocketChannel and its default implementation.
- */
-public class SocketChannelTest extends TestCase {
-
-    private static final int CAPACITY_NORMAL = 200;
-
-    private static final int CAPACITY_HUGE = 512 * 1024;
-
-    private InetSocketAddress localAddr1;
-
-    private InetSocketAddress localAddr2;
-
-    private SocketChannel channel1;
-
-    private SocketChannel channel2;
-
-    private ServerSocket server1;
-
-    private ServerSocket server2;
-
-    private final static int TIMEOUT = 60000;
-
-    private final static int EOF = -1;
-
-    protected void setUp() throws Exception {
-        super.setUp();
-        this.localAddr1 = new InetSocketAddress("127.0.0.1",
-                Support_PortManager.getNextPort());
-        this.localAddr2 = new InetSocketAddress("127.0.0.1",
-                Support_PortManager.getNextPort());
-        this.channel1 = SocketChannel.open();
-        this.channel2 = SocketChannel.open();
-        this.server1 = new ServerSocket(localAddr1.getPort());
-    }
-
-    protected void tearDown() throws Exception {
-        super.tearDown();
-        if (null != this.channel1) {
-            try {
-                this.channel1.close();
-            } catch (Exception e) {
-                // ignore
-            }
-        }
-        if (null != this.channel2) {
-            try {
-                this.channel2.close();
-            } catch (Exception e) {
-                // ignore
-            }
-        }
-        if (null != this.server1) {
-            try {
-                this.server1.close();
-            } catch (Exception e) {
-                // ignore
-            }
-        }
-        if (null != this.server2) {
-            try {
-                this.server2.close();
-            } catch (Exception e) {
-                // ignore
-            }
-        }
-    }
-
-    // -------------------------------------------------------------------
-    // Test for methods in abstract class.
-    // -------------------------------------------------------------------
-    /*
-     * Test method for 'java.nio.channels.SocketChannel()'
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "SocketChannel",
-            args = {SelectorProvider.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "provider",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "open",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            clazz = SelectorProvider.class,
-            method = "openSocketChannel",
-            args = {}
-        )
-    })
-    public void testConstructor() throws IOException {
-        SocketChannel channel =
-                SelectorProvider.provider().openSocketChannel();
-        assertNotNull(channel);
-        assertSame(SelectorProvider.provider(), channel.provider());
-        channel = SocketChannel.open();
-        assertNotNull(channel);
-        assertSame(SelectorProvider.provider(), channel.provider());
-        MockSocketChannel chan = new MockSocketChannel(
-                SelectorProvider.provider());
-        assertTrue(chan.isConstructorCalled);
-    }
-
-    /*
-     * Test method for 'java.nio.channels.SocketChannel.validOps()'
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "validOps",
-        args = {}
-    )
-    public void testValidOps() {
-        MockSocketChannel testMSChannel = new MockSocketChannel(null);
-        assertEquals(13, this.channel1.validOps());
-        assertEquals(13, testMSChannel.validOps());
-    }
-
-    /*
-     * Test method for 'java.nio.channels.SocketChannel.open()'
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "open",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "SocketChannel",
-            args = {SelectorProvider.class}
-        )
-    })
-    public void testOpen() throws IOException {
-        java.nio.ByteBuffer[] buf = new java.nio.ByteBuffer[1];
-        buf[0] = java.nio.ByteBuffer.allocateDirect(CAPACITY_NORMAL);
-        MockSocketChannel testMSChannel = new MockSocketChannel(null);
-        MockSocketChannel testMSChannelnotnull = new MockSocketChannel(
-                SelectorProvider.provider());
-        SocketChannel testSChannel = MockSocketChannel.open();
-        assertTrue(testSChannel.isOpen());
-        assertNull(testMSChannel.provider());
-        assertNotNull(testSChannel.provider());
-        assertEquals(SelectorProvider.provider(), testSChannel.provider());
-        assertNotNull(testMSChannelnotnull.provider());
-        assertEquals(this.channel1.provider(), testMSChannelnotnull.provider());
-        try {
-            this.channel1.write(buf);
-            fail("Should throw NotYetConnectedException");
-        } catch (NotYetConnectedException e) {
-            // correct
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "isOpen",
-        args = {}
-    )
-    public void testIsOpen() throws Exception {
-        assertTrue(this.channel1.isOpen());
-        this.channel1.close();
-        assertFalse(this.channel1.isOpen());
-    }
-
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isConnected",
-        args = {}
-    )
-    public void testIsConnected() throws Exception {
-        assertFalse(this.channel1.isConnected());// not connected
-        this.channel1.configureBlocking(false);
-        assertFalse(this.channel1.connect(localAddr1));
-        assertFalse(this.channel1.isConnected());
-        assertTrue(this.channel1.isConnectionPending());
-        assertTrue(tryFinish());
-        assertTrue(this.channel1.isConnected());
-        this.channel1.close();
-        assertFalse(this.channel1.isConnected());
-    }
-
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isConnectionPending",
-        args = {}
-    )
-    public void testIsConnectionPending() throws Exception {
-        // ensure
-        ensureServerClosed();
-        this.channel1.configureBlocking(false);
-        assertFalse(this.channel1.isConnectionPending());
-        // finish
-        try {
-            this.channel1.finishConnect();
-            fail("Should throw NoConnectionPendingException");
-        } catch (NoConnectionPendingException e) {
-            // OK.
-        }
-        assertFalse(this.channel1.isConnectionPending());
-        // connect
-        assertFalse(this.channel1.connect(localAddr1));
-        assertTrue(this.channel1.isConnectionPending());
-        this.channel1.close();
-
-        assertFalse(this.channel1.isConnectionPending());
-    }
-
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "Verifies default status of SocketChannel.",
-            method = "validOps",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "Verifies default status of SocketChannel.",
-            method = "provider",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "Verifies default status of SocketChannel.",
-            method = "isRegistered",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "Verifies default status of SocketChannel.",
-            method = "isBlocking",
-            args = {}
-        )
-    })
-    public void testChannelBasicStatus() {
-        Socket gotSocket = this.channel1.socket();
-        assertFalse(gotSocket.isClosed());
-        assertTrue(this.channel1.isBlocking());
-        assertFalse(this.channel1.isRegistered());
-        assertEquals((SelectionKey.OP_CONNECT | SelectionKey.OP_READ |
-                SelectionKey.OP_WRITE), this.channel1.validOps());
-        assertEquals(SelectorProvider.provider(), this.channel1.provider());
-    }
-
-    /*
-     * Test method for 'java.nio.channels.SocketChannel.open(SocketAddress)'
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "open",
-        args = {java.net.SocketAddress.class}
-    )
-    public void testOpenSocketAddress() throws IOException {
-        this.channel1 = SocketChannel.open(localAddr1);
-        assertTrue(this.channel1.isConnected());
-
-        SecurityManager smngr = System.getSecurityManager();
-        System.setSecurityManager(new MockSecurityManager("blargh"));
-        try {
-            this.channel1 = SocketChannel.open(localAddr2);
-            fail("Should throw SecurityException");
-        } catch (SecurityException e) {
-            // expected
-        }
-        System.setSecurityManager(smngr);
-
-        SocketAddress newTypeAddress = new SubSocketAddress();
-        try {
-            this.channel1 = SocketChannel.open(newTypeAddress);
-            fail("Should throw UnexpectedAddressTypeException");
-        } catch (UnsupportedAddressTypeException e) {
-            // expected
-        }
-
-        SocketAddress unresolvedAddress =
-                InetSocketAddress.createUnresolved("127.0.0.1", 8080);
-        try {
-            this.channel1 = SocketChannel.open(unresolvedAddress);
-            fail("Should throw UnresolvedAddressException");
-        } catch (UnresolvedAddressException e) {
-            // expected
-        }
-
-        SocketChannel channel1IP = null;
-        try {
-            channel1IP = SocketChannel.open(null);
-            fail("Should throw an IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
-            // correct
-        }
-        assertNull(channel1IP);
-    }
-
-    /*
-     * Test method for 'java.nio.channels.SocketChannel.read(ByteBuffer[])'
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "read",
-        args = {java.nio.ByteBuffer[].class}
-    )
-    public void testReadByteBufferArray() throws IOException {
-        java.nio.ByteBuffer[] byteBuf = null;
-        MockSocketChannel testMSChannelnull = new MockSocketChannel(null);
-        MockSocketChannel testMSChannel = new MockSocketChannel(
-                SelectorProvider.provider());
-        ServerSocket testServer = new ServerSocket(Support_PortManager
-                .getNextPort());
-        try {
-            try {
-                this.channel1.read(byteBuf);
-                fail("Should throw NPE");
-            } catch (NullPointerException e) {
-                // correct
-            }
-            byteBuf = new java.nio.ByteBuffer[CAPACITY_NORMAL];
-            try {
-                this.channel1.read(byteBuf);
-                fail("Should throw NotYetConnectedException");
-            } catch (NotYetConnectedException e) {
-                // correct
-            }
-            long readNum = CAPACITY_NORMAL;
-            readNum = testMSChannel.read(byteBuf);
-            assertEquals(0, readNum);
-            readNum = CAPACITY_NORMAL;
-            readNum = testMSChannelnull.read(byteBuf);
-            assertEquals(0, readNum);
-        } finally {
-            testServer.close();
-        }
-    }
-
-    /*
-     * Test method for 'java.nio.channels.SocketChannel.read(ByteBuffer[])'
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "read",
-        args = {java.nio.ByteBuffer[].class}
-    )
-    public void testReadByteBufferArray_BufNull() throws IOException {
-        java.nio.ByteBuffer[] byteBuf = null;
-        MockSocketChannel testMSChannelnull = new MockSocketChannel(null);
-        MockSocketChannel testMSChannel = new MockSocketChannel(
-                SelectorProvider.provider());
-        try {
-            this.channel1.read(byteBuf);
-            fail("Should throw NPE");
-        } catch (NullPointerException e) {
-            // correct
-        }
-        try {
-            testMSChannel.read(byteBuf);
-            fail("Should throw NPE");
-        } catch (NullPointerException e) {
-            // correct
-        }
-        try {
-            testMSChannelnull.read(byteBuf);
-            fail("Should throw NPE");
-        } catch (NullPointerException e) {
-            // correct
-        }
-    }
-
-    /*
-     * Test method for 'java.nio.channels.SocketChannel.write(ByteBuffer[])'
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Doesn't verify AsynchronousCloseException," +
-                "ClosedByInterruptException.",
-        method = "write",
-        args = {java.nio.ByteBuffer[].class}
-    )
-    public void testWriteByteBufferArray() throws IOException {
-        java.nio.ByteBuffer[] byteBuf = null;
-        MockSocketChannel testMSChannelnull = new MockSocketChannel(null);
-        MockSocketChannel testMSChannel = new MockSocketChannel(
-                SelectorProvider.provider());
-        try {
-            this.channel1.write(byteBuf);
-            fail("Should throw NPE");
-        } catch (NullPointerException e) {
-            // correct
-        }
-        byteBuf = new java.nio.ByteBuffer[1];
-        byteBuf[0] = java.nio.ByteBuffer.allocate(CAPACITY_NORMAL);
-        try {
-            this.channel1.write(byteBuf);
-            fail("Should throw NotYetConnectedException");
-        } catch (NotYetConnectedException e) {
-            // correct
-        }
-        testMSChannel.write(byteBuf);
-        testMSChannelnull.write(byteBuf);
-
-        this.channel1.close();
-        try {
-            this.channel1.write(byteBuf);
-            fail("Should throw ClosedChannelException");
-        } catch (ClosedChannelException e) {
-            // correct
-        }
-    }
-
-    /*
-     * Test method for 'java.nio.channels.SocketChannel.write(ByteBuffer[])'
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "write",
-        args = {java.nio.ByteBuffer[].class}
-    )
-    public void testWriteByteBufferArray_BufNull() throws IOException {
-        java.nio.ByteBuffer[] byteBuf = null;
-        MockSocketChannel testMSChannelnull = new MockSocketChannel(null);
-        MockSocketChannel testMSChannel = new MockSocketChannel(
-                SelectorProvider.provider());
-        this.channel1.connect(localAddr1);
-        try {
-            this.channel1.write(byteBuf);
-            fail("Should throw NPE");
-        } catch (NullPointerException e) {
-            // correct
-        }
-        byteBuf = new java.nio.ByteBuffer[1];
-        try {
-            this.channel1.write(byteBuf);
-            fail("Should throw NPE");
-        } catch (NullPointerException e) {
-            // correct
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "socket",
-        args = {}
-    )
-    @AndroidOnly("Fails on RI. See comment below")
-    public void testSocket_BasicStatusBeforeConnect() throws IOException {
-        assertFalse(this.channel1.isConnected());// not connected
-        Socket s1 = this.channel1.socket();
-        // RI fails here. RI returns 0 while spec says getLocalPort()
-        // shall return -1 for unbound socket
-        assertSocketBeforeConnect(s1);
-        Socket s2 = this.channel1.socket();
-        // same
-        assertSame(s1, s2);
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "socket",
-        args = {}
-    )
-    public void testSocket_Block_BasicStatusAfterConnect() throws IOException {
-        assertFalse(this.channel1.isConnected());// not connected
-        assertTrue(this.channel1.connect(localAddr1));
-
-        assertTrue(this.channel1.isConnected());
-        Socket s1 = this.channel1.socket();
-
-        assertSocketAfterConnect(s1, localAddr1);
-        Socket s2 = this.channel1.socket();
-        // same
-        assertSame(s1, s2);
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "socket",
-        args = {}
-    )
-    @AndroidOnly("Fails on RI. See comment below")
-    public void testSocket_NonBlock_BasicStatusAfterConnect() throws Exception {
-        assertFalse(this.channel1.isConnected());// not connected
-        this.channel1.configureBlocking(false);
-        assertFalse(this.channel1.connect(localAddr1));
-        assertFalse(this.channel1.isConnected());
-        assertTrue(this.channel1.isConnectionPending());
-        Socket s1 = this.channel1.socket();
-        // status of not connected
-        // RI fails here. RI returns 0 while spec says getLocalPort()
-        // shall return -1 for unbound socket
-        assertSocketBeforeConnect(s1);
-        Socket s2 = this.channel1.socket();
-        // same
-        assertSame(s1, s2);
-
-        assertTrue(tryFinish());
-        assertTrue(this.channel1.isConnected());
-        s1 = this.channel1.socket();
-        assertSocketAfterConnect(s1, localAddr1);
-        s2 = this.channel1.socket();
-        // same
-        assertSame(s1, s2);
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "socket",
-        args = {}
-    )
-    public void testSocket_Block_ActionsBeforeConnect() throws IOException {
-        assertFalse(this.channel1.isConnected());// not connected
-        Socket s = this.channel1.socket();
-        assertSocketAction_Block_BeforeConnect(s);
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "socket",
-        args = {}
-    )
-    public void testSocket_Block_ActionsAfterConnect() throws IOException {
-        assertFalse(this.channel1.isConnected());// not connected
-        assertTrue(this.channel1.connect(localAddr1));
-        assertTrue(this.channel1.isConnected());
-        Socket s = this.channel1.socket();
-        assertSocketAction_Block_AfterConnect(s);
-
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "socket",
-        args = {}
-    )
-    public void testSocket_NonBlock_ActionsAfterConnectBeforeFinish()
-            throws IOException {
-        assertFalse(this.channel1.isConnected());// not connected
-        this.channel1.configureBlocking(false);
-        assertFalse(this.channel1.connect(localAddr1));
-        assertFalse(this.channel1.isConnected());
-        assertTrue(this.channel1.isConnectionPending());
-        Socket s1 = this.channel1.socket();
-        // Action of not connected
-        assertSocketAction_NonBlock_BeforeConnect(s1);
-        Socket s2 = this.channel1.socket();
-        // same
-        assertSame(s1, s2);
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "socket",
-        args = {}
-    )
-    public void testSocket_NonBlock_ActionsAfterConnectAfterFinish()
-            throws Exception {
-        assertFalse(this.channel1.isConnected());// not connected
-        this.channel1.configureBlocking(false);
-        assertFalse(this.channel1.connect(localAddr1));
-        assertTrue(tryFinish());
-        Socket s1 = this.channel1.socket();
-        assertSocketAction_NonBlock_AfterConnect(s1);
-        Socket s2 = this.channel1.socket();
-        // same
-        assertSame(s1, s2);
-    }
-
-    private void assertSocketBeforeConnect(Socket s) throws IOException {
-        assertFalse(s.isBound());
-        assertFalse(s.isClosed());
-        assertFalse(s.isConnected());
-        assertFalse(s.getKeepAlive());
-        try {
-            s.getInputStream();
-            fail("Should throw SocketException.");
-        } catch (SocketException e) {
-            // OK.
-        }
-        assertFalse(s.getOOBInline());
-        try {
-            s.getOutputStream();
-            fail("Should throw SocketException.");
-        } catch (SocketException e) {
-            // OK.
-        }
-        assertEquals(-1, s.getSoLinger());
-        assertFalse(s.getTcpNoDelay());
-
-        assertFalse(s.isInputShutdown());
-        assertFalse(s.isOutputShutdown());
-
-        assertNull(s.getInetAddress());
-        assertEquals(s.getLocalAddress().getHostAddress(), "0.0.0.0");
-        assertFalse(s.getReuseAddress());
-        assertNull(s.getLocalSocketAddress());
-
-        // not connected
-        assertEquals(0, s.getPort());
-        assertTrue(s.getReceiveBufferSize() >= 8192);
-        assertNull(s.getRemoteSocketAddress());
-        assertTrue(s.getSendBufferSize() >= 8192);
-        assertEquals(0, s.getSoTimeout());
-        assertEquals(0, s.getTrafficClass());
-
-        // RI fails here. RI returns 0 while spec says unbound socket should
-        // return -1.
-        assertEquals(-1, s.getLocalPort());
-    }
-
-    private void assertSocketAfterConnect(Socket s, InetSocketAddress address)
-            throws IOException {
-        assertTrue(s.isBound());
-        assertFalse(s.isClosed());
-        assertTrue(s.isConnected());
-        assertFalse(s.getKeepAlive());
-
-        assertNotNull(s.getInputStream());
-        assertNotNull(s.getOutputStream());
-
-        assertFalse(s.getOOBInline());
-        assertEquals(-1, s.getSoLinger());
-        assertFalse(s.getTcpNoDelay());
-
-        assertFalse(s.isInputShutdown());
-        assertFalse(s.isOutputShutdown());
-
-        assertSame(s.getInetAddress(), address.getAddress());
-
-        assertEquals(this.localAddr1.getAddress(), s.getLocalAddress());
-        assertEquals(address.getPort(), s.getPort());
-        assertNotNull(s.getLocalSocketAddress());
-        assertTrue(s.getReceiveBufferSize() >= 8192);
-        // equal , not same
-        assertNotSame(address, s.getRemoteSocketAddress());
-        assertEquals(address, s.getRemoteSocketAddress());
-        // assertFalse(s.getReuseAddress());
-        assertTrue(s.getSendBufferSize() >= 8192);
-        assertEquals(0, s.getSoTimeout());
-        assertEquals(0, s.getTrafficClass());
-    }
-
-    private void assertSocketAction_Block_BeforeConnect(Socket s)
-            throws IOException {
-        assertFalse(this.channel1.isConnected());
-        this.server2 = new ServerSocket(localAddr2.getPort());
-        s.connect(localAddr2);
-        assertTrue(this.channel1.isConnected());
-        assertTrue(s.isConnected());
-
-        assertSocketAfterConnect(s, localAddr2);
-
-        try {
-            s.bind(localAddr2);
-            fail("Should throw AlreadyConnectedException");
-        } catch (AlreadyConnectedException e) {
-            // OK.
-        }
-
-        s.close();
-        assertTrue(s.isClosed());
-        assertFalse(this.channel1.isOpen());
-    }
-
-    private void assertSocketAction_NonBlock_BeforeConnect(Socket s)
-            throws IOException {
-        assertFalse(this.channel1.isConnected());
-        this.server2 = new ServerSocket(localAddr2.getPort());
-        try {
-            s.connect(localAddr2);
-            fail("Should throw IllegalBlockingModeException");
-        } catch (IllegalBlockingModeException e1) {
-            // OK.
-        }
-
-        if (this.channel1.isConnectionPending()) {
-            try {
-                s.bind(localAddr2);
-                fail("Should throw ConnectionPendingException");
-            } catch (ConnectionPendingException e1) {
-                // OK.
-            }
-        } else {
-            try {
-                s.bind(localAddr2);
-                fail("Should throw BindException");
-            } catch (BindException e1) {
-                // OK.
-            }
-        }
-
-        assertFalse(this.channel1.isConnected());
-        assertFalse(s.isConnected());
-
-        s.close();
-        assertTrue(s.isClosed());
-        assertFalse(this.channel1.isOpen());
-    }
-
-    private void assertSocketAction_Block_AfterConnect(Socket s)
-            throws IOException {
-        assertEquals(localAddr1.getPort(), s.getPort());
-        assertTrue(this.channel1.isConnected());
-        assertTrue(s.isConnected());
-        try {
-            s.connect(localAddr2);
-            fail("Should throw AlreadyConnectedException");
-        } catch (AlreadyConnectedException e) {
-            // OK.
-        }
-
-        try {
-            s.bind(localAddr2);
-            fail("Should throw AlreadyConnectedException");
-        } catch (AlreadyConnectedException e) {
-            // OK.
-        }
-
-        s.close();
-        assertTrue(s.isClosed());
-        assertFalse(this.channel1.isOpen());
-    }
-
-    private void assertSocketAction_NonBlock_AfterConnect(Socket s)
-            throws IOException {
-        assertEquals(localAddr1.getPort(), s.getPort());
-        assertTrue(this.channel1.isConnected());
-        assertTrue(s.isConnected());
-
-        if (this.channel1.isConnectionPending()) {
-            try {
-                s.connect(localAddr2);
-                fail("Should throw AlreadyConnectedException");
-            } catch (AlreadyConnectedException e) {
-                // OK.
-            }
-        } else {
-            try {
-                s.connect(localAddr2);
-                fail("Should throw IllegalBlockingModeException");
-            } catch (IllegalBlockingModeException e) {
-                // OK.
-            }
-        }
-
-        try {
-            s.bind(localAddr2);
-            fail("Should throw AlreadyConnectedException");
-        } catch (AlreadyConnectedException e) {
-            // OK.
-        }
-
-        s.close();
-        assertTrue(s.isClosed());
-        assertFalse(this.channel1.isOpen());
-    }
-
-    // -------------------------------------------------------------------
-    // Tests for connect(), finishConnect(),isConnected(),isConnectionPending()
-    // These methods are very close, so we test them together, call them "CFII".
-    // -------------------------------------------------------------------
-    /**
-     * connect-->finish-->close
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_Norml_NoServer_Block() throws Exception {
-        // ensure
-        ensureServerClosed();
-        assertTrue(this.channel1.isBlocking());
-        statusNotConnected_NotPending();
-        // connect
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw a ConnectException here.");
-        } catch (ConnectException e) {
-            // OK.
-        }
-        statusChannelClosed();
-        try {
-            this.channel1.finishConnect();
-            fail("Should throw a ClosedChannelException here.");
-        } catch (ClosedChannelException e) {
-            // OK.
-        }
-    }
-
-    /**
-     * connect-->finish-->close
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_Norml_NoServer_NonBlock() throws Exception {
-        connectNoServerNonBlock();
-
-        this.channel1.close();
-        statusChannelClosed();
-    }
-
-    /**
-     * connect-->finish-->close
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_Norml_Server_Block() throws Exception {
-        connectServerBlock();
-
-        this.channel1.close();
-        statusChannelClosed();
-
-    }
-
-    /**
-     * connect-->finish-->close
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_Norml_Server_NonBlock() throws Exception {
-        connectServerNonBlock();
-
-        this.channel1.close();
-        statusChannelClosed();
-    }
-
-    /**
-     * connect-->server closed-->finish-->close
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_ServerClosed_Block() throws Exception {
-        // ensure
-        ensureServerOpen();
-        assertTrue(this.channel1.isBlocking());
-        statusNotConnected_NotPending();
-        // connect
-        assertTrue(this.channel1.connect(localAddr1));
-        statusConnected_NotPending();
-
-        ensureServerClosed();
-
-        tryFinish();
-
-        this.channel1.close();
-        statusChannelClosed();
-
-    }
-
-    /**
-     * connect-->server closed-->finish-->close
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_ServerClosed_NonBlock() throws Exception {
-        // ensure
-        ensureServerOpen();
-        this.channel1.configureBlocking(false);
-        statusNotConnected_NotPending();
-        // connect
-        assertFalse(this.channel1.connect(localAddr1));
-        statusNotConnected_Pending();
-
-        ensureServerClosed();
-
-        tryFinish();
-
-        this.channel1.close();
-        statusChannelClosed();
-    }
-
-    /**
-     * connect-->finish-->server closed-->close
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_ServerClosedAfterFinish_Block() throws Exception {
-        connectServerBlock();
-
-        ensureServerClosed();
-        assertTrue(this.channel1.isOpen());
-        this.channel1.close();
-        statusChannelClosed();
-
-    }
-
-    /**
-     * connect-->finish-->server closed-->close
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_ServerClosedAfterFinish_NonBlock() throws Exception {
-        connectServerNonBlock();
-
-        ensureServerClosed();
-        assertTrue(this.channel1.isOpen());
-        this.channel1.close();
-        statusChannelClosed();
-    }
-
-    /**
-     * no server-->connect-->server open-->finish-->close
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_ServerStartLater_Block() throws Exception {
-        // ensure
-        ensureServerClosed();
-        assertTrue(this.channel1.isBlocking());
-        statusNotConnected_NotPending();
-        // connect
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw a ConnectException here.");
-        } catch (ConnectException e) {
-            // OK.
-        }
-        statusChannelClosed();
-        ensureServerOpen();
-        try {
-            this.channel1.finishConnect();
-            fail("Should throw a ClosedChannelException here.");
-        } catch (ClosedChannelException e) {
-            // OK.
-        }
-    }
-
-    /**
-     * no server-->connect-->server open-->finish-->close
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_ServerStartLater_NonBlock() throws Exception {
-        // ensure
-        ensureServerClosed();
-        this.channel1.configureBlocking(false);
-        statusNotConnected_NotPending();
-        // connect
-        assertFalse(this.channel1.connect(localAddr1));
-        statusNotConnected_Pending();
-
-        ensureServerOpen();
-
-        try {
-            assertFalse(this.channel1.finishConnect());
-            statusNotConnected_Pending();
-            this.channel1.close();
-        } catch (ConnectException e) {
-            // OK
-        }
-    }
-
-    /**
-     * connect-->finish-->finish-->close
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_FinishTwice_NoServer_NonBlock() throws Exception {
-        // ensure
-        ensureServerClosed();
-        this.channel1.configureBlocking(false);
-        statusNotConnected_NotPending();
-        // connect
-        assertFalse(this.channel1.connect(localAddr1));
-        statusNotConnected_Pending();
-        try {
-            assertFalse(this.channel1.finishConnect());
-        } catch (ConnectException e) {
-            // OK
-        }
-        statusChannelClosed();
-        try {
-            assertFalse(this.channel1.finishConnect());
-        } catch (ClosedChannelException e) {
-            // OK
-        }
-        statusChannelClosed();
-
-        this.channel1.close();
-        statusChannelClosed();
-    }
-
-    /**
-     * connect-->finish-->finish-->close
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_FinishTwice_Server_Block() throws Exception {
-        connectServerBlock();
-        tryFinish();
-        this.channel1.close();
-        statusChannelClosed();
-
-    }
-
-    /**
-     * connect-->finish-->finish-->close
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_FinishTwice_Server_NonBlock() throws Exception {
-        connectServerNonBlock();
-        tryFinish();
-        this.channel1.close();
-        statusChannelClosed();
-    }
-
-    /**
-     * connect-->finish-->connect-->close
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "Verifies case:  connect-->finish-->connect-->close. Verifies ClosedChannelException, ConnectException.",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "Verifies case:  connect-->finish-->connect-->close. Verifies ClosedChannelException, ConnectException.",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_ConnectAfterFinish_NoServer_Block() throws Exception {
-        // ensure
-        ensureServerClosed();
-        assertTrue(this.channel1.isBlocking());
-        statusNotConnected_NotPending();
-        // connect
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw a ConnectException here.");
-        } catch (ConnectException e) {
-            // OK.
-        }
-        statusChannelClosed();
-        try {
-            this.channel1.finishConnect();
-            fail("Should throw a ClosedChannelException here.");
-        } catch (ClosedChannelException e) {
-            // OK.
-        }
-        statusChannelClosed();
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw a ClosedChannelException here.");
-        } catch (ClosedChannelException e) {
-            // OK.
-        }
-        statusChannelClosed();
-    }
-
-    /**
-     * connect-->finish-->connect-->close
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "Verifies case: connect-->finish-->connect-->close. Verifies ConnectionPendingException, ConnectException.",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "Verifies case: connect-->finish-->connect-->close. Verifies ConnectionPendingException, ConnectException.",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_ConnectAfterFinish_NoServer_NonBlock()
-            throws Exception {
-        // ensure
-        ensureServerClosed();
-        this.channel1.configureBlocking(false);
-        statusNotConnected_NotPending();
-        // connect
-        assertFalse(this.channel1.connect(localAddr1));
-        statusNotConnected_Pending();
-
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw a ConnectionPendingException here.");
-        } catch (ConnectionPendingException e) {
-            // OK.
-        }
-        statusNotConnected_Pending();
-
-        // connect another addr
-        try {
-            this.channel1.connect(localAddr2);
-            fail("Should throw a ConnectionPendingException here.");
-        } catch (ConnectionPendingException e) {
-            // OK.
-        }
-        statusNotConnected_Pending();
-
-        // connect if server closed
-        ensureServerClosed();
-
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw a ConnectionPendingException here.");
-        } catch (ConnectionPendingException e) {
-            // OK.
-        }
-        statusNotConnected_Pending();
-
-        this.channel1.close();
-
-        statusChannelClosed();
-    }
-
-    /**
-     * connect-->finish-->connect-->close
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies AlreadyConnectedException.",
-        method = "connect",
-        args = {java.net.SocketAddress.class}
-    )
-    public void testCFII_ConnectAfterFinish_Server_Block() throws Exception {
-        connectServerBlock();
-
-        if (!this.channel1.isConnected()) {
-            fail("Connection failed," +
-                    "testCFII_ConnectAfterFinish_Server_Block not finished.");
-        }
-
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw an AlreadyConnectedException here.");
-        } catch (AlreadyConnectedException e) {
-            // OK.
-        }
-        statusConnected_NotPending();
-
-        // connect another addr
-        try {
-            this.channel1.connect(localAddr2);
-            fail("Should throw an AlreadyConnectedException here.");
-        } catch (AlreadyConnectedException e) {
-            // OK.
-        }
-        statusConnected_NotPending();
-
-        // connect if server closed
-        ensureServerClosed();
-
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw an AlreadyConnectedException here.");
-        } catch (AlreadyConnectedException e) {
-            // OK.
-        }
-        statusConnected_NotPending();
-
-        this.channel1.close();
-        statusChannelClosed();
-
-    }
-
-    /**
-     * connect-->finish-->connect-->close
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies AlreadyConnectedException.",
-        method = "connect",
-        args = {java.net.SocketAddress.class}
-    )
-    public void testCFII_ConnectAfterFinish_Server_NonBlock() throws Exception {
-        connectServerNonBlock();
-
-        if (!this.channel1.isConnected()) {
-            fail("Connection failed," +
-                    "testCFII_ConnectAfterFinish_Server_Block not finished.");
-        }
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw an AlreadyConnectedException or a ConnectionPendingException here.");
-        } catch (AlreadyConnectedException e) {
-            // OK.
-        }
-
-        statusConnected_NotPending();
-
-        // connect another addr
-        try {
-            this.channel1.connect(localAddr2);
-            fail("Should throw an AlreadyConnectedException here.");
-        } catch (AlreadyConnectedException e) {
-            // OK.
-        }
-        statusConnected_NotPending();
-
-        // connect if server closed
-        ensureServerClosed();
-
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw an AlreadyConnectedException here.");
-        } catch (AlreadyConnectedException e) {
-            // OK.
-        }
-        statusConnected_NotPending();
-
-        this.channel1.close();
-        statusChannelClosed();
-    }
-
-    /**
-     * connect-->connect-->finish-->close
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "Verifies case: connect-->connect-->finish-->close. Verifies ConnectionPendingException, ConnectException.",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "Verifies case: connect-->connect-->finish-->close. Verifies ConnectionPendingException, ConnectException.",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_ConnectTwice_NoServer_NonBlock() throws Exception {
-        // ensure
-        ensureServerClosed();
-        this.channel1.configureBlocking(false);
-        statusNotConnected_NotPending();
-        // connect
-        assertFalse(this.channel1.connect(localAddr1));
-        statusNotConnected_Pending();
-
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw a ConnectionPendingException here.");
-        } catch (ConnectionPendingException e) {
-            // OK.
-        }
-        statusNotConnected_Pending();
-
-        // connect another addr
-        try {
-            this.channel1.connect(localAddr2);
-            fail("Should throw a ConnectionPendingException here.");
-        } catch (ConnectionPendingException e) {
-            // OK.
-        }
-        statusNotConnected_Pending();
-
-        // connect if server closed
-        ensureServerClosed();
-
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw a ConnectionPendingException here.");
-        } catch (ConnectionPendingException e) {
-            // OK.
-        }
-        statusNotConnected_Pending();
-        this.channel1.close();
-
-        statusChannelClosed();
-    }
-
-    /**
-     * connect-->connect-->finish-->close
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "Verifies case connect-->connect-->finish-->close. Verifies AlreadyConnectedException.",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "Verifies case connect-->connect-->finish-->close. Verifies AlreadyConnectedException.",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_ConnectTwice_Server_Block() throws Exception {
-        // ensure
-        ensureServerOpen();
-        assertTrue(this.channel1.isBlocking());
-        statusNotConnected_NotPending();
-        // connect
-        assertTrue(this.channel1.connect(localAddr1));
-        statusConnected_NotPending();
-
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw an AlreadyConnectedException here.");
-        } catch (AlreadyConnectedException e) {
-            // OK.
-        }
-        statusConnected_NotPending();
-
-        // connect another addr
-        try {
-            this.channel1.connect(localAddr2);
-            fail("Should throw an AlreadyConnectedException here.");
-        } catch (AlreadyConnectedException e) {
-            // OK.
-        }
-        statusConnected_NotPending();
-
-        // connect if server closed
-        ensureServerClosed();
-
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw an AlreadyConnectedException here.");
-        } catch (AlreadyConnectedException e) {
-            // OK.
-        }
-        statusConnected_NotPending();
-
-        tryFinish();
-
-        this.channel1.close();
-        statusChannelClosed();
-
-    }
-
-    /**
-     * connect-->connect-->finish-->close
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "Verifies case connect-->connect-->finish-->close. Verifies ConnectionPendingException.",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "Verifies case connect-->connect-->finish-->close. Verifies ConnectionPendingException.",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_ConnectTwice_Server_NonBlock() throws Exception {
-        // ensure
-        ensureServerOpen();
-        this.channel1.configureBlocking(false);
-        statusNotConnected_NotPending();
-        // connect
-        assertFalse(this.channel1.connect(localAddr1));
-        statusNotConnected_Pending();
-
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw a ConnectionPendingException here.");
-        } catch (ConnectionPendingException e) {
-            // OK.
-        }
-        statusNotConnected_Pending();
-
-        // connect another addr
-        try {
-            this.channel1.connect(localAddr2);
-            fail("Should throw a ConnectionPendingException here.");
-        } catch (ConnectionPendingException e) {
-            // OK.
-        }
-        statusNotConnected_Pending();
-
-        // connect if server closed
-        ensureServerClosed();
-
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw a ConnectionPendingException here.");
-        } catch (ConnectionPendingException e) {
-            // OK.
-        }
-        statusNotConnected_Pending();
-
-        tryFinish();
-
-        this.channel1.close();
-        statusChannelClosed();
-    }
-
-    /**
-     * finish-->connect-->finish-->close
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_FinishFirst_NoServer_Block() throws Exception {
-        // ensure
-        ensureServerClosed();
-        assertTrue(this.channel1.isBlocking());
-        statusNotConnected_NotPending();
-        // finish
-        try {
-            this.channel1.finishConnect();
-            fail("Should throw NoConnectionPendingException");
-        } catch (NoConnectionPendingException e) {
-            // OK.
-        }
-        statusNotConnected_NotPending();
-        // connect
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw a ConnectException here.");
-        } catch (ConnectException e) {
-            // OK.
-        }
-        statusChannelClosed();
-        try {
-            this.channel1.finishConnect();
-            fail("Should throw a ClosedChannelException here.");
-        } catch (ClosedChannelException e) {
-            // OK.
-        }
-        statusChannelClosed();
-    }
-
-    /**
-     * finish-->connect-->finish-->close
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_FinishFirst_NoServer_NonBlock() throws Exception {
-        // ensure
-        ensureServerClosed();
-        this.channel1.configureBlocking(false);
-        statusNotConnected_NotPending();
-        // finish
-        try {
-            this.channel1.finishConnect();
-            fail("Should throw NoConnectionPendingException");
-        } catch (NoConnectionPendingException e) {
-            // OK.
-        }
-        statusNotConnected_NotPending();
-        // connect
-        assertFalse(this.channel1.connect(localAddr1));
-        statusNotConnected_Pending();
-        this.channel1.close();
-
-        statusChannelClosed();
-    }
-
-    /**
-     * finish-->connect-->finish-->close
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_FinishFirst_Server_Block() throws Exception {
-        // ensure
-        ensureServerOpen();
-        assertTrue(this.channel1.isBlocking());
-        statusNotConnected_NotPending();
-        // finish
-        try {
-            this.channel1.finishConnect();
-            fail("Should throw NoConnectionPendingException");
-        } catch (NoConnectionPendingException e) {
-            // OK.
-        }
-        statusNotConnected_NotPending();
-        // connect
-        assertTrue(this.channel1.connect(localAddr1));
-        statusConnected_NotPending();
-
-        tryFinish();
-
-        this.channel1.close();
-        statusChannelClosed();
-
-    }
-
-    /**
-     * finish-->connect-->finish-->close
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_FinishFirst_Server_NonBlock() throws Exception {
-        // ensure
-        ensureServerOpen();
-        this.channel1.configureBlocking(false);
-        statusNotConnected_NotPending();
-        // finish
-        try {
-            this.channel1.finishConnect();
-            fail("Should throw NoConnectionPendingException");
-        } catch (NoConnectionPendingException e) {
-            // OK.
-        }
-        statusNotConnected_NotPending();
-        // connect
-        assertFalse(this.channel1.connect(localAddr1));
-        statusNotConnected_Pending();
-
-        tryFinish();
-
-        this.channel1.close();
-        statusChannelClosed();
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "connect",
-        args = {java.net.SocketAddress.class}
-    )
-    public void testCFII_Null() throws Exception {
-        statusNotConnected_NotPending();
-        try {
-            this.channel1.connect(null);
-            fail("Should throw an IllegalArgumentException here.");
-        } catch (IllegalArgumentException e) {
-            // OK.
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "connect",
-        args = {java.net.SocketAddress.class}
-    )
-    public void testCFII_UnsupportedType() throws Exception {
-        statusNotConnected_NotPending();
-        SocketAddress newTypeAddress = new SubSocketAddress();
-        try {
-            this.channel1.connect(newTypeAddress);
-            fail("Should throw an UnsupportedAddressTypeException here.");
-        } catch (UnsupportedAddressTypeException e) {
-            // OK.
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "connect",
-        args = {java.net.SocketAddress.class}
-    )
-    public void testCFII_Unresolved() throws IOException {
-        statusNotConnected_NotPending();
-        InetSocketAddress unresolved = new InetSocketAddress(
-                "unresolved address", 1080);
-        try {
-            this.channel1.connect(unresolved);
-            fail("Should throw an UnresolvedAddressException here.");
-        } catch (UnresolvedAddressException e) {
-            // OK.
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "connect",
-        args = {java.net.SocketAddress.class}
-    )
-    public void testCFII_EmptyHost() throws Exception {
-        statusNotConnected_NotPending();
-        ServerSocket server = new ServerSocket(0);
-        int port = server.getLocalPort();
-        server.close();
-        try {
-            this.channel1.connect(new InetSocketAddress("", port));
-            fail("Should throw ConnectException");
-        } catch (ConnectException e) {
-            // correct
-        }
-    }
-
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "Verifies ClosedChannelException.",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "Verifies ClosedChannelException.",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_CloseFirst() throws Exception {
-        this.channel1.close();
-        statusChannelClosed();
-        ensureServerOpen();
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw ClosedChannelException.");
-        } catch (ClosedChannelException e) {
-            // OK.
-        }
-        statusChannelClosed();
-        try {
-            this.channel1.finishConnect();
-            fail("Should throw ClosedChannelException.");
-        } catch (ClosedChannelException e) {
-            // OK.
-        }
-        statusChannelClosed();
-        try {
-            this.channel1.configureBlocking(false);
-            fail("Should throw ClosedChannelException.");
-        } catch (ClosedChannelException e) {
-            // OK.
-        }
-        statusChannelClosed();
-    }
-
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_StatusAfterFinish() throws Exception {
-        // 1. close server, finish must return false, check the status
-        ensureServerClosed();
-
-        // 1.1 block mode
-        assertTrue(this.channel1.isBlocking());
-        try {
-            channel1.connect(localAddr1);
-            fail("Should throw ConnectException");
-        } catch (ConnectException e) {
-            // OK.
-        }
-
-        assertFalse(this.channel1.isOpen());
-        assertTrue(this.channel1.isBlocking());
-        assertFalse(this.channel1.isConnectionPending());
-
-        // 1.2 non block mode
-        this.channel1 = SocketChannel.open();
-        this.channel1.configureBlocking(false);
-        assertFalse(this.channel1.connect(localAddr1));
-        try {
-            assertFalse(this.channel1.finishConnect());
-            fail("Should throw IOException: Connection refused");
-        } catch (ConnectException e) {
-            // OK
-        }
-        statusChannelClosed();
-
-        // 2. start server, finish usually return true, check the status
-        ensureServerOpen();
-
-        // 2.1 block mode
-        this.channel1 = SocketChannel.open();
-        assertTrue(this.channel1.isBlocking());
-        assertTrue(this.channel1.connect(localAddr1));
-        assertTrue(this.channel1.finishConnect());
-        statusConnected_NotPending();
-        this.channel1.close();
-
-        // 2.2 non block mode
-        this.channel1 = SocketChannel.open();
-        this.channel1.configureBlocking(false);
-        assertFalse(this.channel1.connect(localAddr1));
-        tryFinish();
-        this.channel1.close();
-    }
-
-    private void ensureServerClosed() throws IOException {
-        if (null != this.server1) {
-            this.server1.close();
-            assertTrue(this.server1.isClosed());
-        }
-        if (null != this.server2) {
-            this.server2.close();
-            assertTrue(this.server2.isClosed());
-        }
-    }
-
-    private void ensureServerOpen() throws IOException {
-        ensureServerClosed();
-        this.server1 = new ServerSocket(localAddr1.getPort());
-        this.server2 = new ServerSocket(localAddr2.getPort());
-        assertTrue(this.server1.isBound());
-        assertTrue(this.server2.isBound());
-    }
-
-    private void connectNoServerNonBlock() throws Exception {
-        // ensure
-        ensureServerClosed();
-        this.channel1.configureBlocking(false);
-        statusNotConnected_NotPending();
-        // connect
-        assertFalse(this.channel1.connect(localAddr1));
-        statusNotConnected_Pending();
-        try {
-            assertFalse(this.channel1.finishConnect());
-        } catch (ConnectException e) {
-            // OK
-        }
-        ensureServerClosed();
-    }
-
-    private void connectServerNonBlock() throws Exception {
-        // ensure
-        ensureServerOpen();
-        this.channel1.configureBlocking(false);
-        statusNotConnected_NotPending();
-        // connect
-        assertFalse(this.channel1.connect(localAddr1));
-        statusNotConnected_Pending();
-
-        tryFinish();
-    }
-
-    private void connectServerBlock() throws Exception {
-        // ensure
-        ensureServerOpen();
-        assertTrue(this.channel1.isBlocking());
-        statusNotConnected_NotPending();
-        // connect
-        assertTrue(this.channel1.connect(localAddr1));
-        statusConnected_NotPending();
-
-        tryFinish();
-    }
-
-    private void statusChannelClosed() {
-        assertFalse(this.channel1.isConnected());
-        assertFalse(this.channel1.isConnectionPending());
-        assertFalse(this.channel1.isOpen());
-    }
-
-    private void statusNotConnected_NotPending() {
-        assertFalse(this.channel1.isConnected());
-        assertFalse(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
-    }
-
-    private void statusNotConnected_Pending() {
-        assertFalse(this.channel1.isConnected());
-        assertTrue(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
-    }
-
-    private void statusConnected_NotPending() {
-        assertTrue(this.channel1.isConnected());
-        assertFalse(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
-    }
-
-    private boolean tryFinish() throws IOException {
-        /*
-         * the result of finish will be asserted in multi-thread tests.
-         */
-        boolean connected = false;
-        assertTrue(this.channel1.isOpen());
-        try {
-            connected = this.channel1.finishConnect();
-        } catch (SocketException e) {
-            // Finish connection failed, probably due to reset by peer error.
-        }
-        if (connected) {
-            statusConnected_NotPending();
-        }
-        return connected;
-    }
-
-    // -------------------------------------------------------------------
-    // Original tests. Test method for CFII with real data.
-    // -------------------------------------------------------------------
-
-    /**
-     *
-     * 'SocketChannelImpl.connect(SocketAddress)'
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "connect",
-        args = {java.net.SocketAddress.class}
-    )
-    public void testCFII_Data_ConnectWithServer() throws Exception {
-        ensureServerOpen();
-        java.nio.ByteBuffer writeBuf = java.nio.ByteBuffer
-                .allocate(CAPACITY_NORMAL);
-        java.nio.ByteBuffer[] writeBufArr = new java.nio.ByteBuffer[1];
-        writeBufArr[0] = java.nio.ByteBuffer.allocate(CAPACITY_NORMAL);
-        assertFalse(this.channel1.isRegistered());
-        assertTrue(this.channel1.isBlocking());
-
-        this.channel1.connect(localAddr1);
-
-        assertTrue(this.channel1.isBlocking());
-        assertTrue(this.channel1.isConnected());
-        assertFalse(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
-        assertEquals(CAPACITY_NORMAL, this.channel1.write(writeBuf));
-        assertEquals(CAPACITY_NORMAL, this.channel1.write(writeBufArr, 0, 1));
-
-        this.channel1.configureBlocking(false);
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw AlreadyConnectedException");
-        } catch (AlreadyConnectedException e) {
-            // correct
-        }
-
-        assertFalse(this.channel1.isRegistered());
-        tryFinish();
-    }
-
-    /*
-     * Test method for 'SocketChannelImpl.connect(SocketAddress)'
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "finishConnect",
-            args = {}
-        )
-    })
-    public void testCFII_Data_ConnectWithServer_nonBlocking() throws Exception {
-        ensureServerOpen();
-        java.nio.ByteBuffer writeBuf = java.nio.ByteBuffer
-                .allocate(CAPACITY_NORMAL);
-        java.nio.ByteBuffer[] writeBufArr = new java.nio.ByteBuffer[1];
-        writeBufArr[0] = java.nio.ByteBuffer.allocate(CAPACITY_NORMAL);
-        assertFalse(this.channel1.isRegistered());
-        assertTrue(this.channel1.isBlocking());
-        this.channel1.configureBlocking(false);
-        this.channel1.connect(localAddr1);
-
-        assertFalse(this.channel1.isBlocking());
-        assertFalse(this.channel1.isConnected());
-        assertTrue(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
-        assertTrue(tryFinish());
-        assertEquals(CAPACITY_NORMAL, this.channel1.write(writeBuf));
-        assertEquals(CAPACITY_NORMAL, this.channel1
-                .write(writeBufArr, 0, 1));
-
-        this.channel1.configureBlocking(false);
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw AlreadyConnectedException");
-        } catch (AlreadyConnectedException e) {
-            // correct
-        }
-
-        assertFalse(this.channel1.isRegistered());
-        tryFinish();
-    }
-
-    /*
-     * Test method for 'SocketChannelImpl.finishConnect()'
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "finishConnect",
-        args = {}
-    )
-    public void testCFII_Data_FinishConnect_nonBlocking() throws IOException {
-        ensureServerOpen();
-
-        java.nio.ByteBuffer writeBuf = java.nio.ByteBuffer
-                .allocate(CAPACITY_NORMAL);
-        java.nio.ByteBuffer[] writeBufArr = new java.nio.ByteBuffer[1];
-        writeBufArr[0] = java.nio.ByteBuffer.allocate(CAPACITY_NORMAL);
-
-        this.channel1.configureBlocking(false);
-        try {
-            this.channel1.finishConnect();
-            fail("Should throw NoConnectionPendingException");
-        } catch (NoConnectionPendingException e) {
-            // correct
-        }
-        this.channel1.connect(localAddr1);
-        assertFalse(this.channel1.isBlocking());
-        assertFalse(this.channel1.isConnected());
-        assertTrue(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
-        this.server1.accept();
-        assertTrue(tryFinish());
-        assertEquals(CAPACITY_NORMAL, this.channel1.write(writeBuf));
-        assertEquals(CAPACITY_NORMAL, this.channel1
-                .write(writeBufArr, 0, 1));
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw AlreadyConnectedException");
-        } catch (AlreadyConnectedException e) {
-            // correct
-        }
-
-        assertFalse(this.channel1.isRegistered());
-        tryFinish();
-    }
-
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "connect",
-            args = {java.net.SocketAddress.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "finishConnect",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "Verifies IOException",
-            method = "open",
-            args = {SocketAddress.class}
-        )
-    })
-    public void testCFII_Data_FinishConnect_AddrSetServerStartLater()
-            throws IOException {
-        ensureServerClosed();
-        java.nio.ByteBuffer[] writeBufArr = new java.nio.ByteBuffer[1];
-        writeBufArr[0] = java.nio.ByteBuffer.allocate(CAPACITY_NORMAL);
-        this.channel1.configureBlocking(false);
-        try {
-            SocketChannel.open(localAddr1);
-            fail("Should throw ConnectException");
-        } catch (ConnectException e) {
-            // correct
-        }
-        assertTrue(this.channel1.isOpen());
-        assertFalse(this.channel1.isBlocking());
-        assertFalse(this.channel1.isConnectionPending());
-        this.channel1.configureBlocking(true);
-        try {
-            this.channel1.finishConnect();
-            fail("Should throw NoConnectionPendingException");
-        } catch (NoConnectionPendingException e) {
-            // correct
-        }
-        try {
-            this.channel1.connect(localAddr2);
-            fail("Should throw ConnectException");
-        } catch (ConnectException e) {
-            // correct
-        }
-
-        assertTrue(this.channel1.isBlocking());
-        try {
-            this.channel1.finishConnect();
-            fail("Should throw ClosedChannelException");
-        } catch (ClosedChannelException e) {
-            // correct
-        }
-        assertFalse(this.channel1.isConnected());
-        // finish after finish OK
-        assertFalse(this.channel1.isConnectionPending());
-        this.channel1 = SocketChannel.open();
-        this.channel1.configureBlocking(false);
-        this.channel1.connect(localAddr1);
-        assertFalse(this.channel1.isConnected());
-        ensureServerOpen();
-        // cannot connect?
-            assertFalse(this.channel1.isBlocking());
-        assertFalse(this.channel1.isConnected());
-        assertTrue(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw ConnectionPendingException");
-        } catch (ConnectionPendingException e) {
-            // correct
-        }
-        this.channel1.configureBlocking(true);
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw ConnectionPendingException");
-        } catch (ConnectionPendingException e) {
-            // correct
-        }
-        tryFinish();
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "finishConnect",
-        args = {}
-    )
-    public void testCFII_Data_FinishConnect_ServerStartLater()
-            throws IOException {
-        ensureServerClosed();
-        java.nio.ByteBuffer[] writeBufArr = new java.nio.ByteBuffer[1];
-        writeBufArr[0] = java.nio.ByteBuffer.allocate(CAPACITY_NORMAL);
-        this.channel1.configureBlocking(true);
-        try {
-            this.channel1.finishConnect();
-            fail("Should throw NoConnectionPendingException");
-        } catch (NoConnectionPendingException e) {
-            // correct
-        }
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw ConnectException");
-        } catch (ConnectException e) {
-            // correct
-        }
-
-        try {
-            this.channel1.finishConnect();
-            fail("Should throw ClosedChannelException");
-        } catch (ClosedChannelException e) {
-            // correct
-        }
-        assertFalse(this.channel1.isConnected());
-        // finish after finish OK
-        assertFalse(this.channel1.isConnectionPending());
-        this.channel1 = SocketChannel.open();
-        this.channel1.configureBlocking(false);
-        this.channel1.connect(localAddr1);
-        assertFalse(this.channel1.isConnected());
-        ensureServerOpen();
-        // cannot connect?
-        assertFalse(this.channel1.isBlocking());
-        assertFalse(this.channel1.isConnected());
-        assertTrue(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw ConnectionPendingException");
-        } catch (ConnectionPendingException e) {
-            // correct
-        }
-        this.channel1.configureBlocking(true);
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw ConnectionPendingException");
-        } catch (ConnectionPendingException e) {
-            // correct
-        }
-        tryFinish();
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "finishConnect",
-        args = {}
-    )
-    public void testCFII_Data_FinishConnect_Blocking() throws IOException {
-        ensureServerOpen();
-        java.nio.ByteBuffer writeBuf = java.nio.ByteBuffer
-                .allocate(CAPACITY_NORMAL);
-        java.nio.ByteBuffer[] writeBufArr = new java.nio.ByteBuffer[1];
-        writeBufArr[0] = java.nio.ByteBuffer.allocate(CAPACITY_NORMAL);
-        this.channel1.configureBlocking(true);
-        try {
-            this.channel1.finishConnect();
-            fail("Should throw NoConnectionPendingException");
-        } catch (NoConnectionPendingException e) {
-            // correct
-        }
-
-        this.channel1.connect(localAddr1);
-
-        assertTrue(this.channel1.isConnected());
-        assertFalse(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
-        assertTrue(tryFinish());
-        assertEquals(CAPACITY_NORMAL, this.channel1.write(writeBuf));
-        assertEquals(CAPACITY_NORMAL, this.channel1
-                .write(writeBufArr, 0, 1));
-
-        try {
-            this.channel1.connect(localAddr1);
-            fail("Should throw AlreadyConnectedException");
-        } catch (AlreadyConnectedException e) {
-            // correct
-        }
-
-        assertFalse(this.channel1.isRegistered());
-        tryFinish();
-    }
-
-    /**
-     * Regression test for Harmony-1947.
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Doesn't verify exceptions.",
-        method = "finishConnect",
-        args = {}
-    )
-    public void test_finishConnect() throws Exception {
-        SocketAddress address = new InetSocketAddress("localhost", 2046);
-
-        ServerSocketChannel theServerChannel = ServerSocketChannel.open();
-        ServerSocket serversocket = theServerChannel.socket();
-        serversocket.setReuseAddress(true);
-        // Bind the socket
-        serversocket.bind(address);
-
-        boolean doneNonBlockingConnect = false;
-        // Loop so that we make sure we're definitely testing finishConnect()
-        while (!doneNonBlockingConnect) {
-            channel1 = SocketChannel.open();
-
-            // Set the SocketChannel to non-blocking so that connect(..) does
-            // not block
-            channel1.configureBlocking(false);
-            boolean connected = channel1.connect(address);
-            if (!connected) {
-                // Now set the SocketChannel back to blocking so that
-                // finishConnect() blocks.
-                channel1.configureBlocking(true);
-                doneNonBlockingConnect = channel1.finishConnect();
-            } else {
-                fail("Non blocking connect was connected too fast." +
-                        "Could not test finishConnect().");
-            }
-            if (doneNonBlockingConnect) {
-                tryFinish();
-            } else {
-                fail("finishConnect() did not finish the connection.");
-            }
-            channel1.close();
-        }
-        if (!serversocket.isClosed()) {
-            serversocket.close();
-        }
-    }
-
-    // -------------------------------------------------------------------
-    // End of original tests. Test method for CFII with real data.
-    // -------------------------------------------------------------------
-
-    /**
-     * @tests java.nio.channels.SocketChannel#read(ByteBuffer)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "read",
-        args = {java.nio.ByteBuffer[].class}
-    )
-    public void test_readLByteBuffer_Blocking() throws IOException {
-        // initialize write content
-        byte[] writeContent = new byte[CAPACITY_NORMAL];
-        for (int i = 0; i < writeContent.length; i++) {
-            writeContent[i] = (byte) i;
-        }
-        // establish connection
-        channel1.connect(localAddr1);
-        Socket acceptedSocket = server1.accept();
-
-        // use OutputStream.write to send CAPACITY_NORMAL bytes data
-        OutputStream out = acceptedSocket.getOutputStream();
-        out.write(writeContent);
-        // use close to guarantee all data is sent
-        acceptedSocket.close();
-
-        ByteBuffer readContent = ByteBuffer.allocate(CAPACITY_NORMAL + 1);
-        int totalCount = 0;
-        int count = 0;
-        long startTime = System.currentTimeMillis();
-        // use SocketChannel.read to read data
-        while (totalCount <= CAPACITY_NORMAL) {
-            count = channel1.read(readContent);
-            if (EOF == count) {
-                break;
-            }
-            totalCount += count;
-            // if the channel could not finish reading in TIMEOUT ms, the
-            // test fails. It is used to guarantee the test never hangs even
-            // if there are bugs of SocketChannel implementation. For
-            // blocking read, it possibly returns 0 in some cases.
-            assertTimeout(startTime, TIMEOUT);
-        }
-
-        // assert read content
-        assertEquals(CAPACITY_NORMAL, totalCount);
-        assertEquals(CAPACITY_NORMAL, readContent.position());
-        readContent.flip();
-        for (int i = 0; i < CAPACITY_NORMAL; i++) {
-            assertEquals(writeContent[i], readContent.get());
-        }
-    }
-
-    /**
-     * @tests java.nio.channels.SocketChannel#read(ByteBuffer)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "read",
-        args = {java.nio.ByteBuffer[].class}
-    )
-    public void test_readLByteBuffer_Nonblocking() throws IOException {
-        // initialize write content
-        byte[] writeContent = new byte[CAPACITY_NORMAL];
-        for (int i = 0; i < writeContent.length; i++) {
-            writeContent[i] = (byte) i;
-        }
-
-        // establish connection
-        channel1.connect(localAddr1);
-        Socket acceptedSocket = server1.accept();
-        // use OutputStream.write to write CAPACITY_NORMAL bytes data.
-        OutputStream out = acceptedSocket.getOutputStream();
-        out.write(writeContent);
-        // use close to guarantee all data is sent
-        acceptedSocket.close();
-
-        channel1.configureBlocking(false);
-        ByteBuffer readContent = ByteBuffer.allocate(CAPACITY_NORMAL + 1);
-        int totalCount = 0;
-        int count = 0;
-        long startTime = System.currentTimeMillis();
-        // use SocketChannel.read to read data
-        while (totalCount <= CAPACITY_NORMAL) {
-            count = channel1.read(readContent);
-            if (EOF == count) {
-                break;
-            }
-            totalCount += count;
-            // if the channel could not finish reading in TIMEOUT ms, the
-            // test fails. It is used to guarantee the test never hangs even
-            // if there are bugs of SocketChannel implementation.
-            assertTimeout(startTime, TIMEOUT);
-        }
-
-        // assert read content
-        assertEquals(CAPACITY_NORMAL, totalCount);
-        assertEquals(CAPACITY_NORMAL, readContent.position());
-        readContent.flip();
-        for (int i = 0; i < CAPACITY_NORMAL; i++) {
-            assertEquals(writeContent[i], readContent.get());
-        }
-    }
-
-    /**
-     * @tests java.nio.channels.SocketChannel#write(ByteBuffer)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "write",
-        args = {java.nio.ByteBuffer.class}
-    )
-    public void test_writeLjava_nio_ByteBuffer_Blocking() throws IOException {
-        // initialize write content
-        ByteBuffer writeContent = ByteBuffer.allocate(CAPACITY_NORMAL);
-        for (int i = 0; i < CAPACITY_NORMAL; i++) {
-            writeContent.put((byte) i);
-        }
-        writeContent.flip();
-        // establish connection
-        channel1.connect(localAddr1);
-        Socket acceptedSocket = server1.accept();
-
-        // use SocketChannel.write(ByteBuffer) to write CAPACITY_NORMAL bytes
-        // data
-        int writtenCount = channel1.write(writeContent);
-        // assert written count and ByteBuffer position
-        assertEquals(CAPACITY_NORMAL, writtenCount);
-        assertEquals(CAPACITY_NORMAL, writeContent.position());
-        // use close to guarantee all data is sent
-        channel1.close();
-
-        InputStream in = acceptedSocket.getInputStream();
-        int totalCount = 0;
-        int count = 0;
-        byte[] readContent = new byte[CAPACITY_NORMAL + 1];
-        // if the channel could not finish reading in TIMEOUT ms, the test
-        // fails. It is used to guarantee the test never hangs even if there
-        // are bugs of SocketChannel implementation.
-        acceptedSocket.setSoTimeout(TIMEOUT);
-
-        // use InputStream.read to read data.
-        while (totalCount <= CAPACITY_NORMAL) {
-            count = in.read(readContent, totalCount, readContent.length
-                    - totalCount);
-            if (EOF == count) {
-                break;
-            }
-            totalCount += count;
-        }
-
-        // assert read content
-        assertEquals(CAPACITY_NORMAL, totalCount);
-        writeContent.flip();
-        for (int i = 0; i < CAPACITY_NORMAL; i++) {
-            assertEquals(writeContent.get(), readContent[i]);
-        }
-    }
-
-    /**
-     * @tests java.nio.channels.SocketChannel#write(ByteBuffer)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "write",
-        args = {java.nio.ByteBuffer.class}
-    )
-    public void test_writeLjava_nio_ByteBuffer_NonBlocking() throws Exception {
-        // initialize write content
-        ByteBuffer writeContent = ByteBuffer.allocate(CAPACITY_NORMAL);
-        for (int i = 0; i < CAPACITY_NORMAL; i++) {
-            writeContent.put((byte) i);
-        }
-        writeContent.flip();
-
-        // establish connection
-        channel1.connect(localAddr1);
-        Socket acceptedSocket = server1.accept();
-
-        channel1.configureBlocking(false);
-        int writtenTotalCount = 0;
-        int writtenCount = 0;
-        long startTime = System.currentTimeMillis();
-        // use SocketChannel.write(ByteBuffer) to write CAPACITY_NORMAL bytes
-        while (writtenTotalCount < CAPACITY_NORMAL) {
-            writtenCount = channel1.write(writeContent);
-            writtenTotalCount += writtenCount;
-            // if the channel could not finish writing in TIMEOUT ms, the
-            // test fails. It is used to guarantee the test never hangs even
-            // if there are bugs of SocketChannel implementation.
-            assertTimeout(startTime, TIMEOUT);
-        }
-        // assert written count and ByteBuffer position
-        assertEquals(CAPACITY_NORMAL, writtenTotalCount);
-        assertEquals(CAPACITY_NORMAL, writeContent.position());
-        // use close to guarantee all data is sent
-        channel1.close();
-
-        InputStream in = acceptedSocket.getInputStream();
-        byte[] readContent = new byte[CAPACITY_NORMAL + 1];
-        int totalCount = 0;
-        int count = 0;
-        // if the channel could not finish reading in TIMEOUT ms, the test
-        // fails. It is used to guarantee the test never hangs even if there
-        // are bugs of SocketChannel implementation.
-        acceptedSocket.setSoTimeout(TIMEOUT);
-        // use InputStream.read to read data.
-        while (totalCount <= CAPACITY_NORMAL) {
-            count = in.read(readContent, totalCount, readContent.length
-                    - totalCount);
-            if (EOF == count) {
-                break;
-            }
-            totalCount += count;
-        }
-        // assert read content
-        assertEquals(CAPACITY_NORMAL, totalCount);
-        writeContent.flip();
-        for (int i = 0; i < CAPACITY_NORMAL; i++) {
-            assertEquals(writeContent.get(), readContent[i]);
-        }
-    }
-
-    /**
-     * @tests java.nio.channels.SocketChannel#read(ByteBuffer)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "write",
-        args = {java.nio.ByteBuffer.class}
-    )
-    @BrokenTest("Occasionally fail in CTS, but works in CoreTestRunner")
-    public void test_writeLjava_nio_ByteBuffer_Nonblocking_HugeData() throws IOException {
-        // initialize write content
-        ByteBuffer writeContent = ByteBuffer.allocate(CAPACITY_HUGE);
-        for (int i = 0; i < CAPACITY_HUGE; i++) {
-            writeContent.put((byte) i);
-        }
-        writeContent.flip();
-
-        // establish connection
-        channel1.connect(localAddr1);
-        Socket acceptedSocket = server1.accept();
-
-        channel1.configureBlocking(false);
-        int writtenTotalCount = 0;
-        int writtenCount = 1;
-        long startTime = System.currentTimeMillis();
-        // use SocketChannel.write(ByteBuffer) to try to write CAPACITY_HUGE bytes
-        while (writtenTotalCount < CAPACITY_HUGE && writtenCount > 0) {
-            writtenCount = channel1.write(writeContent);
-            if (writtenCount == 0 && writtenTotalCount < CAPACITY_HUGE) {
-                assertEquals(0, channel1.write(writeContent));
-                break;
-            }
-            writtenTotalCount += writtenCount;
-            // if the channel could not finish writing in TIMEOUT ms, the
-            // test fails. It is used to guarantee the test never hangs even
-            // if there are bugs of SocketChannel implementation.
-            assertTimeout(startTime, TIMEOUT);
-        }
-    }
-
-    /*
-     * Fails if the difference between current time and start time is greater
-     * than timeout.
-     */
-    private void assertTimeout(long startTime, long timeout) {
-        long currentTime = System.currentTimeMillis();
-        if ((currentTime - startTime) > timeout) {
-            fail("Timeout");
-        }
-    }
-
-    // -------------------------------------------------
-    // Test for read/write but no real data expressed
-    // -------------------------------------------------
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies ClosedChannelException",
-        method = "read",
-        args = {java.nio.ByteBuffer.class}
-    )
-    public void testReadByteBuffer() throws Exception {
-        assertTrue(this.server1.isBound());
-        java.nio.ByteBuffer readBuf = java.nio.ByteBuffer
-                .allocate(CAPACITY_NORMAL);
-        assertFalse(this.channel1.isRegistered());
-        assertTrue(this.channel1.isBlocking());
-        assertFalse(this.channel1.isConnected());
-        assertFalse(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
-        // note: blocking-mode will make the read process endless!
-        this.channel1.configureBlocking(false);
-        try {
-            channel1.read(readBuf);
-            fail("Should throw NotYetConnectedException");
-        } catch (NotYetConnectedException e) {
-            // correct
-        }
-        this.channel1.connect(localAddr1);
-        assertFalse(this.channel1.isBlocking());
-        assertTrue(this.channel1.isConnectionPending());
-        assertFalse(this.channel1.isConnected());
-        assertTrue(tryFinish());
-        assertEquals(0, this.channel1.read(readBuf));
-
-        this.channel1.close();
-        try {
-            channel1.read(readBuf);
-            fail("Should throw ClosedChannelException");
-        } catch (ClosedChannelException e) {
-            // correct
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies ClosedChannelException",
-        method = "read",
-        args = {java.nio.ByteBuffer.class}
-    )
-    public void testReadByteBuffer_Direct() throws Exception {
-        assertTrue(this.server1.isBound());
-        java.nio.ByteBuffer readBuf = java.nio.ByteBuffer
-                .allocateDirect(CAPACITY_NORMAL);
-        assertFalse(this.channel1.isRegistered());
-        assertTrue(this.channel1.isBlocking());
-        assertFalse(this.channel1.isConnected());
-        assertFalse(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
-        // note: blocking-mode will make the read process endless!
-        this.channel1.configureBlocking(false);
-        try {
-            channel1.read(readBuf);
-            fail("Should throw NotYetConnectedException");
-        } catch (NotYetConnectedException e) {
-            // correct
-        }
-        this.channel1.connect(localAddr1);
-        assertFalse(this.channel1.isBlocking());
-        assertTrue(this.channel1.isConnectionPending());
-        assertFalse(this.channel1.isConnected());
-        assertTrue(tryFinish());
-        assertEquals(0, this.channel1.read(readBuf));
-
-        this.channel1.close();
-        try {
-            channel1.read(readBuf);
-            fail("Should throw ClosedChannelException");
-        } catch (ClosedChannelException e) {
-            // correct
-        }
-    }
-
-    public void testReadByteBuffer_Direct2() throws IOException {
-        byte[] request = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
-        ByteBuffer buffer = ByteBuffer.allocateDirect(128);
-
-        ServerSocketChannel server = ServerSocketChannel.open();
-        server.socket().bind(
-                new InetSocketAddress(InetAddress.getLocalHost(), 0), 5);
-        Socket client = new Socket(InetAddress.getLocalHost(), server.socket()
-                .getLocalPort());
-        client.setTcpNoDelay(false);
-        Socket worker = server.socket().accept();
-        SocketChannel workerChannel = worker.getChannel();
-
-        OutputStream out = client.getOutputStream();
-        out.write(request);
-        out.close();
-
-        buffer.limit(5);
-        int bytesRead = workerChannel.read(buffer);
-        assertEquals(5, bytesRead);
-        assertEquals(5, buffer.position());
-
-        buffer.limit(request.length);
-        bytesRead = workerChannel.read(buffer);
-        assertEquals(6, bytesRead);
-
-        buffer.flip();
-        assertEquals(request.length, buffer.limit());
-
-        assertEquals(ByteBuffer.wrap(request), buffer);
-
-        client.close();
-        worker.close();
-        server.close();
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "read",
-        args = {java.nio.ByteBuffer.class}
-    )
-    public void testReadByteBuffer_BufNull() throws Exception {
-        assertTrue(this.server1.isBound());
-        java.nio.ByteBuffer readBuf = java.nio.ByteBuffer.allocate(0);
-        // note: blocking-mode will make the read process endless!
-        this.channel1.configureBlocking(false);
-        try {
-            channel1.read((java.nio.ByteBuffer) null);
-            fail("Should throw NPE");
-        } catch (NullPointerException e) {
-            // correct
-        }
-        this.channel1.connect(localAddr1);
-        assertTrue(tryFinish());
-        try {
-            this.channel1.read((java.nio.ByteBuffer) null);
-            fail("Should throw NPE");
-        } catch (NullPointerException e) {
-            // correct
-        }
-        assertEquals(0, this.channel1.read(readBuf));
-    }
-
-    /*
-     * SocketChannelImpl.read(ByteBuffer[], int, int)'
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "read",
-        args = {java.nio.ByteBuffer[].class, int.class, int.class}
-    )
-    public void testReadByteBufferArrayIntInt() throws Exception {
-        assertTrue(this.server1.isBound());
-        java.nio.ByteBuffer[] readBuf = new java.nio.ByteBuffer[2];
-        readBuf[0] = java.nio.ByteBuffer.allocate(CAPACITY_NORMAL);
-        readBuf[1] = java.nio.ByteBuffer.allocate(CAPACITY_NORMAL);
-        assertFalse(this.channel1.isRegistered());
-        assertTrue(this.channel1.isBlocking());
-        assertFalse(this.channel1.isConnected());
-        assertFalse(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
-        // note: blocking-mode will make the read process endless!
-        this.channel1.configureBlocking(false);
-        try {
-            channel1.read(readBuf, 0, 1);
-            fail("Should throw NotYetConnectedException");
-        } catch (NotYetConnectedException e) {
-            // correct
-        }
-        this.channel1.connect(localAddr1);
-        assertFalse(this.channel1.isBlocking());
-        assertTrue(this.channel1.isConnectionPending());
-        assertFalse(this.channel1.isConnected());
-        assertTrue(tryFinish());
-        assertEquals(0, this.channel1.read(readBuf, 0, 1));
-        assertEquals(0, this.channel1.read(readBuf, 0, 2));
-
-        this.channel1.close();
-        try {
-            channel1.read(readBuf, 0, 1);
-            fail("Should throw ClosedChannelException");
-        } catch (ClosedChannelException e) {
-            // correct
-        }
-    }
-
-    /*
-     * SocketChannelImpl.read(ByteBuffer[], int, int)'
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "read",
-        args = {java.nio.ByteBuffer[].class, int.class, int.class}
-    )
-    public void testReadByteBufferArrayIntInt_Direct() throws Exception {
-        assertTrue(this.server1.isBound());
-        java.nio.ByteBuffer[] readBuf = new java.nio.ByteBuffer[2];
-        readBuf[0] = java.nio.ByteBuffer.allocateDirect(CAPACITY_NORMAL);
-        readBuf[1] = java.nio.ByteBuffer.allocateDirect(CAPACITY_NORMAL);
-        assertFalse(this.channel1.isRegistered());
-        assertTrue(this.channel1.isBlocking());
-        assertFalse(this.channel1.isConnected());
-        assertFalse(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
-        // note: blocking-mode will make the read process endless!
-        this.channel1.configureBlocking(false);
-        try {
-            channel1.read(readBuf, 0, 1);
-            fail("Should throw NotYetConnectedException");
-        } catch (NotYetConnectedException e) {
-            // correct
-        }
-        this.channel1.connect(localAddr1);
-        assertFalse(this.channel1.isBlocking());
-        assertTrue(this.channel1.isConnectionPending());
-        assertFalse(this.channel1.isConnected());
-        assertTrue(tryFinish());
-        assertEquals(0, this.channel1.read(readBuf, 0, 1));
-        assertEquals(0, this.channel1.read(readBuf, 0, 2));
-
-        this.channel1.close();
-        try {
-            channel1.read(readBuf, 0, 1);
-            fail("Should throw ClosedChannelException");
-        } catch (ClosedChannelException e) {
-            // correct
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "read",
-        args = {java.nio.ByteBuffer[].class, int.class, int.class}
-    )
-    public void testReadByteBufferArrayIntInt_BufNull() throws Exception {
-        assertTrue(this.server1.isBound());
-        java.nio.ByteBuffer[] readBuf = new java.nio.ByteBuffer[2];
-        readBuf[0] = java.nio.ByteBuffer.allocate(CAPACITY_NORMAL);
-        assertFalse(this.channel1.isRegistered());
-        assertTrue(this.channel1.isBlocking());
-        assertFalse(this.channel1.isConnected());
-        assertFalse(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
-        // note: blocking-mode will make the read process endless!
-        this.channel1.configureBlocking(false);
-        try {
-            channel1.read(null, 0, 0);
-            fail("Should throw NPE");
-        } catch (NullPointerException e) {
-            // correct
-        }
-        this.channel1.connect(localAddr1);
-        assertTrue(tryFinish());
-
-        try {
-            channel1.read(null, 0, 0);
-            fail("Should throw NPE");
-        } catch (NullPointerException e) {
-            // correct
-        }
-        try {
-            channel1.read(readBuf, 0, 2);
-            fail("Should throw NPE");
-        } catch (NullPointerException e) {
-            // correct
-        }
-
-        assertEquals(0, this.channel1.read(readBuf, 0, 1));
-
-        this.channel1.close();
-        try {
-            channel1.read(null, 0, 1);
-            fail("Should throw NPE");
-        } catch (NullPointerException e) {
-            // correct
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "write",
-        args = {java.nio.ByteBuffer.class}
-    )
-    public void testWriteByteBuffer() throws IOException {
-        assertTrue(this.server1.isBound());
-        java.nio.ByteBuffer writeBuf = java.nio.ByteBuffer
-                .allocate(CAPACITY_NORMAL);
-        assertFalse(this.channel1.isRegistered());
-        assertTrue(this.channel1.isBlocking());
-        assertFalse(this.channel1.isConnected());
-        assertFalse(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
-        try {
-            channel1.write(writeBuf);
-            fail("Should throw NotYetConnectedException");
-        } catch (NotYetConnectedException e) {
-            // correct
-        }
-        this.channel1.connect(localAddr1);
-        assertTrue(this.channel1.isBlocking());
-        assertTrue(this.channel1.isConnected());
-        assertFalse(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
-        assertEquals(CAPACITY_NORMAL, this.channel1.write(writeBuf));
-
-        this.channel1.close();
-        try {
-            channel1.write(writeBuf);
-            fail("Should throw ClosedChannelException");
-        } catch (ClosedChannelException e) {
-            // correct
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Doesn't verify AsynchronousCloseException, ClosedByInterruptException.",
-        method = "write",
-        args = {java.nio.ByteBuffer.class}
-    )
-    public void testWriteByteBuffer_Direct() throws IOException {
-        assertTrue(this.server1.isBound());
-        java.nio.ByteBuffer writeBuf = java.nio.ByteBuffer
-                .allocateDirect(CAPACITY_NORMAL);
-        assertFalse(this.channel1.isRegistered());
-        assertTrue(this.channel1.isBlocking());
-        assertFalse(this.channel1.isConnected());
-        assertFalse(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
-        try {
-            channel1.write(writeBuf);
-            fail("Should throw NotYetConnectedException");
-        } catch (NotYetConnectedException e) {
-            // correct
-        }
-        this.channel1.connect(localAddr1);
-        assertTrue(this.channel1.isBlocking());
-        assertTrue(this.channel1.isConnected());
-        assertFalse(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
-        assertEquals(CAPACITY_NORMAL, this.channel1.write(writeBuf));
-
-        this.channel1.close();
-        try {
-            channel1.write(writeBuf);
-            fail("Should throw ClosedChannelException");
-        } catch (ClosedChannelException e) {
-            // correct
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "write",
-        args = {java.nio.ByteBuffer.class}
-    )
-    public void testWriteByteBuffer_BufNull() throws IOException {
-        assertTrue(this.server1.isBound());
-        java.nio.ByteBuffer writeBuf = java.nio.ByteBuffer.allocate(0);
-        this.channel1.connect(localAddr1);
-        assertEquals(this.channel1.write(writeBuf), 0);
-        try {
-            this.channel1.write((java.nio.ByteBuffer) null);
-            fail("Should throw NPE");
-        } catch (NullPointerException e) {
-            // correct
-        }
-    }
-
-    /*
-     * SocketChannelImpl.write(ByteBuffer[], int, int)'
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Doesn't verify AsynchronousCloseException," +
-                "ClosedByInterruptException.",
-        method = "write",
-        args = {java.nio.ByteBuffer[].class, int.class, int.class}
-    )
-    public void testWriteByteBufferArrayIntInt() throws IOException {
-        java.nio.ByteBuffer[] writeBuf = new java.nio.ByteBuffer[2];
-        writeBuf[0] = java.nio.ByteBuffer.allocate(CAPACITY_NORMAL);
-        writeBuf[1] = java.nio.ByteBuffer.allocate(CAPACITY_NORMAL);
-        assertFalse(this.channel1.isRegistered());
-        assertTrue(this.channel1.isBlocking());
-        assertFalse(this.channel1.isConnected());
-        assertFalse(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
-        try {
-            channel1.write(writeBuf, 0, 1);
-            fail("Should throw NotYetConnectedException");
-        } catch (NotYetConnectedException e) {
-            // correct
-        }
-        this.channel1.connect(localAddr1);
-        assertTrue(this.channel1.isBlocking());
-        assertTrue(this.channel1.isConnected());
-        assertFalse(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
-        assertEquals(CAPACITY_NORMAL, this.channel1.write(writeBuf, 0, 1));
-        // still writes the same size as above
-        assertEquals(CAPACITY_NORMAL, this.channel1.write(writeBuf, 0, 2));
-        writeBuf[0].flip();
-        writeBuf[1].flip();
-        assertEquals(CAPACITY_NORMAL * 2, this.channel1.write(writeBuf, 0, 2));
-        this.channel1.close();
-        try {
-            channel1.write(writeBuf, 0, 1);
-            fail("Should throw ClosedChannelException");
-        } catch (ClosedChannelException e) {
-            // correct
-        }
-    }
-
-    /*
-     * SocketChannelImpl.write(ByteBuffer[], int, int)'
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "write",
-        args = {java.nio.ByteBuffer[].class, int.class, int.class}
-    )
-    public void testWriteByteBufferArrayIntInt_Direct() throws IOException {
-        java.nio.ByteBuffer[] writeBuf = new java.nio.ByteBuffer[2];
-        writeBuf[0] = java.nio.ByteBuffer.allocateDirect(CAPACITY_NORMAL);
-        writeBuf[1] = java.nio.ByteBuffer.allocateDirect(CAPACITY_NORMAL);
-        assertFalse(this.channel1.isRegistered());
-        assertTrue(this.channel1.isBlocking());
-        assertFalse(this.channel1.isConnected());
-        assertFalse(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
-        try {
-            channel1.write(writeBuf, 0, 1);
-            fail("Should throw NotYetConnectedException");
-        } catch (NotYetConnectedException e) {
-            // correct
-        }
-        this.channel1.connect(localAddr1);
-        assertTrue(this.channel1.isBlocking());
-        assertTrue(this.channel1.isConnected());
-        assertFalse(this.channel1.isConnectionPending());
-        assertTrue(this.channel1.isOpen());
-        assertEquals(CAPACITY_NORMAL, this.channel1.write(writeBuf, 0, 1));
-        // still writes the same size as above
-        assertEquals(CAPACITY_NORMAL, this.channel1.write(writeBuf, 0, 2));
-        writeBuf[0].flip();
-        writeBuf[1].flip();
-        assertEquals(CAPACITY_NORMAL * 2, this.channel1.write(writeBuf, 0, 2));
-        this.channel1.close();
-        try {
-            channel1.write(writeBuf, 0 ,1);
-            fail("Should throw ClosedChannelException");
-        } catch (ClosedChannelException e) {
-            // correct
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "write",
-        args = {java.nio.ByteBuffer[].class, int.class, int.class}
-    )
-    public void testWriteByteBufferArrayIntInt_BufNull() throws IOException {
-        java.nio.ByteBuffer[] writeBuf = new java.nio.ByteBuffer[0];
-
-        this.channel1.connect(localAddr1);
-        try {
-            this.channel1.write(null, 0, 1);
-            fail("Should throw NPE");
-        } catch (NullPointerException e) {
-            // correct
-        }
-        assertEquals(0, this.channel1.write(writeBuf, 0, 0));
-        try {
-            this.channel1.write(writeBuf, 0, 1);
-            fail("Should throw IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // correct
-        }
-        writeBuf = new java.nio.ByteBuffer[1];
-        try {
-            this.channel1.write(writeBuf, 0, 1);
-            fail("Should throw NPE");
-        } catch (NullPointerException e) {
-            // correct
-        }
-        writeBuf[0] = java.nio.ByteBuffer.allocate(CAPACITY_NORMAL);
-        try {
-            this.channel1.write(writeBuf, 0, 2);
-            fail("Should throw IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // correct
-        }
-        this.server1.close();
-        try {
-            channel1.read(null, 0, 1);
-            fail("Should throw NPE");
-        } catch (NullPointerException e) {
-            // correct
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies IndexOutOfBoundsException.",
-        method = "write",
-        args = {java.nio.ByteBuffer[].class, int.class, int.class}
-    )
-    public void testWriteByteBufferArrayIntInt_SizeError() throws IOException {
-        java.nio.ByteBuffer[] writeBuf =
-                {java.nio.ByteBuffer.allocate(CAPACITY_NORMAL)};
-
-        this.channel1.connect(localAddr1);
-        try {
-            this.channel1.write(writeBuf, -1, 1);
-            fail("Should throw IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // correct
-        }
-        assertEquals(0, this.channel1.write(writeBuf, 0, 0));
-        try {
-            this.channel1.write(writeBuf, 0, -1);
-            fail("Should throw IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // correct
-        }
-        try {
-            this.channel1.write(writeBuf, 1, 1);
-            fail("Should throw IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // correct
-        }
-        try {
-            this.channel1.write(writeBuf, 0, 2);
-            fail("Should throw IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // correct
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "read",
-        args = {java.nio.ByteBuffer[].class, int.class, int.class}
-    )
-    public void testReadByteBufferArrayIntInt_SizeError() throws IOException {
-        java.nio.ByteBuffer[] readBuf = new java.nio.ByteBuffer[0];
-
-        this.channel1.connect(localAddr1);
-        try {
-            this.channel1.read(null, -1, 1);
-            fail("Should throw IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // correct
-        }
-        assertEquals(0, this.channel1.read(readBuf, 0, 0));
-        try {
-            this.channel1.read(readBuf, 0, -1);
-            fail("Should throw IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // correct
-        }
-        readBuf = new java.nio.ByteBuffer[1];
-        try {
-            this.channel1.read(readBuf, 2, 1);
-            fail("Should throw IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // correct
-        }
-        try {
-            this.channel1.read(readBuf, 2, -1);
-            fail("Should throw IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // correct
-        }
-        this.server1.close();
-        try {
-            assertEquals(CAPACITY_NORMAL, this.channel1.read(null, -1, -1));
-            fail("Should throw IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // correct
-        }
-    }
-
-    /*
-     * ==========================================================================
-     * Tests for read/write real data
-     * ==========================================================================
-     */
-
-
-    /**
-     * @tests java.nio.channels.SocketChannel#read(ByteBuffer[])
-     */
-    public void test_read$LByteBuffer() throws IOException {
-        MockSocketChannel sc = new MockSocketChannel(null);
-        ByteBuffer [] byteBufferArray = { ByteBuffer.allocate(1), ByteBuffer.allocate(1)};
-        // Verify that calling read(ByteBuffer[]) leads to the method
-        // read(ByteBuffer[], int, int) being called with a 0 for the
-        // second parameter and targets.length as the third parameter.
-        sc.read(byteBufferArray);
-        assertTrue(sc.isReadCalled);
-    }
-
-    /**
-     * @tests java.nio.channels.SocketChannel#read(ByteBuffer[],int,int)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "read",
-        args = {java.nio.ByteBuffer[].class}
-    )
-    public void test_read$LByteBuffer_blocking() throws Exception {
-        assert_read$LByteBuffer(true);
-    }
-
-    /**
-     * @tests java.nio.channels.SocketChannel#read(ByteBuffer[],int,int)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "read",
-        args = {java.nio.ByteBuffer[].class}
-    )
-    public void test_read$LByteBuffer_nonblocking() throws Exception {
-        assert_read$LByteBuffer(false);
-    }
-
-    private void assert_read$LByteBuffer(boolean isBlocking) throws IOException {
-        // initialize write content
-        byte[] writeContent = new byte[CAPACITY_NORMAL * 2];
-        for (int i = 0; i < CAPACITY_NORMAL * 2; i++) {
-            writeContent[i] = (byte) i;
-        }
-        ByteBuffer[] readContents = new ByteBuffer[2];
-        readContents[0] = ByteBuffer.allocate(CAPACITY_NORMAL);
-        readContents[1] = ByteBuffer.allocate(CAPACITY_NORMAL + 1);
-        // establish connection
-        channel1.connect(localAddr1);
-        Socket acceptedSocket = server1.accept();
-        // use OutputStream.write to send CAPACITY_NORMAL * 2 bytes data
-        OutputStream out = acceptedSocket.getOutputStream();
-        out.write(writeContent);
-        // use close to guarantee all data is sent
-        acceptedSocket.close();
-        // configure block/nonblock mode
-        channel1.configureBlocking(isBlocking);
-        long startTime = System.currentTimeMillis();
-        long totalRead = 0;
-        long countRead = 0;
-
-        while (totalRead <= CAPACITY_NORMAL * 2) {
-            countRead = channel1.read(readContents);
-            if (0 == countRead && !readContents[1].hasRemaining()) {
-                // read returns 0 because readContents is full
-                break;
-            }
-            if (EOF == countRead) {
-                break;
-            }
-            totalRead += countRead;
-            // if the channel could not finish reading in TIMEOUT ms, the
-            // test fails. It is used to guarantee the test never hangs even
-            // if there are bugs of SocketChannel implementation. For
-            // blocking read, it possibly returns 0 in some cases.
-            assertTimeout(startTime, TIMEOUT);
-        }
-
-        // assert total bytes read and the position of ByteBuffers
-        assertEquals(CAPACITY_NORMAL * 2, totalRead);
-        assertEquals(CAPACITY_NORMAL, readContents[0].position());
-        assertEquals(CAPACITY_NORMAL, readContents[1].position());
-        // assert read content
-        readContents[0].flip();
-        readContents[1].flip();
-        for (int i = 0; i < CAPACITY_NORMAL; i++) {
-            assertEquals(writeContent[i], readContents[0].get());
-        }
-        for (int i = CAPACITY_NORMAL; i < CAPACITY_NORMAL * 2; i++) {
-            assertEquals(writeContent[i], readContents[1].get());
-        }
-    }
-
-    /**
-     * @tests java.nio.channels.SocketChannel#read(ByteBuffer[],int,int)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "read",
-        args = {java.nio.ByteBuffer[].class, int.class, int.class}
-    )
-    public void test_read$LByteBufferII_blocking() throws Exception {
-        assert_read$LByteBufferII(true);
-    }
-
-    /**
-     * @tests java.nio.channels.SocketChannel#read(ByteBuffer[],int,int)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "read",
-        args = {java.nio.ByteBuffer[].class, int.class, int.class}
-    )
-    public void test_read$LByteBufferII_nonblocking() throws Exception {
-        assert_read$LByteBufferII(false);
-    }
-
-    private void assert_read$LByteBufferII(boolean isBlocking) throws IOException {
-        // initialize write content
-        byte[] writeContent = new byte[CAPACITY_NORMAL * 2];
-        for (int i = 0; i < CAPACITY_NORMAL * 2; i++) {
-            writeContent[i] = (byte) i;
-        }
-        ByteBuffer[] readContents = new ByteBuffer[2];
-        readContents[0] = ByteBuffer.allocate(CAPACITY_NORMAL);
-        readContents[1] = ByteBuffer.allocate(CAPACITY_NORMAL + 1);
-        // establish connection
-        channel1.connect(localAddr1);
-        Socket acceptedSocket = server1.accept();
-        // use OutputStream.write to send CAPACITY_NORMAL * 2 bytes data
-        OutputStream out = acceptedSocket.getOutputStream();
-        out.write(writeContent);
-        // use close to guarantee all data is sent
-        acceptedSocket.close();
-        // configure block/nonblock mode
-        channel1.configureBlocking(isBlocking);
-        long startTime = System.currentTimeMillis();
-        long totalRead = 0;
-        long countRead = 0;
-
-        while (totalRead <= CAPACITY_NORMAL * 2) {
-            countRead = channel1.read(readContents, 0, 2);
-            if (0 == countRead && !readContents[1].hasRemaining()) {
-                // read returns 0 because readContents is full
-                break;
-            }
-            if (EOF == countRead) {
-                break;
-            }
-            totalRead += countRead;
-            // if the channel could not finish reading in TIMEOUT ms, the
-            // test fails. It is used to guarantee the test never hangs even
-            // if there are bugs of SocketChannel implementation. For
-            // blocking read, it possibly returns 0 in some cases.
-            assertTimeout(startTime, TIMEOUT);
-        }
-
-        // assert total bytes read and the position of ByteBuffers
-        assertEquals(CAPACITY_NORMAL * 2, totalRead);
-        assertEquals(CAPACITY_NORMAL, readContents[0].position());
-        assertEquals(CAPACITY_NORMAL, readContents[1].position());
-        // assert read content
-        readContents[0].flip();
-        readContents[1].flip();
-        for (int i = 0; i < CAPACITY_NORMAL; i++) {
-            assertEquals(writeContent[i], readContents[0].get());
-        }
-        for (int i = CAPACITY_NORMAL; i < CAPACITY_NORMAL * 2; i++) {
-            assertEquals(writeContent[i], readContents[1].get());
-        }
-    }
-
-    /**
-     * @tests java.nio.channels.SocketChannel#write(ByteBuffer[],int,int)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "write",
-        args = {java.nio.ByteBuffer[].class}
-    )
-    public void test_write$LByteBuffer_blocking() throws Exception {
-        assert_write$LByteBuffer(true);
-    }
-
-    /**
-     * @tests java.nio.channels.SocketChannel#write(ByteBuffer[],int,int)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "write",
-        args = {java.nio.ByteBuffer[].class}
-    )
-    public void test_write$LByteBuffer_nonblocking() throws Exception {
-        assert_write$LByteBuffer(false);
-    }
-
-    private void assert_write$LByteBuffer(boolean isBlocking)
-            throws IOException {
-        // initialize write contents
-        ByteBuffer writeContents[] = new ByteBuffer[2];
-        writeContents[0] = ByteBuffer.allocate(CAPACITY_NORMAL);
-        writeContents[1] = ByteBuffer.allocate(CAPACITY_NORMAL);
-        for (int i = 0; i < CAPACITY_NORMAL; i++) {
-            writeContents[0].put((byte) i);
-        }
-        for (int i = CAPACITY_NORMAL; i < CAPACITY_NORMAL * 2; i++) {
-            writeContents[1].put((byte) i);
-        }
-        writeContents[0].flip();
-        writeContents[1].flip();
-        // establish connection
-        channel1.connect(localAddr1);
-        Socket acceptedSocket = server1.accept();
-        // set blocking/nonblocking mode
-        channel1.configureBlocking(isBlocking);
-
-        assertEquals(2 * CAPACITY_NORMAL, channel1.write(writeContents));
-
-        // assert written count and ByteBuffer position
-        assertEquals(CAPACITY_NORMAL, writeContents[0].position());
-        assertEquals(CAPACITY_NORMAL, writeContents[1].position());
-        // use close to guarantee all data is sent
-        channel1.close();
-        InputStream in = acceptedSocket.getInputStream();
-        byte[] readContent = new byte[CAPACITY_NORMAL * 2 + 1];
-        int totalCount = 0;
-        int count = 0;
-        // if the channel could not finish reading in TIMEOUT ms, the test
-        // fails. It is used to guarantee the test never hangs even if there
-        // are bugs of SocketChannel implementation.
-        acceptedSocket.setSoTimeout(TIMEOUT);
-        // use InputStream.read to read data.
-        while (totalCount <= CAPACITY_NORMAL) {
-            count = in.read(readContent, totalCount, readContent.length
-                    - totalCount);
-            if (EOF == count) {
-                break;
-            }
-            totalCount += count;
-        }
-        // assert read content
-        assertEquals(CAPACITY_NORMAL * 2, totalCount);
-        writeContents[0].flip();
-        writeContents[1].flip();
-        for (int i = 0; i < CAPACITY_NORMAL; i++) {
-            assertEquals(writeContents[0].get(), readContent[i]);
-        }
-        for (int i = CAPACITY_NORMAL; i < CAPACITY_NORMAL * 2; i++) {
-            assertEquals(writeContents[1].get(), readContent[i]);
-        }
-    }
-
-    /**
-     * @tests java.nio.channels.SocketChannel#write(ByteBuffer[])
-     */
-    public void test_write$LByteBuffer() throws IOException {
-        MockSocketChannel sc = new MockSocketChannel(null);
-        ByteBuffer [] byteBufferArray = { ByteBuffer.allocate(1), ByteBuffer.allocate(1)};
-        // Verify that calling write(ByteBuffer[]) leads to the method
-        // write(ByteBuffer[], int, int) being called with a 0 for the
-        // second parameter and sources.length as the third parameter.
-        sc.write(byteBufferArray);
-        assertTrue(sc.isWriteCalled);
-    }
-
-    /**
-     * @tests java.nio.channels.SocketChannel#write(ByteBuffer[],int,int)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "write",
-        args = {java.nio.ByteBuffer[].class, int.class, int.class}
-    )
-    public void test_write$LByteBufferII_blocking() throws Exception {
-        assert_write$LByteBufferII(true);
-    }
-
-    /**
-     * @tests java.nio.channels.SocketChannel#write(ByteBuffer[],int,int)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "write",
-        args = {java.nio.ByteBuffer[].class, int.class, int.class}
-    )
-    public void test_write$LByteBufferII_nonblocking() throws Exception {
-        assert_write$LByteBufferII(false);
-    }
-
-    private void assert_write$LByteBufferII(boolean isBlocking)
-            throws IOException {
-        // initialize write contents
-        ByteBuffer writeContents[] = new ByteBuffer[2];
-        writeContents[0] = ByteBuffer.allocate(CAPACITY_NORMAL);
-        writeContents[1] = ByteBuffer.allocate(CAPACITY_NORMAL);
-        for (int i = 0; i < CAPACITY_NORMAL; i++) {
-            writeContents[0].put((byte) i);
-        }
-        for (int i = CAPACITY_NORMAL; i < CAPACITY_NORMAL * 2; i++) {
-            writeContents[1].put((byte) i);
-        }
-        writeContents[0].flip();
-        writeContents[1].flip();
-        // establish connection
-        channel1.connect(localAddr1);
-        Socket acceptedSocket = server1.accept();
-        // set blocking/nonblocking mode
-        channel1.configureBlocking(isBlocking);
-
-        assertEquals(CAPACITY_NORMAL, channel1.write(writeContents, 0, 1));
-        assertEquals(CAPACITY_NORMAL, channel1.write(writeContents, 1, 1));
-
-        // assert written count and ByteBuffer position
-        assertEquals(CAPACITY_NORMAL, writeContents[0].position());
-        assertEquals(CAPACITY_NORMAL, writeContents[1].position());
-        // use close to guarantee all data is sent
-        channel1.close();
-        InputStream in = acceptedSocket.getInputStream();
-        byte[] readContent = new byte[CAPACITY_NORMAL * 2 + 1];
-        int totalCount = 0;
-        int count = 0;
-        // if the channel could not finish reading in TIMEOUT ms, the test
-        // fails. It is used to guarantee the test never hangs even if there
-        // are bugs of SocketChannel implementation.
-        acceptedSocket.setSoTimeout(TIMEOUT);
-        // use InputStream.read to read data.
-        while (totalCount <= CAPACITY_NORMAL) {
-            count = in.read(readContent, totalCount, readContent.length
-                    - totalCount);
-            if (EOF == count) {
-                break;
-            }
-            totalCount += count;
-        }
-        // assert read content
-        assertEquals(CAPACITY_NORMAL * 2, totalCount);
-        writeContents[0].flip();
-        writeContents[1].flip();
-        for (int i = 0; i < CAPACITY_NORMAL; i++) {
-            assertEquals(writeContents[0].get(), readContent[i]);
-        }
-        for (int i = CAPACITY_NORMAL; i < CAPACITY_NORMAL * 2; i++) {
-            assertEquals(writeContents[1].get(), readContent[i]);
-        }
-    }
-
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "socket",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            clazz = SelectableChannel.class,
-            method = "configureBlocking",
-            args = {boolean.class}
-        )
-    })
-    public void testSocket_configureblocking() throws IOException {
-        byte[] serverWBuf = new byte[CAPACITY_NORMAL];
-        for (int i = 0; i < serverWBuf.length; i++) {
-            serverWBuf[i] = (byte) i;
-        }
-        java.nio.ByteBuffer buf = java.nio.ByteBuffer
-                .allocate(CAPACITY_NORMAL + 1);
-        channel1.connect(localAddr1);
-        server1.accept();
-        Socket sock = this.channel1.socket();
-        channel1.configureBlocking(false);
-        assertFalse(channel1.isBlocking());
-        OutputStream channelSocketOut = sock.getOutputStream();
-        try {
-            // write operation is not allowed in non-blocking mode
-            channelSocketOut.write(buf.array());
-            fail("Non-Blocking mode should cause IllegalBlockingModeException");
-        } catch (IllegalBlockingModeException e) {
-            // correct
-        }
-        channel1.configureBlocking(true);
-        assertTrue(channel1.isBlocking());
-        // write operation is allowed in blocking mode
-        channelSocketOut.write(buf.array());
-    }
-
-    /**
-     * @tests SocketChannel#read(ByteBuffer[], int, int) when remote server
-     *        closed
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "read",
-        args = {java.nio.ByteBuffer[].class, int.class, int.class}
-    )
-    public void test_socketChannel_read_ByteBufferII_remoteClosed()
-            throws Exception {
-        // regression 1 for HARMONY-549
-        ServerSocketChannel ssc = ServerSocketChannel.open();
-        ssc.socket().bind(localAddr2);
-        SocketChannel sc = SocketChannel.open();
-        sc.connect(localAddr2);
-        ssc.accept().close();
-        ByteBuffer[] buf = {ByteBuffer.allocate(10)};
-        assertEquals(-1, sc.read(buf, 0, 1));
-        ssc.close();
-        sc.close();
-    }
-
-    /**
-     * @tests SocketChannel#write(ByteBuffer[], int, int)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "write",
-        args = {java.nio.ByteBuffer[].class, int.class, int.class}
-    )
-    public void test_socketChannel_write_ByteBufferII() throws Exception {
-        // regression 2 for HARMONY-549
-        ServerSocketChannel ssc = ServerSocketChannel.open();
-        ssc.socket().bind(localAddr2);
-        SocketChannel sc = SocketChannel.open();
-        sc.connect(localAddr2);
-        SocketChannel sock = ssc.accept();
-        ByteBuffer[] buf = {ByteBuffer.allocate(10), null};
-        try {
-            sc.write(buf, 0, 2);
-            fail("should throw NPE");
-        } catch (NullPointerException e) {
-            // expected
-        }
-        ssc.close();
-        sc.close();
-        ByteBuffer target = ByteBuffer.allocate(10);
-        assertEquals(-1, sock.read(target));
-    }
-
-    /**
-     * @tests SocketChannel#read(ByteBuffer[], int, int) with a null ByteBuffer
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "read",
-        args = {java.nio.ByteBuffer[].class, int.class, int.class}
-    )
-    public void test_socketChannel_read_ByteBufferII_bufNULL() throws Exception {
-        // regression 3 for HARMONY-549
-        ServerSocketChannel ssc = ServerSocketChannel.open();
-        ssc.socket().bind(localAddr2);
-        SocketChannel sc = SocketChannel.open();
-        sc.connect(localAddr2);
-        ssc.accept();
-        ByteBuffer[] buf = new ByteBuffer[2];
-        buf[0] = ByteBuffer.allocate(1);
-        // let buf[1] be null
-        try {
-            sc.read(buf, 0, 2);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        }
-        ssc.close();
-        sc.close();
-    }
-
-    /**
-     * @tests SocketChannel#write(ByteBuffer) after close
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "write",
-        args = {java.nio.ByteBuffer.class}
-    )
-    public void test_socketChannel_write_close() throws Exception {
-        // regression 4 for HARMONY-549
-        ServerSocketChannel ssc = ServerSocketChannel.open();
-        ssc.socket().bind(localAddr2);
-        SocketChannel sc = SocketChannel.open();
-        sc.connect(localAddr2);
-        SocketChannel sock = ssc.accept();
-        ByteBuffer buf = null;
-        ssc.close();
-        sc.close();
-        try {
-            sc.write(buf);
-            fail("should throw NPE");
-        } catch (NullPointerException e) {
-            // expected
-        }
-        sock.close();
-    }
-
-    /**
-     * @tests SocketChannel#write(ByteBuffer) if position is not zero
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "write",
-        args = {java.nio.ByteBuffer.class}
-    )
-    public void test_socketChannel_write_ByteBuffer_posNotZero()
-            throws Exception {
-        // regression 5 for HARMONY-549
-        final String testStr = "Hello World";
-        ByteBuffer readBuf = ByteBuffer.allocate(11);
-        ByteBuffer buf = ByteBuffer.wrap(testStr.getBytes());
-        ServerSocketChannel ssc = ServerSocketChannel.open();
-        ssc.socket().bind(localAddr2);
-        SocketChannel sc = SocketChannel.open();
-        sc.connect(localAddr2);
-        buf.position(2);
-        ssc.accept().write(buf);
-        assertEquals(9, sc.read(readBuf));
-        buf.flip();
-        readBuf.flip();
-        byte[] read = new byte[9];
-        byte[] write = new byte[11];
-        buf.get(write);
-        readBuf.get(read);
-        for (int i = 0; i < 9; i++) {
-            assertEquals(read[i], write[i + 2]);
-        }
-    }
-
-    /**
-     * @tests SocketChannelImpl#read(ByteBuffer[])
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Doesn't verify exceptions.",
-        method = "read",
-        args = {java.nio.ByteBuffer[].class}
-    )
-    public void test_read$LByteBuffer_Blocking() throws IOException {
-        // regression test for Harmony-728
-        byte[] data = new byte[CAPACITY_NORMAL];
-        for (int i = 0; i < CAPACITY_NORMAL; i++) {
-            data[i] = (byte) i;
-        }
-        ByteBuffer[] buf = new ByteBuffer[2];
-        buf[0] = ByteBuffer.allocate(CAPACITY_NORMAL);
-        buf[1] = ByteBuffer.allocate(CAPACITY_NORMAL);
-        channel1.connect(localAddr1);
-        Socket socket = null;
-        try {
-            socket = server1.accept();
-            OutputStream out = socket.getOutputStream();
-            out.write(data);
-            // should not block here
-            channel1.read(buf);
-        } finally {
-            if (null != socket) {
-                socket.close();
-            } else {
-                fail();
-            }
-        }
-    }
-
-    /**
-     * @tests SocketChannelImpl#socket().getOutputStream().read
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies IllegalBlockingModeException, NullPointerException.",
-        method = "socket",
-        args = {}
-    )
-    public void test_socket_getOutputStream_nonBlocking_read_Exception()
-            throws IOException {
-        channel1.connect(this.localAddr1);
-        InputStream is = channel1.socket().getInputStream();
-        channel1.configureBlocking(false);
-        try {
-            is.read();
-            fail("should throw IllegalBlockingModeException");
-        } catch (IllegalBlockingModeException e) {
-            // expected
-        }
-        try {
-            is.read(null, 1, 1);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        }
-        try {
-            is.read(null, -1, 1);
-            fail("should throw IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-        // closed
-        is.close();
-        try {
-            is.read(null);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        }
-        try {
-            is.read();
-            fail("should throw IllegalBlockingModeException");
-        } catch (IllegalBlockingModeException e) {
-            // expected
-        }
-        try {
-            is.read(null, 1, 1);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        }
-        try {
-            is.read(null, -1, 1);
-            fail("should throw IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests SocketChannelImpl#socket().getOutputStream().read
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies NullPointerException, ClosedChannelException, IndexOutOfBoundsException.",
-        method = "socket",
-        args = {}
-    )
-    public void test_socket_getOutputStream_blocking_read_Exception()
-            throws IOException {
-        channel1.connect(this.localAddr1);
-        InputStream is = channel1.socket().getInputStream();
-        try {
-            is.read(null);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        }
-        try {
-            is.read(null, 1, 1);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        }
-        try {
-            is.read(null, -1, 1);
-            fail("should throw IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-        // closed
-        is.close();
-        try {
-            is.read(null);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        }
-        try {
-            is.read();
-            fail("should throw ClosedChannelException");
-        } catch (ClosedChannelException e) {
-            // expected
-        }
-        try {
-            is.read(null, 1, 1);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        }
-        try {
-            is.read(null, -1, 1);
-            fail("should throw IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests SocketChannelImpl#socket().getOutputStream().write
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies NullPointerException, IllegalBlockingModeException.",
-        method = "socket",
-        args = {}
-    )
-    public void test_socket_getOutputStream_nonBlocking_write_Exception()
-            throws IOException {
-        channel1.connect(this.localAddr1);
-        OutputStream os = channel1.socket().getOutputStream();
-        channel1.configureBlocking(false);
-        try {
-            os.write(null);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        }
-        try {
-            os.write(1);
-            fail("should throw IllegalBlockingModeException");
-        } catch (IllegalBlockingModeException e) {
-            // expected
-        }
-        try {
-            os.write(1);
-            fail("should throw IllegalBlockingModeException");
-        } catch (IllegalBlockingModeException e) {
-            // expected
-        }
-        try {
-            os.write(null, 1, 1);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        }
-        try {
-            os.write(null, -1, 1);
-            fail("should throw IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-        // closed
-        os.close();
-        try {
-            os.write(null);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        }
-        try {
-            os.write(1);
-            fail("should throw IllegalBlockingModeException");
-        } catch (IllegalBlockingModeException e) {
-            // expected
-        }
-        try {
-            os.write(null, 1, 1);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        }
-        try {
-            os.write(null, -1, 1);
-            fail("should throw IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests SocketChannelImpl#socket().getOutputStream().write
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies NullPointerException, IndexOutOfBoundsException, ClosedChannelException.",
-        method = "socket",
-        args = {}
-    )
-    public void test_socket_getOutputStream_blocking_write_Exception()
-            throws IOException {
-        channel1.connect(this.localAddr1);
-        OutputStream os = channel1.socket().getOutputStream();
-        try {
-            os.write(null);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        }
-        try {
-            os.write(null, 1, 1);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        }
-        try {
-            os.write(null, -1, 1);
-            fail("should throw IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-        // closed
-        os.close();
-        try {
-            os.write(null);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        }
-        try {
-            os.write(1);
-            fail("should throw ClosedChannelException");
-        } catch (ClosedChannelException e) {
-            // expected
-        }
-        try {
-            os.write(null, 1, 1);
-            fail("should throw NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        }
-        try {
-            os.write(null, -1, 1);
-            fail("should throw IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-    }
-
-    /**
-     * @tests SocketChannelImpl#socket().getOutputStream().write(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "socket",
-        args = {}
-    )
-    public void test_socket_getOutputStream_write_oneByte()
-            throws IOException {
-
-        // Regression test for Harmony-3475
-
-        int MAGIC = 123;
-
-        channel1.connect(this.localAddr1);
-
-        OutputStream os = channel1.socket().getOutputStream();
-
-        Socket acceptedSocket = server1.accept();
-
-        InputStream in = acceptedSocket.getInputStream();
-
-        os.write(MAGIC);
-        channel1.close();
-
-        int lastByte = in.read();
-        if (lastByte == -1) {
-            fail("Server received nothing. Expected 1 byte.");
-        } else if (lastByte != MAGIC) {
-            fail("Server received wrong single byte: " + lastByte
-                    + ", expected: " + MAGIC);
-        }
-
-        lastByte = in.read();
-        if (lastByte != -1) {
-            fail("Server received too long sequence. Expected 1 byte.");
-        }
-    }
-
-    public void testSocket_setOptions() throws IOException {
-        channel1.connect(localAddr1);
-        Socket socket = channel1.socket();
-
-        ByteBuffer buffer = ByteBuffer.wrap(new byte[] {1, 2, 3});
-        socket.setKeepAlive(true);
-        channel1.write(buffer);
-
-        socket.setOOBInline(true);
-        channel1.write(buffer);
-
-        socket.setReceiveBufferSize(100);
-        channel1.write(buffer);
-
-        socket.setReuseAddress(true);
-        channel1.write(buffer);
-
-        socket.setSendBufferSize(100);
-        channel1.write(buffer);
-
-        socket.setSoLinger(true, 100);
-        channel1.write(buffer);
-
-        socket.setSoTimeout(1000);
-        channel1.write(buffer);
-
-        socket.setTcpNoDelay(true);
-        channel1.write(buffer);
-
-        socket.setTrafficClass(10);
-        channel1.write(buffer);
-    }
-
-    /**
-     * @throws IOException
-     * @tests java.nio.channels.SocketChannel#read(ByteBuffer)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "read",
-        args = {java.nio.ByteBuffer[].class}
-    )
-    public void test_socketChannel_read_DirectByteBuffer() throws InterruptedException, IOException {
-
-        ServerThread server = new ServerThread();
-        server.start();
-        Thread.currentThread().sleep(1000);
-
-        InetSocketAddress address = new InetSocketAddress(InetAddress
-                .getByName("localhost"), port);
-
-        // First test with array based byte buffer
-        SocketChannel sc = SocketChannel.open();
-        sc.connect(address);
-
-        ByteBuffer buf = ByteBuffer.allocate(data.length);
-        buf.limit(data.length / 2);
-        sc.read(buf);
-
-        buf.limit(buf.capacity());
-        sc.read(buf);
-        sc.close();
-
-        // Make sure the buffer is filled correctly
-        buf.rewind();
-        assertSameContent(data, buf);
-
-        // Now test with direct byte buffer
-        sc = SocketChannel.open();
-        sc.connect(address);
-
-        buf = ByteBuffer.allocateDirect(data.length);
-        buf.limit(data.length / 2);
-        sc.read(buf);
-
-        buf.limit(buf.capacity());
-        sc.read(buf);
-        sc.close();
-
-        // Make sure the buffer is filled correctly
-        buf.rewind();
-        assertSameContent(data, buf);
-    }
-
-    private void assertSameContent(byte[] data, ByteBuffer buf) {
-        for (byte b : data) {
-            if (b != buf.get()) {
-                int pos = buf.position() - 1;
-                fail("Content not equal. Buffer position: " +
-                        (pos) + " expected: " + b + " was: " + buf.get(pos));
-            }
-        }
-    }
-
-    public static boolean done = false;
-    public static int port = Support_PortManager.getNextPort();
-    public static byte[] data = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
-
-    static class ServerThread extends Thread {
-        @Override
-        public void run() {
-            try {
-                ServerSocketChannel ssc = ServerSocketChannel.open();
-                InetSocketAddress addr = new InetSocketAddress(InetAddress
-                        .getByAddress(new byte[] {0, 0, 0, 0}), port);
-                ssc.socket().bind(addr, 0);
-
-                ByteBuffer buf = ByteBuffer.allocate(10);
-                buf.put(data);
-
-                while (!done) {
-                    SocketChannel sc = ssc.accept();
-                    buf.rewind();
-                    sc.write(buf);
-                }
-            } catch (Exception e) {
-                // ignore
-            }
-        }
-    }
-
-    class MockSocketChannel extends SocketChannel {
-
-        private boolean isWriteCalled = false;
-
-        private boolean isReadCalled = false;
-
-        private boolean isConstructorCalled = false;
-
-        public MockSocketChannel(SelectorProvider provider) {
-            super(provider);
-            isConstructorCalled = true;
-        }
-
-        public Socket socket() {
-            return null;
-        }
-
-        public boolean isConnected() {
-            return false;
-        }
-
-        public boolean isConnectionPending() {
-            return false;
-        }
-
-        public boolean connect(SocketAddress address) throws IOException {
-            return false;
-        }
-
-        public boolean finishConnect() throws IOException {
-            return false;
-        }
-
-        public int read(ByteBuffer target) throws IOException {
-            return 0;
-        }
-
-        public long read(ByteBuffer[] targets, int offset, int length)
-                throws IOException {
-            // Verify that calling read(ByteBuffer[]) leads to the method
-            // read(ByteBuffer[], int, int) being called with a 0 for the
-            // second parameter and targets.length as the third parameter.
-            if (0 == offset && length == targets.length) {
-                isReadCalled = true;
-            }
-            return 0;
-        }
-
-        public int write(ByteBuffer source) throws IOException {
-            return 0;
-        }
-
-        public long write(ByteBuffer[] sources, int offset, int length)
-                throws IOException {
-            // Verify that calling write(ByteBuffer[]) leads to the method
-            // write(ByteBuffer[], int, int) being called with a 0 for the
-            // second parameter and sources.length as the third parameter.
-            if (0 == offset && length == sources.length) {
-                isWriteCalled = true;
-            }
-            return 0;
-        }
-
-        protected void implCloseSelectableChannel() throws IOException {
-            // empty
-        }
-
-        protected void implConfigureBlocking(boolean blockingMode)
-                throws IOException {
-            // empty
-        }
-    }
-
-    class SubSocketAddress extends SocketAddress {
-        private static final long serialVersionUID = 1L;
-
-        // empty
-        public SubSocketAddress() {
-            super();
-        }
-    }
-}
diff --git a/luni/src/test/java/org/apache/harmony/security/tests/java/security/AlgorithmParameterGenerator3Test.java b/luni/src/test/java/org/apache/harmony/security/tests/java/security/AlgorithmParameterGenerator3Test.java
deleted file mode 100644
index f6320b5..0000000
--- a/luni/src/test/java/org/apache/harmony/security/tests/java/security/AlgorithmParameterGenerator3Test.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.security.tests.java.security;
-
-import java.math.BigInteger;
-import java.security.AlgorithmParameterGenerator;
-import java.security.AlgorithmParameters;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.NoSuchProviderException;
-import java.security.Provider;
-import java.security.SecureRandom;
-import java.security.Security;
-import java.security.spec.DSAParameterSpec;
-
-import dalvik.annotation.BrokenTest;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-
-@TestTargetClass(AlgorithmParameterGenerator.class)
-public class AlgorithmParameterGenerator3Test extends junit.framework.TestCase {
-
-    /**
-     * @tests java.security.AlgorithmParameterGenerator#generateParameters()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "generateParameters",
-        args = {}
-    )
-    @BrokenTest("Takes too long due to math implementation, disabling for now")
-    public void test_generateParameters() throws Exception {
-        // Test for method java.security.AlgorithmParameters
-        // java.security.AlgorithmParameterGenerator.generateParameters()
-        AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
-                .getInstance("DSA");
-        gen.init(1024);
-
-        // WARNING - The next line can take MINUTES to run
-        AlgorithmParameters params = gen.generateParameters();
-        assertNotNull("params is null", params);
-    }
-
-    /**
-     * @tests java.security.AlgorithmParameterGenerator#getAlgorithm()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getAlgorithm",
-        args = {}
-    )
-    public void test_getAlgorithm() throws Exception {
-        // Test for method java.lang.String
-        // java.security.AlgorithmParameterGenerator.getAlgorithm()
-        String alg = AlgorithmParameterGenerator.getInstance("DSA")
-                .getAlgorithm();
-        assertEquals("getAlgorithm ok", "DSA", alg);
-    }
-
-    /**
-     * @tests java.security.AlgorithmParameterGenerator#getInstance(java.lang.String)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL,
-        notes = "Verifies getInstance with parameter",
-        method = "getInstance",
-        args = {java.lang.String.class}
-    )
-    public void test_getInstanceLjava_lang_String() throws Exception {
-        // Test for method java.security.AlgorithmParameterGenerator
-        // java.security.AlgorithmParameterGenerator.getInstance(java.lang.String)
-        AlgorithmParameterGenerator.getInstance("DSA");
-    }
-
-    /**
-     * @tests java.security.AlgorithmParameterGenerator#getInstance(java.lang.String,
-     *        java.lang.String)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL,
-        notes = "Test NoSuchAlgorithmException is missed",
-        method = "getInstance",
-        args = {java.lang.String.class, java.lang.String.class}
-    )
-    public void test_getInstanceLjava_lang_StringLjava_lang_String() throws Exception {
-        // Test for method java.security.AlgorithmParameterGenerator
-        // java.security.AlgorithmParameterGenerator.getInstance(java.lang.String,
-        // java.lang.String)
-
-        // Opting for DSA here as it is pretty widely supported
-               Provider[] provs = Security
-                       .getProviders("AlgorithmParameterGenerator.DSA");
-
-        for (int i = 0; i < provs.length; i++) {
-                AlgorithmParameterGenerator.getInstance("DSA", provs[i].getName());
-            }// end for
-
-
-        // exception case - should throw IllegalArgumentException for null
-        // provider
-        try {
-            AlgorithmParameterGenerator.getInstance("DSA", (String) null);
-            fail("Should have thrown IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
-            // Expected
-        }
-
-        // exception case - should throw IllegalArgumentException for empty
-        // provider
-        try {
-            AlgorithmParameterGenerator.getInstance("DSA", "");
-            fail("Should have thrown IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
-            // Expected
-        }
-
-        // exception case - should throw NoSuchProviderException
-        try {
-            AlgorithmParameterGenerator.getInstance("DSA", "IDontExist");
-            fail("Should have thrown NoSuchProviderException");
-        } catch (NoSuchProviderException e) {
-            // Expected
-        }
-    }
-
-    /**
-     * @tests java.security.AlgorithmParameterGenerator#getProvider()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "Verifies provider with null parameter",
-        method = "getProvider",
-        args = {}
-    )
-    public void test_getProvider() throws Exception {
-        // Test for method java.security.Provider
-        // java.security.AlgorithmParameterGenerator.getProvider()
-            // checks that no exception is thrown
-        Provider p = AlgorithmParameterGenerator.getInstance("DSA")
-                .getProvider();
-        assertNotNull("provider is null", p);
-    }
-
-    /**
-     * @tests java.security.AlgorithmParameterGenerator#init(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "init",
-        args = {int.class}
-    )
-    public void test_initI() throws Exception {
-        // Test for method void
-        // java.security.AlgorithmParameterGenerator.init(int)
-            // checks that no exception is thrown
-        int[] valid = {512, 576, 640, 960, 1024};
-        AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
-                .getInstance("DSA");
-
-        for (int i = 0; i < valid.length; i++) {
-            try {
-                gen.init(valid[i]);
-            } catch (Exception e) {
-                fail("Exception should not be thrown for valid parameter" + valid[i]);
-
-            }
-        }
-    }
-
-    /**
-     * @tests java.security.AlgorithmParameterGenerator#init(int,
-     *        java.security.SecureRandom)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "init",
-        args = {int.class, java.security.SecureRandom.class}
-    )
-    public void test_initILjava_security_SecureRandom() throws Exception {
-        // Test for method void
-        // java.security.AlgorithmParameterGenerator.init(int,
-        // java.security.SecureRandom)
-            // checks that no exception is thrown
-        int[] valid = {512, 576, 640, 960, 1024};
-        AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
-                .getInstance("DSA");
-
-        for (int i = 0; i < valid.length; i++) {
-            try {
-                gen.init(valid[i], new SecureRandom());
-                gen.init(valid[i], null);
-            } catch (Exception e) {
-                fail("Exception should not be thrown for valid parameter" + valid[i]);
-
-            }
-        }
-    }
-
-    /**
-     * @tests java.security.AlgorithmParameterGenerator#init(java.security.spec.AlgorithmParameterSpec)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL,
-        notes = "Verifies InvalidAlgorithmParameterException exception only",
-        method = "init",
-        args = {java.security.spec.AlgorithmParameterSpec.class}
-    )
-    public void test_initLjava_security_spec_AlgorithmParameterSpec() throws Exception {
-        // Test for method void
-        // java.security.AlgorithmParameterGenerator.init(java.security.spec.AlgorithmParameterSpec)
-        // checks that InvalidAlgorithmParameterException is thrown
-        DSAParameterSpec spec = new DSAParameterSpec(BigInteger.ONE,
-                BigInteger.ONE, BigInteger.ONE);
-        AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
-                .getInstance("DSA");
-        try {
-            gen.init(spec);
-            fail("No expected InvalidAlgorithmParameterException");
-        } catch (InvalidAlgorithmParameterException e) {
-            //expected
-        }
-    }
-
-    /**
-     * @tests java.security.AlgorithmParameterGenerator#init(java.security.spec.AlgorithmParameterSpec,
-     *        java.security.SecureRandom)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL,
-        notes = "Verifies InvalidAlgorithmParameterException exception only",
-        method = "init",
-        args = {java.security.spec.AlgorithmParameterSpec.class, java.security.SecureRandom.class}
-    )
-    public void test_initLjava_security_spec_AlgorithmParameterSpecLjava_security_SecureRandom() throws Exception {
-        // Test for method void
-        // java.security.AlgorithmParameterGenerator.init(java.security.spec.AlgorithmParameterSpec,
-        // java.security.SecureRandom)
-        // checks that InvalidAlgorithmParameterException  is thrown
-        DSAParameterSpec spec = new DSAParameterSpec(BigInteger.ONE,
-                BigInteger.ONE, BigInteger.ONE);
-        AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
-                .getInstance("DSA");
-        try {
-            gen.init(spec, new SecureRandom());
-            fail("No expected InvalidAlgorithmParameterException");
-        } catch (InvalidAlgorithmParameterException e) {
-            //expected
-        }
-    }
-}
diff --git a/luni/src/test/java/org/apache/harmony/security/tests/java/security/AllTests.java b/luni/src/test/java/org/apache/harmony/security/tests/java/security/AllTests.java
index c0d5640..97f58d0 100644
--- a/luni/src/test/java/org/apache/harmony/security/tests/java/security/AllTests.java
+++ b/luni/src/test/java/org/apache/harmony/security/tests/java/security/AllTests.java
@@ -33,7 +33,6 @@
         suite.addTestSuite(AccessController2Test.class);
         suite.addTestSuite(AlgorithmParameterGenerator1Test.class);
         suite.addTestSuite(AlgorithmParameterGenerator2Test.class);
-        suite.addTestSuite(AlgorithmParameterGenerator3Test.class);
         suite.addTestSuite(AlgorithmParametersSpiTest.class);
         suite.addTestSuite(AlgorithmParametersTest.class);
         suite.addTestSuite(AllPermission2Test.class);
diff --git a/luni/src/test/java/org/apache/harmony/text/tests/java/text/AllTests.java b/luni/src/test/java/org/apache/harmony/text/tests/java/text/AllTests.java
index 0a0f901..5f05690 100644
--- a/luni/src/test/java/org/apache/harmony/text/tests/java/text/AllTests.java
+++ b/luni/src/test/java/org/apache/harmony/text/tests/java/text/AllTests.java
@@ -17,6 +17,7 @@
 
 package org.apache.harmony.text.tests.java.text;
 
+import java.text.OldNumberFormatTest;
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
@@ -38,7 +39,6 @@
         suite.addTestSuite(DateFormatSymbolsTest.class);
         suite.addTestSuite(DateFormatTest.class);
         suite.addTestSuite(DecimalFormatSymbolsTest.class);
-        suite.addTestSuite(DecimalFormatTest.class);
         suite.addTestSuite(DecimalFormatTestICU.class);
         suite.addTestSuite(FieldPositionTest.class);
         suite.addTestSuite(FormatFieldTest.class);
@@ -47,11 +47,10 @@
         suite.addTestSuite(MessageFormatTest.class);
         suite.addTestSuite(NormalizerTest.class);
         suite.addTestSuite(NumberFormatFieldTest.class);
-        suite.addTestSuite(NumberFormatTest.class);
+        suite.addTestSuite(OldNumberFormatTest.class);
         suite.addTestSuite(ParseExceptionTest.class);
         suite.addTestSuite(ParsePositionTest.class);
         suite.addTestSuite(RuleBasedCollatorTest.class);
-        suite.addTestSuite(SimpleDateFormatTest.class);
         suite.addTestSuite(StringCharacterIteratorTest.class);
         //$JUnit-END$
         return suite;
diff --git a/luni/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java b/luni/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java
deleted file mode 100644
index 7156dc2..0000000
--- a/luni/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java
+++ /dev/null
@@ -1,2885 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.text.tests.java.text;
-
-import dalvik.annotation.AndroidOnly;
-import dalvik.annotation.BrokenTest;
-import dalvik.annotation.KnownFailure;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
-import junit.framework.TestCase;
-
-import tests.support.Support_BitSet;
-import tests.support.Support_DecimalFormat;
-import tests.support.Support_Locale;
-
-import java.io.ObjectInputStream;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.math.RoundingMode;
-import java.text.AttributedCharacterIterator;
-import java.text.DecimalFormat;
-import java.text.DecimalFormatSymbols;
-import java.text.FieldPosition;
-import java.text.NumberFormat;
-import java.text.ParseException;
-import java.text.ParsePosition;
-import java.util.BitSet;
-import java.util.Currency;
-import java.util.Locale;
-
-
-@TestTargetClass(DecimalFormat.class)
-public class DecimalFormatTest extends TestCase {
-    @TestTargetNew(
-        level = TestLevel.PARTIAL,
-        notes = "Regression test for AttributedCharacterIterator.",
-        method = "formatToCharacterIterator",
-        args = {java.lang.Object.class}
-    )
-    public void testAttributedCharacterIterator() throws Exception {
-        // Regression for http://issues.apache.org/jira/browse/HARMONY-333
-        AttributedCharacterIterator iterator = new DecimalFormat()
-                .formatToCharacterIterator(new Integer(1));
-        assertNotNull(iterator);
-        assertFalse("attributes should exist", iterator.getAttributes()
-                .isEmpty());
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "formatToCharacterIterator",
-        args = {java.lang.Object.class}
-    )
-    public void test_formatToCharacterIterator() throws Exception {
-        AttributedCharacterIterator iterator;
-        int[] runStarts;
-        int[] runLimits;
-        String result;
-        char current;
-
-        // For BigDecimal with multiplier test.
-        DecimalFormat df = new DecimalFormat();
-        df.setMultiplier(10);
-        iterator = df.formatToCharacterIterator(new BigDecimal("12345678901234567890"));
-        result = "123,456,789,012,345,678,900";
-        current = iterator.current();
-        for (int i = 0; i < result.length(); i++) {
-            assertEquals("wrong char @" + i, result.charAt(i), current);
-            current = iterator.next();
-        }
-
-        // For BigDecimal with multiplier test.
-        df = new DecimalFormat();
-        df.setMultiplier(-1);
-        df.setMaximumFractionDigits(20);
-        iterator = df.formatToCharacterIterator(new BigDecimal("1.23456789012345678901"));
-        result = "-1.23456789012345678901";
-        current = iterator.current();
-        for (int i = 0; i < result.length(); i++) {
-            assertEquals("wrong char @" + i, result.charAt(i), current);
-            current = iterator.next();
-        }
-
-        iterator = new DecimalFormat()
-                .formatToCharacterIterator(new BigDecimal("1.23456789E1234"));
-        runStarts = new int[] {0, 0, 2, 3, 3, 3, 6, 7, 7, 7, 10, 11, 11, 11, 14};
-        runLimits = new int[] {2, 2, 3, 6, 6, 6, 7, 10, 10, 10, 11, 14, 14, 14, 15};
-        result = "12,345,678,900,"; // 000,000,000,000....
-        current = iterator.current();
-        for (int i = 0; i < runStarts.length; i++) {
-            assertEquals("wrong start @" + i, runStarts[i], iterator.getRunStart());
-            assertEquals("wrong limit @" + i, runLimits[i], iterator.getRunLimit());
-            assertEquals("wrong char @" + i, result.charAt(i), current);
-            current = iterator.next();
-        }
-        assertEquals(0, iterator.getBeginIndex());
-        assertEquals(1646, iterator.getEndIndex());
-
-        iterator = new DecimalFormat()
-                .formatToCharacterIterator(new BigDecimal("1.23456789E301"));
-        runStarts = new int[] {0, 0, 2, 3, 3, 3, 6, 7, 7, 7, 10, 11, 11, 11, 14};
-        runLimits = new int[] {2, 2, 3, 6, 6, 6, 7, 10, 10, 10, 11, 14, 14, 14, 15};
-        result = "12,345,678,900,"; // 000,000,000,000....
-        current = iterator.current();
-        for (int i = 0; i < runStarts.length; i++) {
-            assertEquals("wrong start @" + i, runStarts[i], iterator.getRunStart());
-            assertEquals("wrong limit @" + i, runLimits[i], iterator.getRunLimit());
-            assertEquals("wrong char @" + i, result.charAt(i), current);
-            current = iterator.next();
-        }
-        assertEquals(0, iterator.getBeginIndex());
-        assertEquals(402, iterator.getEndIndex());
-
-        iterator = new DecimalFormat()
-                .formatToCharacterIterator(new BigDecimal("1.2345678E4"));
-        runStarts = new int[] {0, 0, 2, 3, 3, 3, 6, 7, 7, 7};
-        runLimits = new int[] {2, 2, 3, 6, 6, 6, 7, 10, 10, 10};
-        result = "12,345.678";
-        current = iterator.current();
-        for (int i = 0; i < runStarts.length; i++) {
-            assertEquals("wrong start @" + i, runStarts[i], iterator.getRunStart());
-            assertEquals("wrong limit @" + i, runLimits[i], iterator.getRunLimit());
-            assertEquals("wrong char @" + i, result.charAt(i), current);
-            current = iterator.next();
-        }
-        assertEquals(0, iterator.getBeginIndex());
-        assertEquals(10, iterator.getEndIndex());
-
-        iterator = new DecimalFormat()
-                .formatToCharacterIterator(new BigInteger("123456789"));
-        runStarts = new int[] {0, 0, 0, 3, 4, 4, 4, 7, 8, 8, 8};
-        runLimits = new int[] {3, 3, 3, 4, 7, 7, 7, 8, 11, 11, 11};
-        result = "123,456,789";
-        current = iterator.current();
-        for (int i = 0; i < runStarts.length; i++) {
-            assertEquals("wrong start @" + i, runStarts[i], iterator.getRunStart());
-            assertEquals("wrong limit @" + i, runLimits[i], iterator.getRunLimit());
-            assertEquals("wrong char @" + i, result.charAt(i), current);
-            current = iterator.next();
-        }
-        assertEquals(0, iterator.getBeginIndex());
-        assertEquals(11, iterator.getEndIndex());
-    }
-
-    /*
-     * Test the getter and setter of parseBigDecimal and parseIntegerOnly and
-     * test the default value of them.
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            notes = "",
-            method = "isParseBigDecimal",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            notes = "",
-            method = "setParseBigDecimal",
-            args = {boolean.class}
-        )
-    })
-    public void test_isParseBigDecimalLjava_lang_Boolean_isParseIntegerOnlyLjava_lang_Boolean() {
-
-        // parseBigDecimal default to false
-        DecimalFormat form = (DecimalFormat) DecimalFormat
-                .getInstance(Locale.US);
-        assertFalse(form.isParseBigDecimal());
-        form.setParseBigDecimal(true);
-        assertTrue(form.isParseBigDecimal());
-
-        try {
-            Number result = form.parse("123.123");
-            assertEquals(new BigDecimal("123.123"), result);
-        } catch (ParseException e) {
-            fail("ParseException was thrown.");
-        }
-
-        form.setParseBigDecimal(false);
-        assertFalse(form.isParseBigDecimal());
-
-        try {
-            Number result = form.parse("123.123");
-            assertFalse(result instanceof BigDecimal);
-        } catch (ParseException e) {
-            fail("ParseException was thrown.");
-        }
-
-        // parseIntegerOnly default to false
-        assertFalse(form.isParseIntegerOnly());
-    }
-
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            notes = "",
-            method = "isParseIntegerOnly",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            notes = "",
-            method = "setParseIntegerOnly",
-            args = {boolean.class}
-        )
-    })
-    public void test_isParseIntegerOnly() {
-
-            DecimalFormat format = new DecimalFormat();
-            assertFalse("Default value of isParseIntegerOnly is true",
-                    format.isParseIntegerOnly());
-
-            format.setParseIntegerOnly(true);
-            assertTrue(format.isParseIntegerOnly());
-            try {
-                Number result = format.parse("123.123");
-                assertEquals(new Long("123"), result);
-            } catch (ParseException e) {
-                fail("ParseException was thrown.");
-            }
-
-            format.setParseIntegerOnly(false);
-            assertFalse(format.isParseIntegerOnly());
-            try {
-                Number result = format.parse("123.123");
-                assertEquals(new Double("123.123"), result);
-            } catch (ParseException e) {
-                fail("ParseException was thrown.");
-            }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isGroupingUsed",
-        args = {}
-    )
-    public void test_isGroupingUsed() {
-        String [] patterns = {"####.##", "######.######", "000000.000000",
-                "######.000000", "000000.######", " ###.###", "$#####.######",
-                "$$####.######"};
-
-        for(String pattern:patterns) {
-            DecimalFormat format = new DecimalFormat(pattern);
-            assertFalse(format.isGroupingUsed());
-        }
-
-        DecimalFormat format = new DecimalFormat("###,####");
-        assertTrue(format.isGroupingUsed());
-    }
-
-    // Test the type of the returned object
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "parse",
-        args = {java.lang.String.class, java.text.ParsePosition.class}
-    )
-    public void test_parseLjava_lang_String_Ljava_text_ParsePosition() {
-        DecimalFormat form = (DecimalFormat) DecimalFormat
-                .getInstance(Locale.US);
-        Number number = form.parse("23.1", new ParsePosition(0));
-        assertTrue(number instanceof Double);
-
-        // Test parsed object of type double when
-        // parseBigDecimal is set to true
-
-        form = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
-        number = form.parse("23.1", new ParsePosition(0));
-        assertTrue(number instanceof Double);
-
-        form.setParseBigDecimal(true);
-        number = form.parse("23.1", new ParsePosition(0));
-
-        assertTrue(number instanceof BigDecimal);
-        assertEquals(new BigDecimal("23.1"), number);
-
-        // When parseIntegerOnly set to true, all float numbers will be parsed
-        // into Long.
-        // With the exception that, the value is out of the bound of Long or
-        // some special values such as NaN or Infinity.
-
-        form = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
-        form.setParseIntegerOnly(true);
-        number = form.parse("23.1f", new ParsePosition(0));
-
-        assertTrue(number instanceof Long);
-
-        number = form.parse("23.0", new ParsePosition(0));
-        assertTrue(number instanceof Long);
-
-        number = form.parse("-0.0", new ParsePosition(0));
-        assertTrue(number instanceof Long);
-        assertTrue(new Long(0).equals(number));
-
-        number = form.parse("-9,223,372,036,854,775,8080.00",
-                new ParsePosition(0));
-        assertTrue(number instanceof Double);
-
-        // Even if parseIntegerOnly is set to true, NaN will be parsed to Double
-
-        form = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
-        form.setParseIntegerOnly(true);
-        DecimalFormatSymbols symbols = new DecimalFormatSymbols();
-        number = form.parse(symbols.getNaN(), new ParsePosition(0));
-        assertTrue(number instanceof Double);
-
-        // Even if parseIntegerOnly is set to true, Infinity will still be
-        // parsed to Double
-
-        form = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
-        form.setParseIntegerOnly(true);
-        symbols = new DecimalFormatSymbols();
-        number = form.parse(symbols.getInfinity(), new ParsePosition(0));
-        assertTrue(number instanceof Double);
-
-        // ParseBigDecimal take precedence of parseBigInteger
-
-        form = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
-        form.setParseIntegerOnly(true);
-        form.setParseBigDecimal(true);
-
-        number = form.parse("23.1f", new ParsePosition(0));
-
-        assertTrue(number instanceof BigDecimal);
-
-        number = form.parse("23.0", new ParsePosition(0));
-        assertTrue(number instanceof BigDecimal);
-
-        number = form.parse("-9,223,372,036,854,775,8080.00",
-                new ParsePosition(0));
-        assertFalse(number instanceof BigInteger);
-        assertTrue(number instanceof BigDecimal);
-
-        final String doubleMax2 = "359,538,626,972,463,141,629,054,847,463,408,"
-            + "713,596,141,135,051,689,993,197,834,953,606,314,521,560,057,077,"
-            + "521,179,117,265,533,756,343,080,917,907,028,764,928,468,642,653,"
-            + "778,928,365,536,935,093,407,075,033,972,099,821,153,102,564,152,"
-            + "490,980,180,778,657,888,151,737,016,910,267,884,609,166,473,806,"
-            + "445,896,331,617,118,664,246,696,549,595,652,408,289,446,337,476,"
-            + "354,361,838,599,762,500,808,052,368,249,716,736";
-        number = form.parse(doubleMax2, new ParsePosition(0));
-        assertTrue(number instanceof BigDecimal);
-        BigDecimal result = (BigDecimal)number;
-        assertEquals(new BigDecimal(Double.MAX_VALUE).add(new BigDecimal(
-                Double.MAX_VALUE)), result);
-
-        // Test whether the parsed object is of type float. (To be specific,
-        // they are of type Double)
-
-        form = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
-
-        number = form.parse("23.1f", new ParsePosition(0));
-        assertTrue(number instanceof Double);
-
-        form.setParseBigDecimal(true);
-        number = form.parse("23.1f", new ParsePosition(0));
-        assertTrue(number instanceof BigDecimal);
-        assertEquals(new BigDecimal("23.1"), number);
-
-        // Integer will be parsed to Long, unless parseBigDecimal is set to true
-
-        form = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
-
-        number = form.parse("123", new ParsePosition(0));
-        assertTrue(number instanceof Long);
-
-        form.setParseBigDecimal(true);
-        number = form.parse("123", new ParsePosition(0));
-        assertTrue(number instanceof BigDecimal);
-        assertEquals(new BigDecimal("123"), number);
-
-        // NaN will be parsed to Double, no matter parseBigDecimal set or not.
-
-        form = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
-        symbols = new DecimalFormatSymbols();
-        number = form.parse(symbols.getNaN() + "", new ParsePosition(0));
-        assertTrue(number instanceof Double);
-
-        form.setParseBigDecimal(true);
-        number = form.parse(symbols.getNaN() + "", new ParsePosition(0));
-        assertTrue(number instanceof Double);
-
-        // Infinity will be parsed to Double, no matter parseBigDecimal set or
-        // not.
-
-        form = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
-        symbols = new DecimalFormatSymbols();
-
-        number = form.parse(symbols.getInfinity(), new ParsePosition(0));
-
-        assertTrue(number instanceof Double);
-        assertEquals("Infinity", number.toString());
-        // When set bigDecimal to true, the result of parsing infinity
-
-        form = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
-        symbols = new DecimalFormatSymbols();
-        form.setParseBigDecimal(true);
-
-        number = form.parse(symbols.getInfinity(), new ParsePosition(0));
-        assertTrue(number instanceof Double);
-        assertEquals("Infinity", number.toString());
-
-        // Negative infinity will be parsed to double no matter parseBigDecimal
-        // set or not
-
-        form = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
-        symbols = new DecimalFormatSymbols();
-
-        number = form.parse("-" + symbols.getInfinity(), new ParsePosition(0));
-
-        assertTrue(number instanceof Double);
-        assertEquals("-Infinity", number.toString());
-
-        // When set bigDecimal to true, the result of parsing minus infinity
-
-        form = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
-        symbols = new DecimalFormatSymbols();
-        form.setParseBigDecimal(true);
-
-        number = form.parse("-" + symbols.getInfinity(), new ParsePosition(0));
-
-        assertTrue(number instanceof Double);
-        assertEquals("-Infinity", number.toString());
-
-        // -0.0 will be parsed to different type according to the combination of
-        // parseBigDecimal and parseIntegerOnly
-
-        form = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
-
-        // parseBigDecimal == true;
-        // parseIntegerOnly == false;
-        form.setParseBigDecimal(true);
-        number = form.parse("-0", new ParsePosition(0));
-        assertTrue(number instanceof BigDecimal);
-
-        number = form.parse("-0.0", new ParsePosition(0));
-        assertTrue(number instanceof BigDecimal);
-
-        // parseBigDecimal == false;
-        // parseIntegerOnly == true;
-        form.setParseBigDecimal(false);
-        form.setParseIntegerOnly(true);
-        number = form.parse("-0", new ParsePosition(0));
-
-        assertTrue(number instanceof Long);
-
-        number = form.parse("-0.0", new ParsePosition(0));
-        assertTrue(number instanceof Long);
-
-        // parseBigDecimal == false;
-        // parseIntegerOnly == false;
-        form.setParseBigDecimal(false);
-        form.setParseIntegerOnly(false);
-        number = form.parse("-0", new ParsePosition(0));
-        assertTrue(number instanceof Double);
-
-        number = form.parse("-0.0", new ParsePosition(0));
-        assertTrue(number instanceof Double);
-
-        // parseBigDecimal == true;
-        // parseIntegerOnly == true;
-        // parseBigDecimal take precedence of parseBigInteger
-        form.setParseBigDecimal(true);
-        form.setParseIntegerOnly(true);
-        number = form.parse("-0", new ParsePosition(0));
-        assertTrue(number instanceof BigDecimal);
-
-        number = form.parse("-0.0", new ParsePosition(0));
-        assertTrue(number instanceof BigDecimal);
-
-        number = form.parse("12.4", new ParsePosition(0));
-        assertTrue(number instanceof BigDecimal);
-
-        // When parseBigDecimal is set to false, no matter how massive the
-        // mantissa part of a number is, the number will be parsed into Double
-
-        form = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
-
-        number = form.parse("9,223,372,036,854,775,808.00",
-                new ParsePosition(0));
-
-        assertTrue(number instanceof Double);
-        assertEquals("9.223372036854776E18", number.toString());
-
-        number = form.parse("-9,223,372,036,854,775,8080.00",
-                new ParsePosition(0));
-        assertTrue(number instanceof Double);
-        assertEquals("-9.223372036854776E19", number.toString());
-
-        // When parseBigDecimal is set to true, if mantissa part of number
-        // exceeds Long.MAX_VALUE, the number will be parsed into BigDecimal
-
-        form = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
-
-        form.setParseBigDecimal(true);
-        number = form.parse("9,223,372,036,854,775,808.00",
-                new ParsePosition(0));
-
-        assertTrue(number instanceof BigDecimal);
-
-        assertEquals(9.223372036854776E18, number.doubleValue(), 0);
-
-        number = form.parse("-9,223,372,036,854,775,8080.00",
-                new ParsePosition(0));
-
-        assertTrue(number instanceof BigDecimal);
-        assertEquals(-9.223372036854776E19, number.doubleValue(), 0);
-
-        // The minimum value of Long will be parsed to Long when parseBigDecimal
-        // is not set
-
-        ParsePosition pos = new ParsePosition(0);
-        DecimalFormat df = new DecimalFormat();
-        pos = new ParsePosition(0);
-        Number nb = df.parse("" + Long.MIN_VALUE, pos);
-        assertTrue(nb instanceof Long);
-
-        // The maximum value of Long will be parsed to Long when parseBigDecimal
-        // is set
-        pos = new ParsePosition(0);
-        df = new DecimalFormat();
-        pos = new ParsePosition(0);
-        nb = df.parse("" + Long.MAX_VALUE, pos);
-        assertTrue(nb instanceof Long);
-
-        // When parsing invalid string( which is neither consist of digits nor
-        // NaN/Infinity), a null will be returned.
-
-        pos = new ParsePosition(0);
-        df = new DecimalFormat();
-        try {
-            nb = df.parse("invalid", pos);
-            assertNull(nb);
-        } catch (NullPointerException e) {
-            fail("Should not throw NPE");
-        }
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getMaximumFractionDigits",
-        args = {}
-    )
-    public void test_getMaximumFractionDigits() {
-        NumberFormat nform = DecimalFormat.getInstance(Locale.US);
-        DecimalFormat form = (DecimalFormat) nform;
-
-        // getMaximumFractionDigits of NumberFormat default to 3
-        // getMaximumFractionDigits of DecimalFormat default to 3
-        assertEquals(3, nform.getMaximumFractionDigits());
-        assertEquals(3, form.getMaximumFractionDigits());
-
-        // Greater than 340 (critical number used to distinguish
-        // BigInteger and BigDecimal)
-        nform.setMaximumFractionDigits(500);
-        assertEquals(500, nform.getMaximumFractionDigits());
-        assertEquals(500, form.getMaximumFractionDigits());
-
-        form.setMaximumFractionDigits(500);
-        assertEquals(500, nform.getMaximumFractionDigits());
-        assertEquals(500, form.getMaximumFractionDigits());
-
-        form.format(12.3);
-        assertEquals(500, nform.getMaximumFractionDigits());
-        assertEquals(500, form.getMaximumFractionDigits());
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getMinimumFractionDigits",
-        args = {}
-    )
-    public void test_getMinimumFractionDigits() {
-        NumberFormat nform = DecimalFormat.getInstance(Locale.US);
-        DecimalFormat form = (DecimalFormat) nform;
-
-        // getMinimumFractionDigits from NumberFormat (default to 0)
-        // getMinimumFractionDigits from DecimalFormat (default to 0)
-        assertEquals(0, nform.getMinimumFractionDigits());
-        assertEquals(0, form.getMinimumFractionDigits());
-
-        // Greater than 340 (critical number used to distinguish
-        // BigInteger and BigDecimal)
-        nform.setMinimumFractionDigits(500);
-        assertEquals(500, nform.getMinimumFractionDigits());
-        assertEquals(500, form.getMinimumFractionDigits());
-
-        form.setMaximumFractionDigits(400);
-        assertEquals(400, nform.getMinimumFractionDigits());
-        assertEquals(400, form.getMinimumFractionDigits());
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        method = "getMinimumIntegerDigits",
-        args = {}
-    )
-    public void test_getMaximumIntegerDigits() {
-        final int maxIntDigit = 309;
-
-        // When use default locale, in this case zh_CN
-        // the returned instance of NumberFormat is a DecimalFormat
-        DecimalFormat form = new DecimalFormat("00.###E0");
-        assertEquals(2, form.getMaximumIntegerDigits());
-
-        NumberFormat nform = DecimalFormat.getInstance(Locale.US);
-        form = null;
-        if (nform instanceof DecimalFormat) {
-            form = (DecimalFormat) nform;
-        }
-
-        // Greater than 309 (critical number used to distinguish
-        // BigInteger and BigDecimal)
-        nform.setMaximumIntegerDigits(500);
-        assertEquals(500, nform.getMaximumIntegerDigits());
-        assertEquals(500, form.getMaximumIntegerDigits());
-
-        form = new DecimalFormat("00.###E0");
-        assertEquals(2, form.getMaximumIntegerDigits());
-
-        form.setMaximumIntegerDigits(500);
-        assertEquals(500, nform.getMaximumIntegerDigits());
-        assertEquals(500, form.getMaximumIntegerDigits());
-        form.format(12.3);
-        assertEquals(500, nform.getMaximumIntegerDigits());
-        assertEquals(500, form.getMaximumIntegerDigits());
-
-        nform = DecimalFormat.getInstance(Locale.US);
-        form = null;
-        if (nform instanceof DecimalFormat) {
-            form = (DecimalFormat) nform;
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        method = "getMinimumIntegerDigits",
-        args = {}
-    )
-    @AndroidOnly("Difference to RI")
-    public void test_getMaximumIntegerDigits_AndroidOnly() {
-        final int maxIntDigit = 309;
-
-        // When use default locale, in this case zh_CN
-        // the returned instance of NumberFormat is a DecimalFormat
-        DecimalFormat form = new DecimalFormat("00.###E0");
-        NumberFormat nform = DecimalFormat.getInstance(Locale.US);
-        nform = DecimalFormat.getInstance(Locale.US);
-        form = null;
-        if (nform instanceof DecimalFormat) {
-            form = (DecimalFormat) nform;
-        }
-        // getMaximumIntegerDigits from NumberFormat default to 309
-        // getMaximumIntegerDigits from DecimalFormat default to 309
-        // the following 2 assertions will fail on RI implementation, since the
-        // implementation of ICU and RI are not identical. RI does not give
-        // DecimalFormat an initial bound about its maximumIntegerDigits
-        // (default to Integer.MAX_VALUE: 2147483647 )
-        assertEquals(maxIntDigit, nform.getMaximumIntegerDigits());
-        assertEquals(maxIntDigit, form.getMaximumIntegerDigits());
-    }
-
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        method = "getMinimumIntegerDigits",
-        args = {}
-    )
-    @AndroidOnly("second 0 needs to be quoted in icu." +
-            "(quoting special characters in prefix and suffix necessary)")
-    public void test_getMaximumIntegerDigits2() {
-        // regression test for HARMONY-878
-        assertTrue(new DecimalFormat("0\t'0'").getMaximumIntegerDigits() > 0);
-    }
-
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getMinimumIntegerDigits",
-        args = {}
-    )
-    public void test_getMinimumIntegerDigits() {
-        final int minIntDigit = 1;
-        NumberFormat nform = DecimalFormat.getInstance(Locale.US);
-        DecimalFormat form = (DecimalFormat) nform;
-
-        // getMaximumIntegerDigits from NumberFormat (default to 1)
-        // getMaximumIntegerDigits from DecimalFormat (default to 1)
-        assertEquals(minIntDigit, nform.getMinimumIntegerDigits());
-        assertEquals(minIntDigit, form.getMinimumIntegerDigits());
-
-        // Greater than 309 (critical number used to distinguish
-        // BigInteger and BigDecimal)
-        nform.setMinimumIntegerDigits(500);
-        assertEquals(500, nform.getMinimumIntegerDigits());
-        assertEquals(500, form.getMinimumIntegerDigits());
-
-        form.setMaximumIntegerDigits(400);
-        assertEquals(400, nform.getMinimumIntegerDigits());
-        assertEquals(400, form.getMinimumIntegerDigits());
-
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "format",
-        args = {java.lang.Object.class, java.lang.StringBuffer.class, java.text.FieldPosition.class}
-    )
-    public void test_formatLjava_lang_Obj_Ljava_StringBuffer_Ljava_text_FieldPosition() {
-        NumberFormat nform = DecimalFormat.getInstance(Locale.US);
-        DecimalFormat form = (DecimalFormat) nform;
-
-        // If Object(including null) is not of type Number,
-        // IllegalArgumentException will be thrown out
-        try {
-            form.format(new Object(), new StringBuffer(), new FieldPosition(0));
-            fail("Should throw IAE");
-        } catch (IllegalArgumentException e) {
-            // expected
-        }
-        try {
-            form.format(null, new StringBuffer(), new FieldPosition(0));
-            fail("Should throw IAE");
-        } catch (IllegalArgumentException e) {
-            // expected
-        }
-
-        // When StringBuffer == null || FieldPosition == null
-        // NullPointerException will be thrown out.
-        try {
-            form.format(new Double(1.9), null, new FieldPosition(0));
-            fail("Should throw NPE");
-        } catch (NullPointerException e) {
-            // expected
-        }
-
-        try {
-            form.format(new Double(1.3), new StringBuffer(), null);
-            fail("Should throw NPE");
-        } catch (NullPointerException e) {
-            // expected
-        }
-
-        try {
-            form.format(new Double(1.4), null, null);
-            fail("Should throw NPE");
-        } catch (NullPointerException e) {
-            // expected
-        }
-
-        try {
-            form.format(new Object(), null, null);
-            fail("Should throw IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
-            // expected
-        }
-
-        FieldPosition pos;
-        StringBuffer out;
-        DecimalFormat format = (DecimalFormat) NumberFormat
-                .getInstance(Locale.US);
-
-        // format maxLong
-        pos = new FieldPosition(0);
-        out = format.format(new Long(Long.MAX_VALUE), new StringBuffer(), pos);
-        assertTrue("Wrong result L1: " + out, out.toString().equals(
-                "9,223,372,036,854,775,807"));
-
-        // format minLong
-        pos = new FieldPosition(0);
-        out = format.format(new Long(Long.MIN_VALUE), new StringBuffer(), pos);
-        assertTrue("Wrong result L2: " + out, out.toString().equals(
-                "-9,223,372,036,854,775,808"));
-
-        // format maxLong of type BigInteger
-        pos = new FieldPosition(0);
-        out = format.format(new java.math.BigInteger(String
-                .valueOf(Long.MAX_VALUE)), new StringBuffer(), pos);
-        assertTrue("Wrong result BI1: " + out, out.toString().equals(
-                "9,223,372,036,854,775,807"));
-
-        // format minLong of type BigInteger
-        pos = new FieldPosition(0);
-        out = format.format(new java.math.BigInteger(String
-                .valueOf(Long.MIN_VALUE)), new StringBuffer(), pos);
-        assertTrue("Wrong result BI2: " + out, out.toString().equals(
-                "-9,223,372,036,854,775,808"));
-
-        // format maxLong + 1
-        java.math.BigInteger big;
-        pos = new FieldPosition(0);
-        big = new java.math.BigInteger(String.valueOf(Long.MAX_VALUE))
-                .add(new java.math.BigInteger("1"));
-        out = format.format(big, new StringBuffer(), pos);
-        assertTrue("Wrong result BI3: " + out, out.toString().equals(
-                "9,223,372,036,854,775,808"));
-
-        // format minLong - 1
-        pos = new FieldPosition(0);
-        big = new java.math.BigInteger(String.valueOf(Long.MIN_VALUE))
-                .add(new java.math.BigInteger("-1"));
-        out = format.format(big, new StringBuffer(), pos);
-        assertTrue("Wrong result BI4: " + out, out.toString().equals(
-                "-9,223,372,036,854,775,809"));
-
-        // format big decimal
-        pos = new FieldPosition(0);
-        out = format.format(new java.math.BigDecimal("51.348"),
-                new StringBuffer(), pos);
-        assertTrue("Wrong result BD1: " + out, out.toString().equals("51.348"));
-
-        // format big decimal
-        pos = new FieldPosition(0);
-        out = format.format(new java.math.BigDecimal("51"), new StringBuffer(),
-                pos);
-        assertTrue("Wrong result BD2: " + out, out.toString().equals("51"));
-
-        // format big decimal Double.MAX_VALUE * 2
-        java.math.BigDecimal bigDecimal;
-        pos = new FieldPosition(0);
-        final String doubleMax2 = "359,538,626,972,463,141,629,054,847,463,408,"
-                + "713,596,141,135,051,689,993,197,834,953,606,314,521,560,057,077,"
-                + "521,179,117,265,533,756,343,080,917,907,028,764,928,468,642,653,"
-                + "778,928,365,536,935,093,407,075,033,972,099,821,153,102,564,152,"
-                + "490,980,180,778,657,888,151,737,016,910,267,884,609,166,473,806,"
-                + "445,896,331,617,118,664,246,696,549,595,652,408,289,446,337,476,"
-                + "354,361,838,599,762,500,808,052,368,249,716,736";
-        bigDecimal = new BigDecimal(Double.MAX_VALUE).add(new BigDecimal(
-                Double.MAX_VALUE));
-        out = format.format(bigDecimal, new StringBuffer(), pos);
-        assertTrue("Wrong result BDmax2: " + out, out.toString().equals(
-                doubleMax2));
-
-        // format big decimal Double.MIN_VALUE + Double.MIN_VALUE
-        // and Double.MIN_VALUE - Double.MIN_VALUE
-        pos = new FieldPosition(0);
-
-        bigDecimal = new BigDecimal(Double.MIN_VALUE).add(new BigDecimal(
-                Double.MIN_VALUE));
-        out = format.format(bigDecimal, new StringBuffer(), pos);
-
-        bigDecimal = new BigDecimal(Float.MAX_VALUE).add(new BigDecimal(
-                Float.MAX_VALUE));
-        out = format.format(bigDecimal, new StringBuffer(), pos);
-        final String BDFloatMax2 = "680,564,693,277,057,719,623,408,366,969,033,850,880";
-        assertTrue("Wrong result BDFloatMax2: " + out, out.toString().equals(
-                BDFloatMax2));
-        // format big decimal Float.MIN_VALUE + Float.MIN_VALUE
-        // and Float.MIN_VALUE - Float.MIN_VALUE
-        bigDecimal = new BigDecimal(Float.MIN_VALUE).add(new BigDecimal(
-                Float.MIN_VALUE));
-        out = format.format(bigDecimal, new StringBuffer(), pos);
-        final String BDFloatMin2 = "0";
-
-        bigDecimal = new BigDecimal(Float.MIN_VALUE).subtract(new BigDecimal(
-                Float.MIN_VALUE));
-        out = format.format(bigDecimal, new StringBuffer(), pos);
-
-        assertTrue("Wrong result BDFloatMax2: " + out, out.toString().equals(
-                BDFloatMin2));
-
-    }
-
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setMaximumFractionDigits",
-        args = {int.class}
-    )
-    public void test_setMaximumFractionDigitsLjava_lang_Integer() {
-        NumberFormat nform = DecimalFormat.getInstance(Locale.US);
-        DecimalFormat form = (DecimalFormat) nform;
-
-        form.setMaximumFractionDigits(-2);
-        assertEquals(0, form.getMaximumFractionDigits());
-
-        form.setMaximumFractionDigits(341);
-        assertEquals(341, form.getMaximumFractionDigits());
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setMinimumFractionDigits",
-        args = {int.class}
-    )
-    public void test_setMinimumFractionDigitsLjava_lang_Integer() {
-        NumberFormat nform = DecimalFormat.getInstance(Locale.US);
-        DecimalFormat form = (DecimalFormat) nform;
-
-        form.setMinimumFractionDigits(-3);
-        assertEquals(0, form.getMinimumFractionDigits());
-
-        form.setMinimumFractionDigits(310);
-        assertEquals(310, form.getMinimumFractionDigits());
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setMaximumIntegerDigits",
-        args = {int.class}
-    )
-    public void test_setMaximumIntegerDigitsLjava_lang_Integer() {
-        NumberFormat nform = DecimalFormat.getInstance(Locale.US);
-        DecimalFormat form = (DecimalFormat) nform;
-
-        form.setMaximumIntegerDigits(-3);
-        assertEquals(0, form.getMaximumIntegerDigits());
-
-        form.setMaximumIntegerDigits(310);
-        assertEquals(310, form.getMaximumIntegerDigits());
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setMinimumIntegerDigits",
-        args = {int.class}
-    )
-    public void test_setMinimumIntegerDigitsLjava_lang_Integer() {
-        NumberFormat nform = DecimalFormat.getInstance(Locale.US);
-        DecimalFormat form = (DecimalFormat) nform;
-
-        form.setMinimumIntegerDigits(-3);
-        assertEquals(0, form.getMinimumIntegerDigits());
-
-        form.setMinimumIntegerDigits(310);
-        assertEquals(310, form.getMinimumIntegerDigits());
-    }
-
-    // When MaxFractionDigits is set first and less than MinFractionDigits, max
-    // will be changed to min value
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setMinimumFractionDigits",
-        args = {int.class}
-    )
-    public void test_setMinimumFactionDigitsLjava_lang_Integer_setMaximumFractionDigitsLjava_lang_Integer() {
-        NumberFormat nform = DecimalFormat.getInstance(Locale.US);
-        DecimalFormat form = (DecimalFormat) nform;
-
-        form.setMaximumFractionDigits(100);
-        form.setMinimumFractionDigits(200);
-
-        assertEquals(200, form.getMaximumFractionDigits());
-        assertEquals(200, form.getMinimumFractionDigits());
-
-        form.setMaximumIntegerDigits(100);
-        form.setMinimumIntegerDigits(200);
-
-        assertEquals(200, form.getMaximumIntegerDigits());
-        assertEquals(200, form.getMinimumIntegerDigits());
-    }
-
-    // When MinFractionDigits is set first and less than MaxFractionDigits, min
-    // will be changed to max value
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL,
-            notes = "When MinFractionDigits is set first and less than MaxFractionDigits, min will be changed to max value",
-            method = "setMaximumFractionDigits",
-            args = {int.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL,
-            notes = "When MinFractionDigits is set first and less than MaxFractionDigits, min will be changed to max value",
-            method = "setMinimumFractionDigits",
-            args = {int.class}
-        )
-    })
-    public void test_setMaximumFactionDigitsLjava_lang_Integer_setMinimumFractionDigitsLjava_lang_Integer() {
-        NumberFormat nform = DecimalFormat.getInstance(Locale.US);
-        DecimalFormat form = (DecimalFormat) nform;
-
-        form.setMinimumFractionDigits(200);
-        form.setMaximumFractionDigits(100);
-
-        assertEquals(100, form.getMaximumFractionDigits());
-        assertEquals(100, form.getMinimumFractionDigits());
-
-        form.setMinimumIntegerDigits(200);
-        form.setMaximumIntegerDigits(100);
-
-        assertEquals(100, form.getMaximumIntegerDigits());
-        assertEquals(100, form.getMinimumIntegerDigits());
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "equals",
-        args = {java.lang.Object.class}
-    )
-    @BrokenTest("Behaves differently between cts host and run-core-tests")
-    public void test_equalsLjava_lang_Object() {
-        DecimalFormat format = (DecimalFormat) DecimalFormat
-                .getInstance(Locale.US);
-        DecimalFormat cloned = (DecimalFormat) format.clone();
-        cloned.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US));
-        assertEquals(format, cloned);
-
-        Currency c = Currency.getInstance(Locale.US);
-        cloned.setCurrency(c);
-
-        assertEquals(format, cloned);
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setPositivePrefix",
-        args = {java.lang.String.class}
-    )
-    public void test_setPositivePrefixLjava_lang_String() {
-        DecimalFormat format = new DecimalFormat();
-        assertEquals("", format.getPositivePrefix());
-
-        format.setPositivePrefix("PosPrf");
-        assertEquals("PosPrf", format.getPositivePrefix());
-        try {
-            assertTrue(format.parse("PosPrf123.45").doubleValue() == 123.45);
-        } catch(java.text.ParseException pe) {
-            fail("ParseException was thrown.");
-        }
-
-        format.setPositivePrefix("");
-        assertEquals("", format.getPositivePrefix());
-
-        format.setPositivePrefix(null);
-        assertNull(format.getPositivePrefix());
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setPositiveSuffix",
-        args = {java.lang.String.class}
-    )
-    public void test_setPositiveSuffixLjava_lang_String() {
-        DecimalFormat format = new DecimalFormat();
-        assertEquals("", format.getPositiveSuffix());
-
-        format.setPositiveSuffix("PosSfx");
-        assertEquals("PosSfx", format.getPositiveSuffix());
-        try {
-            assertTrue(format.parse("123.45PosSfx").doubleValue() == 123.45);
-        } catch(java.text.ParseException pe) {
-            fail("ParseException was thrown.");
-        }
-
-        format.setPositiveSuffix("");
-        assertEquals("", format.getPositiveSuffix());
-
-        format.setPositiveSuffix(null);
-        assertNull(format.getPositiveSuffix());
-    }
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            notes = "",
-            method = "setNegativePrefix",
-            args = {java.lang.String.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            notes = "",
-            method = "getNegativePrefix",
-            args = {}
-        )
-    })
-    public void test_setNegativePrefixLjava_lang_String() {
-        DecimalFormat format = new DecimalFormat();
-        assertEquals("-", format.getNegativePrefix());
-
-        format.setNegativePrefix("NegPrf");
-        assertEquals("NegPrf", format.getNegativePrefix());
-        try {
-            assertTrue(format.parse("NegPrf123.45").doubleValue() == -123.45);
-        } catch(java.text.ParseException pe) {
-            fail("ParseException was thrown.");
-        }
-        format.setNegativePrefix("");
-        assertEquals("", format.getNegativePrefix());
-
-        format.setNegativePrefix(null);
-        assertNull(format.getNegativePrefix());
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setNegativeSuffix",
-        args = {java.lang.String.class}
-    )
-    public void test_setNegativeSuffixLjava_lang_String() {
-        DecimalFormat format = new DecimalFormat();
-        assertEquals("", format.getNegativeSuffix());
-
-        format.setNegativeSuffix("NegSfx");
-        assertEquals("NegSfx", format.getNegativeSuffix());
-        try {
-            assertTrue(format.parse("123.45NegPfx").doubleValue() == 123.45);
-        } catch(java.text.ParseException pe) {
-            fail("ParseException was thrown.");
-        }
-
-        format.setNegativeSuffix("");
-        assertEquals("", format.getNegativeSuffix());
-
-        format.setNegativeSuffix(null);
-        assertNull(format.getNegativeSuffix());
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#toLocalizedPattern() Test of method
-     *        java.text.DecimalFormat#toLocalizedPattern().
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "toLocalizedPattern",
-        args = {}
-    )
-    public void test_toLocalizedPattern() {
-        DecimalFormat format = new DecimalFormat();
-        format.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US));
-        try {
-            format.applyLocalizedPattern("#.#");
-            assertEquals("Wrong pattern 1", "#0.#", format.toLocalizedPattern());
-            format.applyLocalizedPattern("#.");
-            assertEquals("Wrong pattern 2", "#0.", format.toLocalizedPattern());
-            format.applyLocalizedPattern("#");
-            assertEquals("Wrong pattern 3", "#", format.toLocalizedPattern());
-            format.applyLocalizedPattern(".#");
-            assertEquals("Wrong pattern 4", "#.0", format.toLocalizedPattern());
-        } catch (Exception e) {
-            fail("Unexpected exception " + e.toString());
-        }
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#toPattern() Test of method
-     *        java.text.DecimalFormat#toPattern().
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "toPattern",
-        args = {}
-    )
-    public void test_toPattern() {
-        DecimalFormat format = new DecimalFormat();
-        try {
-            format.applyPattern("#.#");
-            assertEquals("Wrong pattern 1", "#0.#", format.toPattern());
-            format.applyPattern("#.");
-            assertEquals("Wrong pattern 2", "#0.", format.toPattern());
-            format.applyPattern("#");
-            assertEquals("Wrong pattern 3", "#", format.toPattern());
-            format.applyPattern(".#");
-            assertEquals("Wrong pattern 4", "#.0", format.toPattern());
-        } catch (Exception e) {
-            fail("Unexpected exception " + e.toString());
-        }
-    }
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setGroupingUsed",
-        args = {boolean.class}
-    )
-    public void test_setGroupingUse() {
-        DecimalFormat format = new DecimalFormat();
-
-        StringBuffer buf = new StringBuffer();
-        format.setGroupingUsed(false);
-        format.format(new Long(1970), buf, new FieldPosition(0));
-        assertEquals("1970", buf.toString());
-        assertFalse(format.isGroupingUsed());
-        format.format(new Long(1970), buf, new FieldPosition(0));
-        assertEquals("19701970", buf.toString());
-        assertFalse(format.isGroupingUsed());
-
-        format.setGroupingUsed(true);
-        format.format(new Long(1970), buf, new FieldPosition(0));
-        assertEquals("197019701,970", buf.toString());
-        assertTrue(format.isGroupingUsed());
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#DecimalFormat() Test of method
-     *        java.text.DecimalFormat#DecimalFormat().
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "DecimalFormat",
-        args = {}
-    )
-    public void test_Constructor() {
-        // Test for method java.text.DecimalFormat()
-        // the constructor form that specifies a pattern is equal to the form
-        // constructed with no pattern and applying that pattern using the
-        // applyPattern call
-        try {
-            DecimalFormat format1 = new DecimalFormat();
-            format1.applyPattern("'$'1000.0000");
-            DecimalFormat format2 = new DecimalFormat();
-            format2.applyPattern("'$'1000.0000");
-            assertTrue(
-                    "Constructed format did not match applied format object",
-                    format2.equals(format1));
-            DecimalFormat format3 = new DecimalFormat("'$'1000.0000");
-            assertTrue(
-                    "Constructed format did not match applied format object",
-                    format3.equals(format1));
-            DecimalFormat format4 = new DecimalFormat("'$'8000.0000");
-            assertTrue(
-                    "Constructed format did not match applied format object",
-                    !format4.equals(format1));
-        } catch (Exception e) {
-            fail("Unexpected exception " + e.toString());
-        }
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#DecimalFormat(java.lang.String)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "DecimalFormat",
-        args = {java.lang.String.class}
-    )
-    public void test_ConstructorLjava_lang_String() {
-        // Test for method java.text.DecimalFormat(java.lang.String)
-        // the constructor form that specifies a pattern is equal to the form
-        // constructed with no pattern and applying that pattern using the
-        // applyPattern call
-        DecimalFormat format = new DecimalFormat("'$'0000.0000");
-        DecimalFormat format1 = new DecimalFormat();
-        format1.applyPattern("'$'0000.0000");
-        assertTrue("Constructed format did not match applied format object",
-                format.equals(format1));
-
-        String [] patterns = {"####.##", "######.######", "000000.000000",
-                "######.000000", "000000.######", " ###.###", "$#####.######",
-                "$$####.######", "%#,##,###,####", "#,##0.00;(#,##0.00)"};
-
-        for(String str:patterns) {
-            new DecimalFormat(str);
-        }
-
-        try {
-            new DecimalFormat(null);
-            fail("NullPointerException wasn't thrown.");
-        } catch(NullPointerException npe){
-            //expected
-        }
-
-        String [] incPatterns = {"%#,##,###,####'", "#.##0.00"};
-        for(String str:incPatterns) {
-            try {
-                new DecimalFormat(str);
-                fail("IllegalArgumentException wasn't thrown for pattern: " + str);
-            } catch(IllegalArgumentException iae){
-                //expected
-            }
-        }
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#DecimalFormat(java.lang.String,
-     *        java.text.DecimalFormatSymbols) Test of method
-     *        java.text.DecimalFormat#DecimalFormat(java.lang.String,
-     *        java.text.DecimalFormatSymbols). Case 1: Try to construct object
-     *        using correct pattern and fromat symbols. Case 2: Try to construct
-     *        object using null arguments. Case 3: Try to construct object using
-     *        incorrect pattern.
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "DecimalFormat",
-        args = {java.lang.String.class, java.text.DecimalFormatSymbols.class}
-    )
-    public void test_ConstructorLjava_lang_StringLjava_text_DecimalFormatSymbols() {
-        try {
-            // case 1: Try to construct object using correct pattern and fromat
-            // symbols.
-            DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.CANADA);
-            DecimalFormat format1 = new DecimalFormat("'$'1000.0000", dfs);
-            DecimalFormat format2 = new DecimalFormat();
-            format2.applyPattern("'$'1000.0000");
-            format2.setDecimalFormatSymbols(dfs);
-            assertTrue(
-                    "Constructed format did not match applied format object",
-                    format2.equals(format1));
-            assertTrue(
-                    "Constructed format did not match applied format object",
-                    !format1.equals(new DecimalFormat("'$'1000.0000",
-                            new DecimalFormatSymbols(Locale.CHINA))));
-
-            // case 2: Try to construct object using null arguments.
-            try {
-                new DecimalFormat("'$'1000.0000", null);
-                fail("Expected NullPointerException was not thrown");
-            } catch (NullPointerException e) {
-                // expected
-            }
-            try {
-                new DecimalFormat(null, new DecimalFormatSymbols());
-                fail("Expected NullPointerException was not thrown");
-            } catch (NullPointerException e) {
-                // expected
-            }
-            try {
-                new DecimalFormat(null, null);
-                fail("Expected NullPointerException was not thrown");
-            } catch (NullPointerException e) {
-                // expected
-            }
-
-            // case 3: Try to construct object using incorrect pattern.
-            try {
-                new DecimalFormat("$'", new DecimalFormatSymbols());
-                fail("Expected IllegalArgumentException was not thrown");
-            } catch (IllegalArgumentException e) {
-                // expected
-            }
-        } catch (Exception e) {
-            fail("Unexpected exception " + e.toString());
-        }
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#applyLocalizedPattern(java.lang.String)
-     *        Test of method
-     *        java.text.DecimalFormat#applyLocalizedPattern(java.lang.String).
-     *        Case 1: Try to apply correct variants of pattern. Case 2: Try to
-     *        apply malformed patten. Case 3: Try to apply null patern.
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "applyLocalizedPattern",
-        args = {java.lang.String.class}
-    )
-    public void test_applyLocalizedPatternLjava_lang_String() {
-        DecimalFormat format = new DecimalFormat();
-        try {
-            // case 1: Try to apply correct variants of pattern.
-            format.applyLocalizedPattern("#.#");
-            assertEquals("Wrong pattern 1", "#0.#", format.toLocalizedPattern());
-            format.applyLocalizedPattern("#.");
-            assertEquals("Wrong pattern 2", "#0.", format.toLocalizedPattern());
-            format.applyLocalizedPattern("#");
-            assertEquals("Wrong pattern 3", "#", format.toLocalizedPattern());
-            format.applyLocalizedPattern(".#");
-            assertEquals("Wrong pattern 4", "#.0", format.toLocalizedPattern());
-
-            // case 2: Try to apply malformed patten.
-            try {
-                format.applyLocalizedPattern("'#,#:#0.0#;(#)");
-                fail("Expected IllegalArgumentException was not thrown");
-            } catch (IllegalArgumentException e) {
-                // expected
-            }
-
-            // case 3: Try to apply null patern.
-            try {
-                format.applyLocalizedPattern((String) null);
-                fail("Expected NullPointerException was not thrown");
-            } catch (NullPointerException e) {
-                // expected
-            }
-        } catch (Exception e) {
-            fail("Unexpected exception " + e.toString());
-        }
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#applyPattern(java.lang.String)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "applyPattern",
-        args = {java.lang.String.class}
-    )
-    public void test_applyPatternLjava_lang_String() {
-        DecimalFormat format = new DecimalFormat("#.#");
-        assertEquals("Wrong pattern 1", "#0.#", format.toPattern());
-        format = new DecimalFormat("#.");
-        assertEquals("Wrong pattern 2", "#0.", format.toPattern());
-        format = new DecimalFormat("#");
-        assertEquals("Wrong pattern 3", "#", format.toPattern());
-        format = new DecimalFormat(".#");
-        assertEquals("Wrong pattern 4", "#.0", format.toPattern());
-
-        DecimalFormat decFormat = new DecimalFormat("#.#");
-
-        try {
-            decFormat.applyPattern(null);
-            fail("NullPointerException was not thrown.");
-        } catch(NullPointerException npe) {
-            //expected
-        }
-
-        String [] incPatterns = {"%#,##,###,####'", "#.##0.00"};
-        for(String str:incPatterns) {
-            try {
-                decFormat.applyPattern(str);
-                fail("IllegalArgumentException was not thrown for pattern: " +
-                        str);
-            } catch(IllegalArgumentException  iae) {
-                //expected
-            }
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "applyPattern",
-        args = {java.lang.String.class}
-    )
-    @AndroidOnly("icu supports 2 grouping sizes.")
-    public void test_applyPatternLjava_lang_String2() {
-        DecimalFormat decFormat = new DecimalFormat("#.#");
-        String [] patterns = {"####.##", "######.######", "000000.000000",
-                "######.000000", "000000.######", " ###.###", "$#####.######",
-                "$$####.######", "%#,##,###,####", "#,##0.00;(#,##0.00)",
-                 "##.##-E"};
-
-        String [] expResult = {"#0.##", "#0.######", "#000000.000000",
-                "#.000000", "#000000.######", " #0.###", "$#0.######",
-                "$$#0.######",
-                "%#,###,####", // icu only. icu supports two grouping sizes
-                "#,##0.00;(#,##0.00)",
-                "#0.##-'E'"}; // icu only. E in the suffix does not need to be
-                              // quoted. This is done automatically.
-
-        for (int i = 0; i < patterns.length; i++) {
-            decFormat.applyPattern(patterns[i]);
-            String result = decFormat.toPattern();
-            assertEquals("Failed to apply following pattern: " + patterns[i] +
-                    " expected: " + expResult[i] + " returned: " + result,
-                    expResult[i], result);
-        }
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#clone()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "clone",
-        args = {}
-    )
-    public void test_clone() {
-        DecimalFormat format = (DecimalFormat) DecimalFormat
-                .getInstance(Locale.US);
-        DecimalFormat cloned = (DecimalFormat) format.clone();
-        assertEquals(cloned.getDecimalFormatSymbols(), format
-                .getDecimalFormatSymbols());
-
-        format = new DecimalFormat("'$'0000.0000");
-        DecimalFormat format1 = (DecimalFormat) (format.clone());
-        // make sure the objects are equal
-        assertTrue("Object's clone isn't equal!", format.equals(format1));
-        // change the content of the clone and make sure it's not equal anymore
-        // verifies that it's data is now distinct from the original
-        format1.applyPattern("'$'0000.####");
-        assertTrue("Object's changed clone should not be equal!", !format
-                .equals(format1));
-    }
-
-    private void compare(String testName, String format, String expected) {
-        assertTrue(testName + " got: " + format + " expected: " + expected,
-                format.equals(expected));
-    }
-
-    private boolean compare(int count, String format, String expected) {
-        boolean result = format.equals(expected);
-        if (!result)
-            System.out.println("Failure test: " + count + " got: " + format
-                    + " expected: " + expected);
-        return result;
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#format(double, java.lang.StringBuffer,
-     *        java.text.FieldPosition)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "format",
-        args = {double.class, java.lang.StringBuffer.class, java.text.FieldPosition.class}
-    )
-    public void test_formatDLjava_lang_StringBufferLjava_text_FieldPosition() {
-        new Support_DecimalFormat(
-                "test_formatDLjava_lang_StringBufferLjava_text_FieldPosition")
-                .t_format_with_FieldPosition();
-
-        int failCount = 0;
-        BitSet failures = new BitSet();
-
-        final DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.US);
-
-        DecimalFormat df = new DecimalFormat("00.0#E0", dfs);
-        compare("00.0#E0: 0.0", df.format(0.0), "00.0E0");
-        compare("00.0#E0: 1.0", df.format(1.0), "10.0E-1");
-        compare("00.0#E0: 12.0", df.format(12.0), "12.0E0");
-        compare("00.0#E0: 123.0", df.format(123.0), "12.3E1");
-        compare("00.0#E0: 1234.0", df.format(1234.0), "12.34E2");
-        compare("00.0#E0: 12346.0", df.format(12346.0), "12.35E3");
-        compare("00.0#E0: 99999.0", df.format(99999.0), "10.0E4");
-        compare("00.0#E0: 1.2", df.format(1.2), "12.0E-1");
-        compare("00.0#E0: 12.3", df.format(12.3), "12.3E0");
-        compare("00.0#E0: 123.4", df.format(123.4), "12.34E1");
-        compare("00.0#E0: 1234.6", df.format(1234.6), "12.35E2");
-        compare("00.0#E0: 9999.9", df.format(9999.9), "10.0E3");
-        compare("00.0#E0: 0.1", df.format(0.1), "10.0E-2");
-        compare("00.0#E0: 0.12", df.format(0.12), "12.0E-2");
-        compare("00.0#E0: 0.123", df.format(0.123), "12.3E-2");
-        compare("00.0#E0: 0.1234", df.format(0.1234), "12.34E-2");
-        compare("00.0#E0: 0.12346", df.format(0.12346), "12.35E-2");
-        compare("00.0#E0: 0.99999", df.format(0.99999), "10.0E-1");
-        compare("00.0#E0: -0.0", df.format(-0.0), "-00.0E0");
-        compare("00.0#E0: -1.0", df.format(-1.0), "-10.0E-1");
-        compare("00.0#E0: -12.0", df.format(-12.0), "-12.0E0");
-        compare("00.0#E0: -123.0", df.format(-123.0), "-12.3E1");
-        compare("00.0#E0: -1234.0", df.format(-1234.0), "-12.34E2");
-        compare("00.0#E0: -12346.0", df.format(-12346.0), "-12.35E3");
-        compare("00.0#E0: -99999.0", df.format(-99999.0), "-10.0E4");
-
-        df = new DecimalFormat("##0.0E0", dfs);
-        compare("##0.0E0: -0.0", df.format(-0.0), "-0.0E0");
-        compare("##0.0E0: 0.0", df.format(0.0), "0.0E0");
-        compare("##0.0E0: 1.0", df.format(1.0), "1.0E0");
-        compare("##0.0E0: 12.0", df.format(12.0), "12E0");
-        compare("##0.0E0: 123.0", df.format(123.0), "123E0");  // Android fails, here!
-        compare("##0.0E0: 1234.0", df.format(1234.0), "1.234E3");
-        compare("##0.0E0: 12346.0", df.format(12346.0), "12.35E3");
-        // Fails in JDK 1.2.2
-        if (!compare(failCount, df.format(99999.0), "100E3"))
-            failures.set(failCount);
-        failCount++;
-        compare("##0.0E0: 999999.0", df.format(999999.0), "1.0E6");
-
-        df = new DecimalFormat("#00.0##E0", dfs);
-        compare("#00.0##E0: 0.1", df.format(0.1), "100E-3");
-        compare("#00.0##E0: 0.12", df.format(0.12), "120E-3");
-        compare("#00.0##E0: 0.123", df.format(0.123), "123E-3");
-        compare("#00.0##E0: 0.1234", df.format(0.1234), "123.4E-3");
-        compare("#00.0##E0: 0.1234567", df.format(0.1234567), "123.457E-3");
-        compare("#00.0##E0: 0.01", df.format(0.01), "10.0E-3");
-        compare("#00.0##E0: 0.012", df.format(0.012), "12.0E-3");
-        compare("#00.0##E0: 0.0123", df.format(0.0123), "12.3E-3");
-        compare("#00.0##E0: 0.01234", df.format(0.01234), "12.34E-3");
-        compare("#00.0##E0: 0.01234567", df.format(0.01234567), "12.3457E-3");
-        compare("#00.0##E0: 0.001", df.format(0.001), "1.00E-3");
-        compare("#00.0##E0: 0.0012", df.format(0.0012), "1.20E-3");
-        compare("#00.0##E0: 0.00123", df.format(0.00123), "1.23E-3");
-        compare("#00.0##E0: 0.001234", df.format(0.001234), "1.234E-3");
-        compare("#00.0##E0: 0.001234567", df.format(0.001234567), "1.23457E-3");
-        compare("#00.0##E0: 0.0001", df.format(0.0001), "100E-6");
-        compare("#00.0##E0: 0.00012", df.format(0.00012), "120E-6");
-        compare("#00.0##E0: 0.000123", df.format(0.000123), "123E-6");
-        compare("#00.0##E0: 0.0001234", df.format(0.0001234), "123.4E-6");
-        compare("#00.0##E0: 0.0001234567", df.format(0.0001234567),
-                "123.457E-6");
-
-        // Fails in JDK 1.2.2
-        if (!compare(failCount, df.format(0.0), "0.00E0"))
-            failures.set(failCount);
-        failCount++;
-        compare("#00.0##E0: 1.0", df.format(1.0), "1.00E0");
-        compare("#00.0##E0: 12.0", df.format(12.0), "12.0E0");
-        compare("#00.0##E0: 123.0", df.format(123.0), "123E0");
-        compare("#00.0##E0: 1234.0", df.format(1234.0), "1.234E3");
-        compare("#00.0##E0: 12345.0", df.format(12345.0), "12.345E3");
-        compare("#00.0##E0: 123456.0", df.format(123456.0), "123.456E3");
-        compare("#00.0##E0: 1234567.0", df.format(1234567.0), "1.23457E6");
-        compare("#00.0##E0: 12345678.0", df.format(12345678.0), "12.3457E6");
-        compare("#00.0##E0: 99999999.0", df.format(99999999.0), "100E6");
-
-        df = new DecimalFormat("#.0E0", dfs);
-        compare("#.0E0: -0.0", df.format(-0.0), "-.0E0");
-        compare("#.0E0: 0.0", df.format(0.0), ".0E0");
-        compare("#.0E0: 1.0", df.format(1.0), ".1E1");
-        compare("#.0E0: 12.0", df.format(12.0), ".12E2");
-        compare("#.0E0: 123.0", df.format(123.0), ".12E3");
-        compare("#.0E0: 1234.0", df.format(1234.0), ".12E4");
-        compare("#.0E0: 9999.0", df.format(9999.0), ".1E5");
-
-        df = new DecimalFormat("0.#E0", dfs);
-        compare("0.#E0: -0.0", df.format(-0.0), "-0E0");
-        compare("0.#E0: 0.0", df.format(0.0), "0E0");
-        compare("0.#E0: 1.0", df.format(1.0), "1E0");
-        compare("0.#E0: 12.0", df.format(12.0), "1.2E1");
-        compare("0.#E0: 123.0", df.format(123.0), "1.2E2");
-        compare("0.#E0: 1234.0", df.format(1234.0), "1.2E3");
-        compare("0.#E0: 9999.0", df.format(9999.0), "1E4");
-
-        df = new DecimalFormat(".0E0", dfs);
-        compare(".0E0: -0.0", df.format(-0.0), "-.0E0");
-        compare(".0E0: 0.0", df.format(0.0), ".0E0");
-        compare(".0E0: 1.0", df.format(1.0), ".1E1");
-        compare(".0E0: 12.0", df.format(12.0), ".1E2");
-        compare(".0E0: 123.0", df.format(123.0), ".1E3");
-        compare(".0E0: 1234.0", df.format(1234.0), ".1E4");
-        compare(".0E0: 9999.0", df.format(9999.0), ".1E5");
-
-        df = new DecimalFormat("0.E0", dfs);
-        // Fails in JDK 1.2.2
-        if (!compare(failCount, df.format(0.0), "0.E0"))
-            failures.set(failCount);
-        failCount++;
-        if (!compare(failCount, df.format(1.0), "1.E0"))
-            failures.set(failCount);
-        failCount++;
-        if (!compare(failCount, df.format(12.0), "1.E1"))
-            failures.set(failCount);
-        failCount++;
-        if (!compare(failCount, df.format(123.0), "1.E2"))
-            failures.set(failCount);
-        failCount++;
-        if (!compare(failCount, df.format(1234.0), "1.E3"))
-            failures.set(failCount);
-        failCount++;
-        if (!compare(failCount, df.format(9999.0), "1.E4"))
-            failures.set(failCount);
-        failCount++;
-
-        df = new DecimalFormat("##0.00#E0", dfs);
-        compare("##0.00#E0: 0.1", df.format(0.1), "100E-3");
-        compare("##0.00#E0: 0.1234567", df.format(0.1234567), "123.457E-3");
-        compare("##0.00#E0: 0.9999999", df.format(0.9999999), "1.00E0");
-        compare("##0.00#E0: 0.01", df.format(0.01), "10.0E-3");
-        compare("##0.00#E0: 0.01234567", df.format(0.01234567), "12.3457E-3");
-        compare("##0.00#E0: 0.09999999", df.format(0.09999999), "100E-3");
-        compare("##0.00#E0: 0.001", df.format(0.001), "1.00E-3");
-        compare("##0.00#E0: 0.001234567", df.format(0.001234567), "1.23457E-3");
-        compare("##0.00#E0: 0.009999999", df.format(0.009999999), "10.0E-3");
-        compare("##0.00#E0: 0.0001", df.format(0.0001), "100E-6");
-        compare("##0.00#E0: 0.0001234567", df.format(0.0001234567),
-                "123.457E-6");
-        compare("##0.00#E0: 0.0009999999", df.format(0.0009999999), "1.00E-3");
-
-        df = new DecimalFormat("###0.00#E0", dfs);
-        compare("###0.00#E0: 0.1", df.format(0.1), "1000E-4");
-        compare("###0.00#E0: 0.12345678", df.format(0.12345678), "1234.568E-4");
-        compare("###0.00#E0: 0.99999999", df.format(0.99999999), "1.00E0");
-        compare("###0.00#E0: 0.01", df.format(0.01), "100E-4");
-        compare("###0.00#E0: 0.012345678", df.format(0.012345678),
-                "123.4568E-4");
-        compare("###0.00#E0: 0.099999999", df.format(0.099999999), "1000E-4");
-        compare("###0.00#E0: 0.001", df.format(0.001), "10.0E-4");
-        compare("###0.00#E0: 0.0012345678", df.format(0.0012345678),
-                "12.34568E-4");
-        compare("###0.00#E0: 0.0099999999", df.format(0.0099999999), "100E-4");
-        compare("###0.00#E0: 0.0001", df.format(0.0001), "1.00E-4");
-        compare("###0.00#E0: 0.00012345678", df.format(0.00012345678),
-                "1.234568E-4");
-        compare("###0.00#E0: 0.00099999999", df.format(0.00099999999),
-                "10.0E-4");
-        // Fails in JDK 1.2.2
-        if (!compare(failCount, df.format(0.00001), "1000E-8"))
-            failures.set(failCount);
-        failCount++;
-        compare("###0.00#E0: 0.000012345678", df.format(0.000012345678),
-                "1234.568E-8");
-        compare("###0.00#E0: 0.000099999999", df.format(0.000099999999),
-                "1.00E-4");
-
-        df = new DecimalFormat("###0.0#E0", dfs);
-        compare("###0.0#E0: 0.1", df.format(0.1), "1000E-4");
-        compare("###0.0#E0: 0.1234567", df.format(0.1234567), "1234.57E-4");
-        compare("###0.0#E0: 0.9999999", df.format(0.9999999), "1.0E0");
-        // Fails in JDK 1.2.2
-        if (!compare(failCount, df.format(0.01), "100E-4"))
-            failures.set(failCount);
-        failCount++;
-        compare("###0.0#E0: 0.01234567", df.format(0.01234567), "123.457E-4");
-        compare("###0.0#E0: 0.09999999", df.format(0.09999999), "1000E-4");
-        compare("###0.0#E0: 0.001", df.format(0.001), "10E-4");
-        compare("###0.0#E0: 0.001234567", df.format(0.001234567), "12.3457E-4");
-        // Fails in JDK 1.2.2
-        if (!compare(failCount, df.format(0.009999999), "100E-4"))
-            failures.set(failCount);
-        failCount++;
-        compare("###0.0#E0: 0.0001", df.format(0.0001), "1.0E-4");
-        compare("###0.0#E0: 0.0001234567", df.format(0.0001234567),
-                "1.23457E-4");
-        compare("###0.0#E0: 0.0009999999", df.format(0.0009999999), "10E-4");
-        // Fails in JDK 1.2.2
-        if (!compare(failCount, df.format(0.00001), "1000E-8"))
-            failures.set(failCount);
-        failCount++;
-        compare("###0.0#E0: 0.00001234567", df.format(0.00001234567),
-                "1234.57E-8");
-        compare("###0.0#E0: 0.00009999999", df.format(0.00009999999), "1.0E-4");
-
-        assertTrue("Failed " + failures + " of " + failCount,
-                failures.length() == 0);
-
-        String formatString = "##0.#";
-        df = new DecimalFormat(formatString, dfs);
-        df.setMinimumFractionDigits(30);
-        compare(formatString + ": 0.000000000000000000000000000000", df
-                .format(0.0), "0.000000000000000000000000000000");
-        compare(formatString + ": -0.000000000000000000000000000000", df
-                .format(-0.0), "-0.000000000000000000000000000000");
-        compare(formatString + ": 1.000000000000000000000000000000", df
-                .format(1.0), "1.000000000000000000000000000000");
-        compare(formatString + ": -1.000000000000000000000000000000", df
-                .format(-1.0), "-1.000000000000000000000000000000");
-
-        df = new DecimalFormat(formatString);
-        df.setMaximumFractionDigits(30);
-        compare(formatString + ": 0", df.format(0.0), "0");
-        compare(formatString + ": -0", df.format(-0.0), "-0");
-        compare(formatString + ": 1", df.format(1.0), "1");
-        compare(formatString + ": -1", df.format(-1.0), "-1");
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#format(long, java.lang.StringBuffer,
-     *        java.text.FieldPosition)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "format",
-        args = {long.class, java.lang.StringBuffer.class, java.text.FieldPosition.class}
-    )
-    public void test_formatJLjava_lang_StringBufferLjava_text_FieldPosition() {
-        int failCount = 0;
-        BitSet failures = new BitSet();
-
-        final DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.US);
-
-        DecimalFormat df = new DecimalFormat("00.0#E0", dfs);
-        assertEquals("00.0#E0: 0", "00.0E0", df.format(0));
-        assertEquals("00.0#E0: 1", "10.0E-1", df.format(1));
-        assertEquals("00.0#E0: 12", "12.0E0", df.format(12));
-        assertEquals("00.0#E0: 123", "12.3E1", df.format(123));
-        assertEquals("00.0#E0: 1234", "12.34E2", df.format(1234));
-        assertEquals("00.0#E0: 12346", "12.35E3", df.format(12346));
-        assertEquals("00.0#E0: 99999", "10.0E4", df.format(99999));
-        assertEquals("00.0#E0: -1", "-10.0E-1", df.format(-1));
-        assertEquals("00.0#E0: -12", "-12.0E0", df.format(-12));
-        assertEquals("00.0#E0: -123", "-12.3E1", df.format(-123));
-        assertEquals("00.0#E0: -1234", "-12.34E2", df.format(-1234));
-        assertEquals("00.0#E0: -12346", "-12.35E3", df.format(-12346));
-        assertEquals("00.0#E0: -99999", "-10.0E4", df.format(-99999));
-
-        df = new DecimalFormat("##0.0E0", dfs);
-        assertEquals("##0.0E0: 0", "0.0E0", df.format(0));
-        assertEquals("##0.0E0: 1", "1.0E0", df.format(1));
-        assertEquals("##0.0E0: 12", "12E0", df.format(12));
-        assertEquals("##0.0E0: 123", "123E0", df.format(123));  // Android fails, here!
-        assertEquals("##0.0E0: 1234", "1.234E3", df.format(1234));
-        assertEquals("##0.0E0: 12346", "12.35E3", df.format(12346));
-        // Fails in JDK 1.2.2
-        if (!df.format(99999).equals("100E3"))
-            failures.set(failCount);
-        failCount++;
-        assertEquals("##0.0E0: 999999", "1.0E6", df.format(999999));
-
-        df = new DecimalFormat("#00.0##E0", dfs);
-        // Fails in JDK 1.2.2
-        if (!df.format(0).equals("0.00E0"))
-            failures.set(failCount);
-        failCount++;
-        assertEquals("#00.0##E0: 1", "1.00E0", df.format(1));
-        assertEquals("#00.0##E0: 12", "12.0E0", df.format(12));
-        assertEquals("#00.0##E0: 123", "123E0", df.format(123));
-        assertEquals("#00.0##E0: 1234", "1.234E3", df.format(1234));
-        assertEquals("#00.0##E0: 12345", "12.345E3", df.format(12345));
-        assertEquals("#00.0##E0: 123456", "123.456E3", df.format(123456));
-        assertEquals("#00.0##E0: 1234567", "1.23457E6", df.format(1234567));
-        assertEquals("#00.0##E0: 12345678", "12.3457E6", df.format(12345678));
-        assertEquals("#00.0##E0: 99999999", "100E6", df.format(99999999));
-
-        df = new DecimalFormat("#.0E0", dfs);
-        assertEquals("#.0E0: 0", ".0E0", df.format(0));
-        assertEquals("#.0E0: 1", ".1E1", df.format(1));
-        assertEquals("#.0E0: 12", ".12E2", df.format(12));
-        assertEquals("#.0E0: 123", ".12E3", df.format(123));
-        assertEquals("#.0E0: 1234", ".12E4", df.format(1234));
-        assertEquals("#.0E0: 9999", ".1E5", df.format(9999));
-
-        df = new DecimalFormat("0.#E0", dfs);
-        assertEquals("0.#E0: 0", "0E0", df.format(0));
-        assertEquals("0.#E0: 1", "1E0", df.format(1));
-        assertEquals("0.#E0: 12", "1.2E1", df.format(12));
-        assertEquals("0.#E0: 123", "1.2E2", df.format(123));
-        assertEquals("0.#E0: 1234", "1.2E3", df.format(1234));
-        assertEquals("0.#E0: 9999", "1E4", df.format(9999));
-
-        assertTrue("Failed " + failures + " of " + failCount,
-                failures.length() == 0);
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#formatToCharacterIterator(java.lang.Object)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "formatToCharacterIterator",
-        args = {java.lang.Object.class}
-    )
-    @KnownFailure("Fails in CTS but passes under run-core-tests")
-    public void test_formatToCharacterIteratorLjava_lang_Object() {
-        try {
-            // Regression for HARMONY-466
-            new DecimalFormat().formatToCharacterIterator(null);
-            fail("NullPointerException expected");
-        } catch (NullPointerException e) {
-            // expected
-        }
-
-        new Support_DecimalFormat(
-                "test_formatToCharacterIteratorLjava_lang_Object")
-                .t_formatToCharacterIterator();
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#format(double)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "format",
-        args = {double.class}
-    )
-    public void test_formatD() {
-        DecimalFormat format = (DecimalFormat) NumberFormat
-                .getInstance(Locale.ENGLISH);
-        format.setGroupingUsed(false);
-        format.setMaximumFractionDigits(400);
-
-        for (int i = 0; i < 309; i++) {
-            String tval = "1";
-            for (int j = 0; j < i; j++)
-                tval += "0";
-            double d = Double.parseDouble(tval);
-            String result = format.format(d);
-            assertEquals(i + ") e:" + tval + " r:" + result, tval, result);
-        }
-
-        for (int i = 0; i < 322; i++) {
-            String tval = "0.";
-            for (int j = 0; j < i; j++)
-                tval += "0";
-            tval += "1";
-            double d = Double.parseDouble(tval);
-            String result = format.format(d);
-            assertEquals(i + ") e:" + tval + " r:" + result, tval, result);
-        }
-        assertEquals("123456789012345", format.format(123456789012345.));
-        assertEquals("1", "12345678901234.5", format.format(12345678901234.5));
-        assertEquals("2", "1234567890123.25", format.format(1234567890123.25));
-        assertEquals("3", "999999999999.375", format.format(999999999999.375));
-        assertEquals("4", "99999999999.0625", format.format(99999999999.0625));
-        assertEquals("5", "9999999999.03125", format.format(9999999999.03125));
-        assertEquals("6", "999999999.015625", format.format(999999999.015625));
-        assertEquals("7", "99999999.0078125", format.format(99999999.0078125));
-        assertEquals("8", "9999999.00390625", format.format(9999999.00390625));
-        assertEquals("9", "999999.001953125", format.format(999999.001953125));
-        assertEquals("10", "9999.00048828125", format.format(9999.00048828125));
-        assertEquals("11", "999.000244140625", format.format(999.000244140625));
-        assertEquals("12", "99.0001220703125", format.format(99.0001220703125));
-        assertEquals("13", "9.00006103515625", format.format(9.00006103515625));
-        assertEquals("14", "0.000030517578125", format.format(0.000030517578125));
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#getDecimalFormatSymbols()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getDecimalFormatSymbols",
-        args = {}
-    )
-    public void test_getDecimalFormatSymbols() {
-        DecimalFormat df = (DecimalFormat) NumberFormat
-                .getInstance(Locale.ENGLISH);
-        DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();
-        assertTrue("Identical symbols", dfs != df.getDecimalFormatSymbols());
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#getCurrency()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getCurrency",
-        args = {}
-    )
-    public void test_getCurrency() {
-        Currency currK = Currency.getInstance("KRW");
-        Currency currX = Currency.getInstance("XXX");
-        Currency currE = Currency.getInstance("EUR");
-        Currency curr01;
-
-        DecimalFormat df = (DecimalFormat) NumberFormat
-                .getCurrencyInstance(new Locale("ko", "KR"));
-        assertTrue("Test1: Returned incorrect currency",
-                df.getCurrency() == currK);
-
-        df = (DecimalFormat) NumberFormat.getCurrencyInstance(new Locale("",
-                "KR"));
-        assertTrue("Test2: Returned incorrect currency",
-                df.getCurrency() == currK);
-
-        df = (DecimalFormat) NumberFormat.getCurrencyInstance(new Locale("ko",
-                ""));
-        assertTrue("Test3: Returned incorrect currency",
-                df.getCurrency() == currX);
-
-        df = (DecimalFormat) NumberFormat.getCurrencyInstance(new Locale("fr",
-                "FR"));
-        assertTrue("Test4: Returned incorrect currency",
-                df.getCurrency() == currE);
-
-        // Regression for HARMONY-1351
-        df = (DecimalFormat) NumberFormat.getCurrencyInstance(new Locale(
-                "QWERTY"));
-        assertTrue("Test5: Returned incorrect currency",
-                df.getCurrency() == currX);
-
-        // JDK fails these tests since it doesn't have the PREEURO variant
-        // df = (DecimalFormat)NumberFormat.getCurrencyInstance(new Locale("fr",
-        // "FR","PREEURO"));
-        // assertTrue("Test5: Returned incorrect currency", df.getCurrency() ==
-        // currF);
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#getGroupingSize()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getGroupingSize",
-        args = {}
-    )
-    public void test_getGroupingSize() {
-        DecimalFormat df = new DecimalFormat("###0.##");
-        assertEquals("Wrong unset size", 0, df.getGroupingSize());
-        df = new DecimalFormat("#,##0.##");
-        assertEquals("Wrong set size", 3, df.getGroupingSize());
-        df = new DecimalFormat("#,###,###0.##");
-        assertEquals("Wrong multiple set size", 4, df.getGroupingSize());
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#getMultiplier()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getMultiplier",
-        args = {}
-    )
-    public void test_getMultiplier() {
-        final int defaultMultiplier = 1;
-        NumberFormat nform = DecimalFormat.getInstance(Locale.US);
-        DecimalFormat form = (DecimalFormat) nform;
-        assertEquals(defaultMultiplier, form.getMultiplier());
-
-        DecimalFormat df = new DecimalFormat("###0.##");
-        assertEquals("Wrong unset multiplier", 1, df.getMultiplier());
-        df = new DecimalFormat("###0.##%");
-        assertEquals("Wrong percent multiplier", 100, df.getMultiplier());
-        df = new DecimalFormat("###0.##\u2030");
-        assertEquals("Wrong mille multiplier", 1000, df.getMultiplier());
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#getNegativePrefix() Test of method
-     *        java.text.DecimalFormat#getNegativePrefix().
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            notes = "",
-            method = "getNegativePrefix",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            notes = "",
-            method = "setNegativePrefix",
-            args = {java.lang.String.class}
-        )
-    })
-    public void test_getNegativePrefix() {
-        DecimalFormat df = new DecimalFormat();
-        try {
-            df.setNegativePrefix("--");
-            assertTrue("Incorrect negative prefix", df.getNegativePrefix()
-                    .equals("--"));
-        } catch (Exception e) {
-            fail("Unexpected exception " + e.toString());
-        }
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#getNegativeSuffix() Test of method
-     *        java.text.DecimalFormat#getNegativeSuffix().
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getNegativeSuffix",
-        args = {}
-    )
-    public void test_getNegativeSuffix() {
-        DecimalFormat df = new DecimalFormat();
-        try {
-            df.setNegativeSuffix("&");
-            assertTrue("Incorrect negative suffix", df.getNegativeSuffix()
-                    .equals("&"));
-        } catch (Exception e) {
-            fail("Unexpected exception " + e.toString());
-        }
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#getPositivePrefix() Test of method
-     *        java.text.DecimalFormat#getPositivePrefix().
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getPositivePrefix",
-        args = {}
-    )
-    public void test_getPositivePrefix() {
-        DecimalFormat df = new DecimalFormat();
-        try {
-            df.setPositivePrefix("++");
-            assertTrue("Incorrect positive prefix", df.getPositivePrefix()
-                    .equals("++"));
-        } catch (Exception e) {
-            fail("Unexpected exception " + e.toString());
-        }
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#getPositiveSuffix() Test of method
-     *        java.text.DecimalFormat#getPositiveSuffix().
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getPositiveSuffix",
-        args = {}
-    )
-    public void test_getPositiveSuffix() {
-        DecimalFormat df = new DecimalFormat();
-        try {
-            df.setPositiveSuffix("%");
-            assertTrue("Incorrect positive prefix", df.getPositiveSuffix()
-                    .equals("%"));
-        } catch (Exception e) {
-            fail("Unexpected exception " + e.toString());
-        }
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#hashCode() Test of method
-     *        java.text.DecimalFormat#hashCode().
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "hashCode",
-        args = {}
-    )
-    public void test_hashCode() {
-        try {
-            DecimalFormat df1 = new DecimalFormat();
-            DecimalFormat df2 = (DecimalFormat) df1.clone();
-            assertTrue("Hash codes of equals object are not equal", df2
-                    .hashCode() == df1.hashCode());
-        } catch (Exception e) {
-            fail("Unexpected exception " + e.toString());
-        }
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#isDecimalSeparatorAlwaysShown()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isDecimalSeparatorAlwaysShown",
-        args = {}
-    )
-    public void test_isDecimalSeparatorAlwaysShown() {
-        DecimalFormat df = new DecimalFormat("###0.##");
-        assertTrue("Wrong unset value", !df.isDecimalSeparatorAlwaysShown());
-        df = new DecimalFormat("###0.00");
-        assertTrue("Wrong unset2 value", !df.isDecimalSeparatorAlwaysShown());
-        df = new DecimalFormat("###0.");
-        assertTrue("Wrong set value", df.isDecimalSeparatorAlwaysShown());
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#parse(java.lang.String,
-     *        java.text.ParsePosition)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL,
-        notes = "Vrifies boundary values.",
-        method = "parse",
-        args = {java.lang.String.class, java.text.ParsePosition.class}
-    )
-    public void test_parseLjava_lang_StringLjava_text_ParsePosition() {
-        DecimalFormat format = (DecimalFormat) NumberFormat
-                .getNumberInstance(Locale.ENGLISH);
-        ParsePosition pos = new ParsePosition(0);
-        Number result = format.parse("9223372036854775807", pos);
-        assertTrue("Wrong result type for Long.MAX_VALUE",
-                result.getClass() == Long.class);
-        assertEquals("Wrong result Long.MAX_VALUE",
-                Long.MAX_VALUE, result.longValue());
-        pos = new ParsePosition(0);
-        result = format.parse("-9223372036854775808", pos);
-        assertTrue("Wrong result type for Long.MIN_VALUE",
-                result.getClass() == Long.class);
-        assertTrue("Wrong result Long.MIN_VALUE: " + result.longValue(), result
-                .longValue() == Long.MIN_VALUE);
-        pos = new ParsePosition(0);
-        result = format.parse("9223372036854775808", pos);
-        assertTrue("Wrong result type for Long.MAX_VALUE+1",
-                result.getClass() == Double.class);
-        assertEquals("Wrong result Long.MAX_VALUE + 1",
-                (double) Long.MAX_VALUE + 1, result.doubleValue());
-        pos = new ParsePosition(0);
-        result = format.parse("-9223372036854775809", pos);
-        assertTrue("Wrong result type for Long.MIN_VALUE - 1",
-                result.getClass() == Double.class);
-        assertEquals("Wrong result Long.MIN_VALUE - 1",
-                (double) Long.MIN_VALUE - 1, result.doubleValue());
-
-        pos = new ParsePosition(0);
-        result = format.parse("18446744073709551629", pos);
-        assertTrue("Wrong result type for overflow",
-                result.getClass() == Double.class);
-        assertEquals("Wrong result for overflow",
-                18446744073709551629d, result.doubleValue());
-
-        pos = new ParsePosition(0);
-        result = format.parse("42325917317067571199", pos);
-        assertTrue("Wrong result type for overflow a: " + result, result
-                .getClass() == Double.class);
-        assertTrue("Wrong result for overflow a: " + result, result
-                .doubleValue() == 42325917317067571199d);
-        pos = new ParsePosition(0);
-        result = format.parse("4232591731706757119E1", pos);
-        assertTrue("Wrong result type for overflow b: " + result, result
-                .getClass() == Double.class);
-        assertEquals("Wrong result for overflow b: " + result,
-                42325917317067571190d, result.doubleValue());
-        pos = new ParsePosition(0);
-        result = format.parse(".42325917317067571199E20", pos);
-        assertTrue("Wrong result type for overflow c: " + result, result
-                .getClass() == Double.class);
-        assertTrue("Wrong result for overflow c: " + result, result
-                .doubleValue() == 42325917317067571199d);
-        pos = new ParsePosition(0);
-        result = format.parse("922337203685477580.9E1", pos);
-        assertTrue("Wrong result type for overflow d: " + result, result
-                .getClass() == Double.class);
-        assertTrue("Wrong result for overflow d: " + result, result
-                .doubleValue() == 9223372036854775809d);
-        pos = new ParsePosition(0);
-        result = format.parse("9.223372036854775809E18", pos);
-        assertTrue("Wrong result type for overflow e: " + result, result
-                .getClass() == Double.class);
-        assertTrue("Wrong result for overflow e: " + result, result
-                .doubleValue() == 9223372036854775809d);
-
-        // test parse with multipliers
-        format.setMultiplier(100);
-        result = format.parse("9223372036854775807", new ParsePosition(0));
-        assertTrue("Wrong result type multiplier 100: " + result, result
-                .getClass() == Long.class);
-        // RI on windows and linux both answer with a slightly rounded result
-        assertTrue("Wrong result for multiplier 100: " + result, result
-                .longValue() == 92233720368547760L);
-        format.setMultiplier(1000);
-        result = format.parse("9223372036854775807", new ParsePosition(0));
-        assertTrue("Wrong result type multiplier 1000: " + result, result
-                .getClass() == Long.class);
-        assertTrue("Wrong result for multiplier 1000: " + result, result
-                .longValue() == 9223372036854776L);
-
-        format.setMultiplier(10000);
-        result = format.parse("9223372036854775807", new ParsePosition(0));
-        assertTrue("Wrong result type multiplier 10000: " + result, result
-                .getClass() == Double.class);
-        assertTrue("Wrong result for multiplier 10000: " + result, result
-                .doubleValue() == 922337203685477.5807d);
-
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#setDecimalFormatSymbols(java.text.DecimalFormatSymbols)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setDecimalFormatSymbols",
-        args = {java.text.DecimalFormatSymbols.class}
-    )
-    public void test_setDecimalFormatSymbolsLjava_text_DecimalFormatSymbols() {
-        DecimalFormat df = new DecimalFormat("###0.##");
-        DecimalFormatSymbols dfs = new DecimalFormatSymbols();
-        dfs.setDecimalSeparator('@');
-        df.setDecimalFormatSymbols(dfs);
-        assertTrue("Not set", df.getDecimalFormatSymbols().equals(dfs));
-        assertEquals("Symbols not used", "1@2", df.format(1.2));
-
-        // The returned symbols may be cloned in two spots
-        // 1. When set
-        // 2. When returned
-        DecimalFormat format = new DecimalFormat();
-        DecimalFormatSymbols symbols = new DecimalFormatSymbols();
-        format.setDecimalFormatSymbols(symbols);
-        DecimalFormatSymbols symbolsOut = format.getDecimalFormatSymbols();
-        assertNotSame(symbols, symbolsOut);
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#setDecimalSeparatorAlwaysShown(boolean)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setDecimalSeparatorAlwaysShown",
-        args = {boolean.class}
-    )
-    public void test_setDecimalSeparatorAlwaysShownZ() {
-        DecimalFormat df = new DecimalFormat("###0.##",
-                new DecimalFormatSymbols(Locale.US));
-        assertEquals("Wrong default result", "5", df.format(5));
-        df.setDecimalSeparatorAlwaysShown(true);
-        assertTrue("Not set", df.isDecimalSeparatorAlwaysShown());
-        assertEquals("Wrong set result", "7.", df.format(7));
-
-        df.setDecimalSeparatorAlwaysShown(false);
-        assertFalse("Returns true", df.isDecimalSeparatorAlwaysShown());
-        assertEquals("Wrong set result", "8", df.format(8));
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#setCurrency(java.util.Currency)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setCurrency",
-        args = {java.util.Currency.class}
-    )
-    public void test_setCurrencyLjava_util_Currency() {
-        Locale locale = Locale.CANADA;
-        DecimalFormat df = ((DecimalFormat) NumberFormat
-                .getCurrencyInstance(locale));
-
-        try {
-            df.setCurrency(null);
-            fail("Expected NullPointerException");
-        } catch (NullPointerException e) {
-        }
-
-        Currency currency = Currency.getInstance("AED");
-        df.setCurrency(currency);
-        assertTrue("Returned incorrect currency", currency == df.getCurrency());
-        assertTrue("Returned incorrect currency symbol", currency.getSymbol(
-                locale)
-                .equals(df.getDecimalFormatSymbols().getCurrencySymbol()));
-        assertTrue("Returned incorrect international currency symbol", currency
-                .getCurrencyCode().equals(
-                        df.getDecimalFormatSymbols()
-                                .getInternationalCurrencySymbol()));
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#setGroupingSize(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setGroupingSize",
-        args = {int.class}
-    )
-    public void test_setGroupingSizeI() {
-        DecimalFormat df = new DecimalFormat("###0.##",
-                new DecimalFormatSymbols(Locale.ENGLISH));
-        df.setGroupingUsed(true);
-        df.setGroupingSize(2);
-        assertEquals("Value not set", 2, df.getGroupingSize());
-        String result = df.format(123);
-        assertTrue("Invalid format:" + result, result.equals("1,23"));
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#setMaximumFractionDigits(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setMaximumFractionDigits",
-        args = {int.class}
-    )
-    public void test_setMaximumFractionDigitsI() {
-        DecimalFormat df = new DecimalFormat("###0.##",
-                new DecimalFormatSymbols(Locale.US));
-        df.setMaximumFractionDigits(3);
-        assertEquals("Not set", 3, df.getMaximumFractionDigits());
-        assertEquals("Wrong maximum", "1.235", df.format(1.23456));
-        df.setMinimumFractionDigits(4);
-        assertEquals("Not changed", 4, df.getMaximumFractionDigits());
-        assertEquals("Incorrect fraction", "456.0000", df.format(456));
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#setMaximumIntegerDigits(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setMaximumIntegerDigits",
-        args = {int.class}
-    )
-    public void test_setMaximumIntegerDigitsI() {
-        DecimalFormat df = new DecimalFormat("###0.##");
-        df.setMaximumIntegerDigits(2);
-        assertEquals("Not set", 2, df.getMaximumIntegerDigits());
-        assertEquals("Wrong maximum", "34", df.format(1234));
-        df.setMinimumIntegerDigits(4);
-        assertEquals("Not changed", 4, df.getMaximumIntegerDigits());
-        assertEquals("Incorrect integer", "0026", df.format(26));
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#setMinimumFractionDigits(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setMinimumFractionDigits",
-        args = {int.class}
-    )
-    public void test_setMinimumFractionDigitsI() {
-        DecimalFormat df = new DecimalFormat("###0.##",
-                new DecimalFormatSymbols(Locale.US));
-        df.setMinimumFractionDigits(4);
-        assertEquals("Not set", 4, df.getMinimumFractionDigits());
-        assertEquals("Wrong minimum", "1.2300", df.format(1.23));
-        df.setMaximumFractionDigits(2);
-        assertEquals("Not changed", 2, df.getMinimumFractionDigits());
-        assertEquals("Incorrect fraction", "456.00", df.format(456));
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#setMinimumIntegerDigits(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setMinimumIntegerDigits",
-        args = {int.class}
-    )
-    public void test_setMinimumIntegerDigitsI() {
-        DecimalFormat df = new DecimalFormat("###0.##",
-                new DecimalFormatSymbols(Locale.US));
-        df.setMinimumIntegerDigits(3);
-        assertEquals("Not set", 3, df.getMinimumIntegerDigits());
-        assertEquals("Wrong minimum", "012", df.format(12));
-        df.setMaximumIntegerDigits(2);
-        assertEquals("Not changed", 2, df.getMinimumIntegerDigits());
-        assertEquals("Incorrect integer", "00.7", df.format(0.7));
-    }
-
-    /**
-     * @tests java.text.DecimalFormat#setMultiplier(int)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setMultiplier",
-        args = {int.class}
-    )
-    public void test_setMultiplierI() {
-        DecimalFormat df = new DecimalFormat("###0.##");
-        df.setMultiplier(10);
-        assertEquals("Wrong multiplier", 10, df.getMultiplier());
-        assertEquals("Wrong format", "50", df.format(5));
-        assertEquals("Wrong parse", 5, df.parse("50", new ParsePosition(0))
-                .intValue());
-
-        // regression test for HARMONY-879
-        df.setMultiplier(-1);
-        assertEquals("Wrong  multiplier for negative value", -1, df
-                .getMultiplier());
-    }
-
-    /**
-     * @tests serialization/deserialization compatibility.
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "Verifies serialization/deserialization compatibility.",
-        method = "!SerializationSelf",
-        args = {}
-    )
-
-    public void testSerializationSelf() throws Exception {
-       // SerializationTest.verifySelf(new DecimalFormat());
-    }
-
-    /**
-     * @tests serialization compatibility with RI
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "Verifies serialization compatibility.",
-        method = "!SerializationGolden",
-        args = {}
-    )
-    public void test_serializationHarmonyRICompatible() throws Exception {
-        Locale[] requiredLocales = {Locale.FRANCE};
-        if (!Support_Locale.areLocalesAvailable(requiredLocales)) {
-            // locale dependent test, bug 1943269
-            return;
-        }
-        NumberFormat nf = NumberFormat.getInstance(Locale.FRANCE);
-
-        DecimalFormat df = null;
-        if (!(nf instanceof DecimalFormat)) {
-            throw new Error("This NumberFormat is not a DecimalFormat");
-
-        }
-        df = (DecimalFormat) nf;
-
-        ObjectInputStream oinput = null;
-
-        DecimalFormat deserializedDF = null;
-
-        try {
-            oinput = new ObjectInputStream(this.getClass().getResource(
-                    "/serialization/java/text/DecimalFormat.ser").openStream());
-            deserializedDF = (DecimalFormat) oinput.readObject();
-        } finally {
-            try {
-                if (null != oinput) {
-                    oinput.close();
-                }
-            } catch (Exception e) {
-                // ignore
-            }
-        }
-
-        assertEquals(df.getNegativePrefix(), deserializedDF.getNegativePrefix());
-        assertEquals(df.getNegativeSuffix(), deserializedDF.getNegativeSuffix());
-        assertEquals(df.getPositivePrefix(), deserializedDF.getPositivePrefix());
-        assertEquals(df.getPositiveSuffix(), deserializedDF.getPositiveSuffix());
-        assertEquals(df.getCurrency(), deserializedDF.getCurrency());
-
-        DecimalFormatSymbolsTest.assertDecimalFormatSymbolsRIFrance(deserializedDF.getDecimalFormatSymbols());
-
-        assertEquals(df.getGroupingSize(), df.getGroupingSize());
-        assertEquals(df.getMaximumFractionDigits(), deserializedDF
-                .getMaximumFractionDigits());
-
-        assertEquals(df.getMaximumIntegerDigits(), deserializedDF
-                .getMaximumIntegerDigits());
-
-        assertEquals(df.getMinimumFractionDigits(), deserializedDF
-                .getMinimumFractionDigits());
-        assertEquals(df.getMinimumIntegerDigits(), deserializedDF
-                .getMinimumIntegerDigits());
-        assertEquals(df.getMultiplier(), deserializedDF.getMultiplier());
-
-        // Deliberately omitted this assertion. Since different data resource
-        // will cause the assertion fail.
-        // assertEquals(df, deserializedDF);
-
-    }
-
-    /**
-     * Test whether DecimalFormat can parse Positive infinity correctly
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL,
-        notes = "Regression test.",
-        method = "parse",
-        args = {java.lang.String.class, java.text.ParsePosition.class}
-    )
-    public void testParseInfinityBigDecimalFalse() {
-        // Regression test for HARMONY-106
-        DecimalFormat format = (DecimalFormat) DecimalFormat.getInstance();
-        DecimalFormatSymbols symbols = new DecimalFormatSymbols();
-        Number number = format.parse(symbols.getInfinity(),
-                new ParsePosition(0));
-        assertTrue(number instanceof Double);
-        assertTrue(Double.isInfinite(number.doubleValue()));
-    }
-
-    /**
-     * Test whether DecimalFormat can parse Negative infinity correctly
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL,
-        notes = "Regression test.",
-        method = "parse",
-        args = {java.lang.String.class, java.text.ParsePosition.class}
-    )
-    public void testParseMinusInfinityBigDecimalFalse() {
-        // Regression test for HARMONY-106
-        DecimalFormat format = (DecimalFormat) DecimalFormat.getInstance();
-        DecimalFormatSymbols symbols = new DecimalFormatSymbols();
-        Number number = format.parse("-" + symbols.getInfinity(),
-                new ParsePosition(0));
-        assertTrue(number instanceof Double);
-        assertTrue(Double.isInfinite(number.doubleValue()));
-    }
-
-    /**
-     * Test if setDecimalFormatSymbols method wont throw NullPointerException
-     * when it is called with null parameter.
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL,
-        notes = "Verifies null as a parameter.",
-        method = "setDecimalFormatSymbols",
-        args = {java.text.DecimalFormatSymbols.class}
-    )
-    public void testSetDecimalFormatSymbolsAsNull() {
-        // Regression for HARMONY-1070
-        DecimalFormat format = (DecimalFormat) DecimalFormat.getInstance();
-        format.setDecimalFormatSymbols(null);
-    }
-
-    // BEGIN android-added: brought back from the harmony java6 branch.
-    public void test_SetRoudingMode_Ljava_math_RoundingMode() {
-        DecimalFormat decimalFormat = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
-        // ignore the fraction part of a given value
-        decimalFormat.setMaximumFractionDigits(0);
-
-        // set RoundingMode.HALF_DOWN of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.HALF_DOWN);
-        String result = decimalFormat.format(11.3);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_DOWN", "11", result);
-
-        result = decimalFormat.format(11.5);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_DOWN", "11", result);
-
-        result = decimalFormat.format(11.6);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_DOWN", "12", result);
-
-        // set RoundingMode.CEILING of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.CEILING);
-        result = decimalFormat.format(11.3);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.CEILING", "12", result);
-
-        result = decimalFormat.format(-11.5);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.CEILING", "-11", result);
-
-        // set RoundingMode.DOWN of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.DOWN);
-        result = decimalFormat.format(11.3);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.DOWN", "11", result);
-
-        result = decimalFormat.format(-11.5);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.DOWN", "-11", result);
-
-        result = decimalFormat.format(0);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.DOWN", "0", result);
-
-        // set RoundingMode.FLOOR of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.FLOOR);
-        result = decimalFormat.format(11.3);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.FLOOR", "11", result);
-
-        result = decimalFormat.format(-11.5);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.FLOOR", "-12", result);
-
-        result = decimalFormat.format(0);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.FLOOR", "0", result);
-
-        // set RoundingMode.HALF_EVEN of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.HALF_EVEN);
-        result = decimalFormat.format(5.5);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_EVEN", "6", result);
-
-        result = decimalFormat.format(-5.5);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_EVEN", "-6", result);
-
-        result = decimalFormat.format(0.2);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_EVEN", "0", result);
-
-        // set RoundingMode.HALF_UP of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.HALF_UP);
-        result = decimalFormat.format(5.5);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_UP", "6", result);
-
-        result = decimalFormat.format(-5.5);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_UP", "-6", result);
-
-        result = decimalFormat.format(0.2);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_UP", "0", result);
-
-        // BEGIN android-changed: we're RI-compatible.
-        // the following assertion will fail on RI implementation, since the
-        // implementation of ICU and RI are not identical.
-        result = decimalFormat.format(-0.2);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_UP", "-0", result);
-        // END android-changed
-
-        // set RoundingMode.UP of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.UP);
-        result = decimalFormat.format(5.5);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.UP", "6", result);
-
-        result = decimalFormat.format(-5.5);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.UP", "-6", result);
-
-        result = decimalFormat.format(0.2);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.UP", "1", result);
-
-        result = decimalFormat.format(-0.2);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.UP", "-1", result);
-
-        // set RoundingMode.UNNECESSARY of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.UNNECESSARY);
-
-        try {
-            // when rounding is needed but RoundingMode is set to RoundingMode.UNNECESSARY, throw ArithmeticException
-            result = decimalFormat.format(5.5);
-            fail("ArithmeticException expected: RoundingMode.UNNECESSARY");
-        } catch (ArithmeticException e) {
-            // expected
-        }
-
-        result = decimalFormat.format(1.0);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.UNNECESSARY", "1", result);
-
-        result = decimalFormat.format(-1.0);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.UNNECESSARY", "-1", result);
-
-        try {
-            // when the given RoundingMode is null, throw NullPointerException
-            decimalFormat.setRoundingMode(null);
-            fail("NullPointerException expected");
-        } catch (NullPointerException e) {
-            // expected
-        }
-
-        // set MaxFractionDigits to 3, test different DecimalFormat format
-        // function with differnt RoundingMode
-        decimalFormat.setMaximumFractionDigits(3);
-
-        // set RoundingMode.HALF_DOWN of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.HALF_DOWN);
-        result = decimalFormat.format(11.5653);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_DOWN", "11.565", result);
-
-        result = decimalFormat.format(11.5655);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_DOWN", "11.565", result);
-
-        result = decimalFormat.format(11.5656);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_DOWN", "11.566", result);
-
-        // set RoundingMode.CEILING of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.CEILING);
-        result = decimalFormat.format(11.5653);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.CEILING", "11.566", result);
-
-        result = decimalFormat.format(-11.5653);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.CEILING", "-11.565", result);
-
-        // set RoundingMode.DOWN of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.DOWN);
-        result = decimalFormat.format(11.5653);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.DOWN", "11.565", result);
-
-        result = decimalFormat.format(-11.5653);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.DOWN", "-11.565", result);
-
-        result = decimalFormat.format(0);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.DOWN", "0", result);
-
-        // set RoundingMode.FLOOR of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.FLOOR);
-        result = decimalFormat.format(11.5653);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.FLOOR", "11.565", result);
-
-        result = decimalFormat.format(-11.5655);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.FLOOR", "-11.566", result);
-
-        result = decimalFormat.format(0);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.FLOOR", "0", result);
-
-        // set RoundingMode.HALF_EVEN of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.HALF_EVEN);
-        result = decimalFormat.format(11.5653);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_EVEN", "11.565", result);
-
-        result = decimalFormat.format(-11.5655);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_EVEN", "-11.566", result);
-
-        result = decimalFormat.format(11.5656);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_EVEN", "11.566", result);
-
-        // set RoundingMode.HALF_UP of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.HALF_UP);
-        result = decimalFormat.format(11.5653);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_UP", "11.565", result);
-
-        result = decimalFormat.format(-11.5655);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_UP", "-11.566", result);
-
-        result = decimalFormat.format(11.5656);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_UP", "11.566", result);
-
-        // set RoundingMode.UP of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.UP);
-        result = decimalFormat.format(11.5653);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.UP", "11.566", result);
-
-        result = decimalFormat.format(-11.5655);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.UP", "-11.566", result);
-
-        // set RoundingMode.UNNECESSARY of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.UNNECESSARY);
-        result = decimalFormat.format(-11.565);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.UNNECESSARY", "-11.565", result);
-
-        result = decimalFormat.format(11.565);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.UNNECESSARY", "11.565", result);
-
-        // when setting MaxFractionDigits to negative value -2, default it as
-        // zero, test different DecimalFormat format
-        // function with differnt RoundingMode
-        decimalFormat.setMaximumFractionDigits(-2);
-
-        // set RoundingMode.HALF_DOWN of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.HALF_DOWN);
-        result = decimalFormat.format(11.3);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_DOWN", "11", result);
-
-        result = decimalFormat.format(11.5);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_DOWN", "11", result);
-
-        result = decimalFormat.format(11.6);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_DOWN", "12", result);
-
-        // set RoundingMode.CEILING of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.CEILING);
-        result = decimalFormat.format(11.3);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.CEILING", "12", result);
-
-        result = decimalFormat.format(-11.5);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.CEILING", "-11", result);
-
-        // set RoundingMode.DOWN of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.DOWN);
-        result = decimalFormat.format(11.3);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.DOWN", "11", result);
-
-        result = decimalFormat.format(-11.5);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.DOWN", "-11", result);
-
-        result = decimalFormat.format(0);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.DOWN", "0", result);
-
-        // set RoundingMode.FLOOR of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.FLOOR);
-        result = decimalFormat.format(11.3);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.FLOOR", "11", result);
-
-        result = decimalFormat.format(-11.5);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.FLOOR", "-12", result);
-
-        result = decimalFormat.format(0);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.FLOOR", "0", result);
-
-        // set RoundingMode.HALF_EVEN of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.HALF_EVEN);
-        result = decimalFormat.format(5.5);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_EVEN", "6", result);
-
-        result = decimalFormat.format(-5.5);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_EVEN", "-6", result);
-
-        result = decimalFormat.format(0.2);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_EVEN", "0", result);
-
-        // set RoundingMode.HALF_UP of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.HALF_UP);
-        result = decimalFormat.format(5.5);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_UP", "6", result);
-
-        result = decimalFormat.format(-5.5);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_UP", "-6", result);
-
-        result = decimalFormat.format(0.2);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_UP", "0", result);
-
-        result = decimalFormat.format(-0.2);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.HALF_UP", "-0", result);
-
-        // set RoundingMode.UP of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.UP);
-        result = decimalFormat.format(5.5);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.UP", "6", result);
-
-        result = decimalFormat.format(-5.5);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.UP", "-6", result);
-
-        result = decimalFormat.format(0.2);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.UP", "1", result);
-
-        result = decimalFormat.format(-0.2);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.UP", "-1", result);
-
-        // set RoundingMode.UNNECESSARY of this DecimalFormat and test its
-        // behavior
-        decimalFormat.setRoundingMode(RoundingMode.UNNECESSARY);
-
-        result = decimalFormat.format(1.0);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.UNNECESSARY", "1", result);
-
-        result = decimalFormat.format(-1.0);
-        assertEquals("Incorrect RoundingMode behavior: RoundingMode.UNNECESSARY", "-1", result);
-    }
-}
diff --git a/luni/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java b/luni/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java
deleted file mode 100644
index df26c1d..0000000
--- a/luni/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java
+++ /dev/null
@@ -1,1174 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.harmony.text.tests.java.text;
-
-import dalvik.annotation.AndroidOnly;
-import dalvik.annotation.BrokenTest;
-import dalvik.annotation.KnownFailure;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-import tests.support.Support_SimpleDateFormat;
-
-import java.text.DateFormat;
-import java.text.DateFormatSymbols;
-import java.text.FieldPosition;
-import java.text.ParseException;
-import java.text.ParsePosition;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.Locale;
-import java.util.SimpleTimeZone;
-import java.util.TimeZone;
-
-@TestTargetClass(SimpleDateFormat.class)
-public class SimpleDateFormatTest extends junit.framework.TestCase {
-
-    static SimpleDateFormat format = new SimpleDateFormat("", Locale.ENGLISH);
-
-    static SimpleDateFormat pFormat = new SimpleDateFormat("", Locale.ENGLISH);
-
-    static class TestFormat extends junit.framework.TestCase {
-        boolean testsFailed = false;
-
-        public TestFormat(String name) {
-            super(name);
-        }
-
-        public void test(String pattern, Calendar cal, String expected,
-                int field) {
-            StringBuffer buffer = new StringBuffer();
-            FieldPosition position = new FieldPosition(field);
-            format.applyPattern(pattern);
-            format.format(cal.getTime(), buffer, position);
-            String result = buffer.toString();
-            if (!System.getProperty("java.vendor", "None").substring(0, 3)
-                    .equals("Sun")) {
-                assertTrue("Wrong format: \"" + pattern + "\" expected: "
-                        + expected + " result: " + result, result
-                        .equals(expected));
-                assertTrue("Wrong begin position: " + pattern + " expected: "
-                        + expected + " field: " + field, position
-                        .getBeginIndex() == 1);
-                assertTrue("Wrong end position: " + pattern + " expected: "
-                        + expected + " field: " + field,
-                        position.getEndIndex() == result.length());
-            } else {
-                // Print the failure but don't use assert as this
-                // will stop subsequent tests from running
-                if (!result.equals(expected)) {
-                    System.out
-                            .println("Wrong format: \"" + pattern
-                                    + "\" expected: " + expected + " result: "
-                                    + result);
-                    testsFailed = true;
-                }
-            }
-        }
-
-        public boolean testsFailed() {
-            return testsFailed;
-        }
-
-        public void parse(String pattern, String input, Date expected,
-                int start, int end) {
-            pFormat.applyPattern(pattern);
-            ParsePosition position = new ParsePosition(start);
-
-            Date result = pFormat.parse(input, position);
-            assertTrue("Wrong result: " + pattern + " input: " + input
-                    + " expected: " + expected + " result: " + result, expected
-                    .equals(result));
-            assertTrue("Wrong end position: " + pattern + " input: " + input,
-                    position.getIndex() == end);
-        }
-
-        public void verifyFormatTimezone(String timeZoneId, String expected1,
-                String expected2, Date date) {
-            format.setTimeZone(SimpleTimeZone.getTimeZone(timeZoneId));
-            format.applyPattern("z, zzzz");
-            assertEquals("Test z for TimeZone : " + timeZoneId, expected1,
-                    format.format(date));
-
-            format.applyPattern("Z, ZZZZ");
-            assertEquals("Test Z for TimeZone : " + timeZoneId, expected2,
-                    format.format(date));
-        }
-    }
-
-    /**
-     * @tests java.text.SimpleDateFormat#SimpleDateFormat()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "SimpleDateFormat",
-        args = {}
-    )
-    public void test_Constructor() {
-        // Test for method java.text.SimpleDateFormat()
-        SimpleDateFormat f2 = new SimpleDateFormat();
-        assertTrue("Wrong class", f2.getClass() == SimpleDateFormat.class);
-        assertTrue("Wrong default", f2.equals(DateFormat.getDateTimeInstance(
-                DateFormat.SHORT, DateFormat.SHORT, Locale.getDefault())));
-        assertTrue("Wrong symbols", f2.getDateFormatSymbols().equals(
-                new DateFormatSymbols()));
-        assertTrue("Doesn't work",
-                f2.format(new Date()).getClass() == String.class);
-    }
-
-    /**
-     * @tests java.text.SimpleDateFormat#SimpleDateFormat(java.lang.String)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "SimpleDateFormat",
-        args = {java.lang.String.class}
-    )
-    public void test_ConstructorLjava_lang_String() {
-        // Test for method java.text.SimpleDateFormat(java.lang.String)
-        SimpleDateFormat f2 = new SimpleDateFormat("yyyy");
-        assertTrue("Wrong class", f2.getClass() == SimpleDateFormat.class);
-        assertEquals("Wrong pattern", "yyyy", f2.toPattern());
-        assertTrue("Wrong locale", f2.equals(new SimpleDateFormat("yyyy",
-                Locale.getDefault())));
-        assertTrue("Wrong symbols", f2.getDateFormatSymbols().equals(
-                new DateFormatSymbols()));
-        assertTrue("Doesn't work",
-                f2.format(new Date()).getClass() == String.class);
-
-        // Invalid constructor value.
-        try {
-            new SimpleDateFormat(
-                    "this is an invalid simple date format");
-            fail("Expected test_ConstructorLjava_lang_String to throw IAE.");
-        } catch (IllegalArgumentException ex) {
-            // expected
-        } catch (Throwable ex) {
-            fail("Expected test_ConstructorLjava_lang_String to throw IAE, not "
-                    + ex.getClass().getName());
-        }
-
-        // Null string value
-        try {
-            new SimpleDateFormat(null);
-            fail("Expected test_ConstructorLjava_lang_String to throw NPE.");
-        } catch (NullPointerException ex) {
-            // expected
-        } catch (Throwable ex) {
-            fail("Expected test_ConstructorLjava_lang_String to throw NPE, not "
-                    + ex.getClass().getName());
-        }
-    }
-
-    /**
-     * @tests java.text.SimpleDateFormat#SimpleDateFormat(java.lang.String,
-     *        java.text.DateFormatSymbols)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "SimpleDateFormat",
-        args = {java.lang.String.class, java.text.DateFormatSymbols.class}
-    )
-    public void test_ConstructorLjava_lang_StringLjava_text_DateFormatSymbols() {
-        // Test for method java.text.SimpleDateFormat(java.lang.String,
-        // java.text.DateFormatSymbols)
-        DateFormatSymbols symbols = new DateFormatSymbols(Locale.ENGLISH);
-        symbols.setEras(new String[] { "Before", "After" });
-        SimpleDateFormat f2 = new SimpleDateFormat("y'y'yy", symbols);
-        assertTrue("Wrong class", f2.getClass() == SimpleDateFormat.class);
-        assertEquals("Wrong pattern", "y'y'yy", f2.toPattern());
-        assertTrue("Wrong symbols", f2.getDateFormatSymbols().equals(symbols));
-        assertTrue("Doesn't work",
-                f2.format(new Date()).getClass() == String.class);
-
-        try {
-            new SimpleDateFormat(null, symbols);
-            fail("NullPointerException was not thrown.");
-        } catch(NullPointerException npe) {
-            //expected
-        }
-
-        try {
-            new SimpleDateFormat("eee", symbols);
-            fail("IllegalArgumentException was not thrown.");
-        } catch(IllegalArgumentException iae) {
-            //expected
-        }
-    }
-
-    /**
-     * @tests java.text.SimpleDateFormat#SimpleDateFormat(java.lang.String,
-     *        java.util.Locale)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "SimpleDateFormat",
-        args = {java.lang.String.class, java.util.Locale.class}
-    )
-    public void test_ConstructorLjava_lang_StringLjava_util_Locale() {
-        // Test for method java.text.SimpleDateFormat(java.lang.String,
-        // java.util.Locale)
-        SimpleDateFormat f2 = new SimpleDateFormat("'yyyy' MM yy",
-                Locale.GERMAN);
-        assertTrue("Wrong class", f2.getClass() == SimpleDateFormat.class);
-        assertEquals("Wrong pattern", "'yyyy' MM yy", f2.toPattern());
-        assertTrue("Wrong symbols", f2.getDateFormatSymbols().equals(
-                new DateFormatSymbols(Locale.GERMAN)));
-        assertTrue("Doesn't work",
-                f2.format(new Date()).getClass() == String.class);
-
-        try {
-            new SimpleDateFormat(null, Locale.GERMAN);
-            fail("NullPointerException was not thrown.");
-        } catch(NullPointerException npe) {
-            //expected
-        }
-        try {
-            new SimpleDateFormat("eee", Locale.GERMAN);
-            fail("IllegalArgumentException was not thrown.");
-        } catch(IllegalArgumentException iae) {
-            //expected
-        }
-    }
-
-    /**
-     * @tests java.text.SimpleDateFormat#applyLocalizedPattern(java.lang.String)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "applyLocalizedPattern",
-        args = {java.lang.String.class}
-    )
-    @AndroidOnly("ICU specific...")
-    public void test_applyLocalizedPatternLjava_lang_String() {
-        // Test for method void
-        // java.text.SimpleDateFormat.applyLocalizedPattern(java.lang.String)
-        SimpleDateFormat f2 = new SimpleDateFormat("y", new Locale("de", "CH"));
-        // BEGIN android-removed
-        // This test doesn't work like this. The cause lies inside of icu
-        // that doesn't support localized pattern characters anymore. So this
-        // test fails because the pattern template contains characters that are
-        // not part of the standard pattern returned for every locale.
-        // The default pattern characters are: GyMdkHmsSEDFwWahKzZ
-        //
-        // f2.applyLocalizedPattern("GuMtkHmsSEDFwWahKz");
-        // String pattern = f2.toPattern();
-        // assertTrue("Wrong pattern: " + pattern, pattern
-        //         .equals("GyMdkHmsSEDFwWahKz"));
-        //
-        // test the new "Z" pattern char
-        // f2 = new SimpleDateFormat("y", new Locale("de", "CH"));
-        // f2.applyLocalizedPattern("G u M t Z");
-        // pattern = f2.toPattern();
-        // assertTrue("Wrong pattern: " + pattern, pattern.equals("G y M d Z"));
-        // END android-removed
-
-        // test invalid patterns
-        try {
-            f2.applyLocalizedPattern("b");
-            fail("Expected IllegalArgumentException for pattern with invalid pattern letter: b");
-        } catch (IllegalArgumentException e) {
-        }
-
-        try {
-            // BEGIN android-canged
-            f2.applyLocalizedPattern("u");
-            fail("Expected IllegalArgumentException for pattern with invalid pattern letter: u");
-            // END android-changed
-        } catch (IllegalArgumentException e) {
-        }
-
-        try {
-            f2.applyLocalizedPattern("a '");
-            fail("Expected IllegalArgumentException for pattern with unterminated quote: a '");
-        } catch (IllegalArgumentException e) {
-        }
-
-        try {
-            f2.applyLocalizedPattern(null);
-            fail("Expected NullPointerException for null pattern");
-        } catch (NullPointerException e) {
-        }
-    }
-
-    /**
-     * @tests java.text.SimpleDateFormat#applyPattern(java.lang.String)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "applyPattern",
-        args = {java.lang.String.class}
-    )
-    public void test_applyPatternLjava_lang_String() {
-        // Test for method void
-        // java.text.SimpleDateFormat.applyPattern(java.lang.String)
-        SimpleDateFormat f2 = new SimpleDateFormat("y", new Locale("de", "CH"));
-        // BEGIN android-changed
-        f2.applyPattern("GyMdkHmsSEDFwWahKzZ");
-        assertEquals("Wrong pattern", "GyMdkHmsSEDFwWahKzZ", f2.toPattern());
-        // END android-changed
-
-        // test invalid patterns
-        try {
-            f2.applyPattern("b");
-            fail("Expected IllegalArgumentException for pattern with invalid patter letter: b");
-        } catch (IllegalArgumentException e) {
-        }
-
-        try {
-            f2.applyPattern("u");
-            fail("Expected IllegalArgumentException for pattern with invalid patter letter: u");
-        } catch (IllegalArgumentException e) {
-        }
-
-        try {
-            f2.applyPattern("a '");
-            fail("Expected IllegalArgumentException for pattern with unterminated quote: a '");
-        } catch (IllegalArgumentException e) {
-        }
-
-        try {
-            f2.applyPattern(null);
-            fail("Expected NullPointerException for null pattern");
-        } catch (NullPointerException e) {
-        }
-    }
-
-    /**
-     * @tests java.text.SimpleDateFormat#clone()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "clone",
-        args = {}
-    )
-    public void test_clone() {
-        // Test for method java.lang.Object java.text.SimpleDateFormat.clone()
-        SimpleDateFormat f2 = new SimpleDateFormat();
-        SimpleDateFormat clone = (SimpleDateFormat) f2.clone();
-        assertTrue("Invalid clone", f2.equals(clone));
-        clone.applyPattern("y");
-        assertTrue("Format modified", !f2.equals(clone));
-        clone = (SimpleDateFormat) f2.clone();
-        // Date date = clone.get2DigitYearStart();
-        // date.setTime(0);
-        // assertTrue("Equal after date change: " +
-        // f2.get2DigitYearStart().getTime() + " " +
-        // clone.get2DigitYearStart().getTime(), !f2.equals(clone));
-    }
-
-    /**
-     * @tests java.text.SimpleDateFormat#equals(java.lang.Object)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "equals",
-        args = {java.lang.Object.class}
-    )
-    public void test_equalsLjava_lang_Object() {
-        // Test for method boolean
-        // java.text.SimpleDateFormat.equals(java.lang.Object)
-        SimpleDateFormat format = (SimpleDateFormat) DateFormat.getInstance();
-        SimpleDateFormat clone = (SimpleDateFormat) format.clone();
-        assertTrue("clone not equal", format.equals(clone));
-        format.format(new Date());
-        assertTrue("not equal after format", format.equals(clone));
-    }
-
-    /**
-     * @tests java.text.SimpleDateFormat#hashCode()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "hashCode",
-        args = {}
-    )
-    public void test_hashCode() {
-        SimpleDateFormat format = (SimpleDateFormat) DateFormat.getInstance();
-        SimpleDateFormat clone = (SimpleDateFormat) format.clone();
-        assertTrue("clone has not equal hash code", clone.hashCode() == format
-                .hashCode());
-        format.format(new Date());
-        assertTrue("clone has not equal hash code after format", clone
-                .hashCode() == format.hashCode());
-        DateFormatSymbols symbols = new DateFormatSymbols(Locale.ENGLISH);
-        symbols.setEras(new String[] { "Before", "After" });
-        SimpleDateFormat format2 = new SimpleDateFormat("y'y'yy", symbols);
-        assertFalse("objects has equal hash code", format2.hashCode() == format
-                .hashCode());
-    }
-    @TestTargetNew(
-        level = TestLevel.PARTIAL,
-        notes = "Regression test.",
-        method = "SimpleDateFormat",
-        args = {}
-    )
-    public void test_equals_afterFormat() {
-        // Regression test for HARMONY-209
-        SimpleDateFormat df = new SimpleDateFormat();
-        df.format(new Date());
-        assertEquals(df, new SimpleDateFormat());
-    }
-
-    /**
-     * @tests java.text.SimpleDateFormat#formatToCharacterIterator(java.lang.Object)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "formatToCharacterIterator",
-        args = {java.lang.Object.class}
-    )
-    public void test_formatToCharacterIteratorLjava_lang_Object() {
-
-        try {
-            // Regression for HARMONY-466
-            new SimpleDateFormat().formatToCharacterIterator(null);
-            fail("NullPointerException expected");
-        } catch (NullPointerException e) {
-            // expected
-        }
-
-        // Test for method formatToCharacterIterator(java.lang.Object)
-        new Support_SimpleDateFormat(
-                "test_formatToCharacterIteratorLjava_lang_Object")
-                .t_formatToCharacterIterator();
-    }
-
-    /**
-     * @tests java.text.SimpleDateFormat#format(java.util.Date,
-     *        java.lang.StringBuffer, java.text.FieldPosition)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "format",
-        args = {java.util.Date.class, java.lang.StringBuffer.class, java.text.FieldPosition.class}
-    )
-    public void test_formatLjava_util_DateLjava_lang_StringBufferLjava_text_FieldPosition() {
-        // Test for method java.lang.StringBuffer
-        // java.text.SimpleDateFormat.format(java.util.Date,
-        // java.lang.StringBuffer, java.text.FieldPosition)
-
-        // Android doesn't support EST time zone
-        // new Support_SimpleDateFormat(
-        //        "test_formatLjava_util_DateLjava_lang_StringBufferLjava_text_FieldPosition")
-        //        .t_format_with_FieldPosition();
-
-        TestFormat test = new TestFormat(
-                "test_formatLjava_util_DateLjava_lang_StringBufferLjava_text_FieldPosition");
-
-        Calendar cal = new GregorianCalendar(1999, Calendar.JUNE, 2, 15, 3, 6);
-        test.test(" G", cal, " AD", DateFormat.ERA_FIELD);
-        test.test(" GG", cal, " AD", DateFormat.ERA_FIELD);
-        test.test(" GGG", cal, " AD", DateFormat.ERA_FIELD);
-        test.test(" G", new GregorianCalendar(-1999, Calendar.JUNE, 2), " BC",
-                DateFormat.ERA_FIELD);
-
-        test.test(" y", cal, " 99", DateFormat.YEAR_FIELD);
-        test.test(" yy", cal, " 99", DateFormat.YEAR_FIELD);
-        test.test(" yy", new GregorianCalendar(2001, Calendar.JUNE, 2), " 01",
-                DateFormat.YEAR_FIELD);
-        test.test(" yy", new GregorianCalendar(2000, Calendar.JUNE, 2), " 00",
-                DateFormat.YEAR_FIELD);
-        test.test(" yyy", new GregorianCalendar(2000, Calendar.JUNE, 2), " 00",
-                DateFormat.YEAR_FIELD);
-        test.test(" yyy", cal, " 99", DateFormat.YEAR_FIELD);
-        test.test(" yyyy", cal, " 1999", DateFormat.YEAR_FIELD);
-        test.test(" yyyyy", cal, " 01999", DateFormat.YEAR_FIELD);
-
-        test.test(" M", cal, " 6", DateFormat.MONTH_FIELD);
-        test.test(" M", new GregorianCalendar(1999, Calendar.NOVEMBER, 2),
-                " 11", DateFormat.MONTH_FIELD);
-        test.test(" MM", cal, " 06", DateFormat.MONTH_FIELD);
-        test.test(" MMM", cal, " Jun", DateFormat.MONTH_FIELD);
-        test.test(" MMMM", cal, " June", DateFormat.MONTH_FIELD);
-        test.test(" MMMMM", cal, " June", DateFormat.MONTH_FIELD);
-
-        test.test(" d", cal, " 2", DateFormat.DATE_FIELD);
-        test.test(" d", new GregorianCalendar(1999, Calendar.NOVEMBER, 12),
-                " 12", DateFormat.DATE_FIELD);
-        test.test(" dd", cal, " 02", DateFormat.DATE_FIELD);
-        test.test(" dddd", cal, " 0002", DateFormat.DATE_FIELD);
-
-        test.test(" h", cal, " 3", DateFormat.HOUR1_FIELD);
-        test.test(" h", new GregorianCalendar(1999, Calendar.NOVEMBER, 12),
-                " 12", DateFormat.HOUR1_FIELD);
-        test.test(" hh", cal, " 03", DateFormat.HOUR1_FIELD);
-        test.test(" hhhh", cal, " 0003", DateFormat.HOUR1_FIELD);
-
-        test.test(" H", cal, " 15", DateFormat.HOUR_OF_DAY0_FIELD);
-        test.test(" H",
-                new GregorianCalendar(1999, Calendar.NOVEMBER, 12, 4, 0), " 4",
-                DateFormat.HOUR_OF_DAY0_FIELD);
-        test.test(" H", new GregorianCalendar(1999, Calendar.NOVEMBER, 12, 12,
-                0), " 12", DateFormat.HOUR_OF_DAY0_FIELD);
-        test.test(" H", new GregorianCalendar(1999, Calendar.NOVEMBER, 12),
-                " 0", DateFormat.HOUR_OF_DAY0_FIELD);
-        test.test(" HH", cal, " 15", DateFormat.HOUR_OF_DAY0_FIELD);
-        test.test(" HHHH", cal, " 0015", DateFormat.HOUR_OF_DAY0_FIELD);
-
-        test.test(" m", cal, " 3", DateFormat.MINUTE_FIELD);
-        test.test(" m", new GregorianCalendar(1999, Calendar.NOVEMBER, 12, 4,
-                47), " 47", DateFormat.MINUTE_FIELD);
-        test.test(" mm", cal, " 03", DateFormat.MINUTE_FIELD);
-        test.test(" mmmm", cal, " 0003", DateFormat.MINUTE_FIELD);
-
-        test.test(" s", cal, " 6", DateFormat.SECOND_FIELD);
-        test.test(" s", new GregorianCalendar(1999, Calendar.NOVEMBER, 12, 4,
-                47, 13), " 13", DateFormat.SECOND_FIELD);
-        test.test(" ss", cal, " 06", DateFormat.SECOND_FIELD);
-        test.test(" ssss", cal, " 0006", DateFormat.SECOND_FIELD);
-
-        test.test(" S", cal, " 0", DateFormat.MILLISECOND_FIELD);
-        Calendar temp = new GregorianCalendar();
-        temp.set(Calendar.MILLISECOND, 961);
-
-        test.test(" SS", temp, " 961", DateFormat.MILLISECOND_FIELD);
-        test.test(" SSSS", cal, " 0000", DateFormat.MILLISECOND_FIELD);
-
-        test.test(" SS", cal, " 00", DateFormat.MILLISECOND_FIELD);
-
-        test.test(" E", cal, " Wed", DateFormat.DAY_OF_WEEK_FIELD);
-        test.test(" EE", cal, " Wed", DateFormat.DAY_OF_WEEK_FIELD);
-        test.test(" EEE", cal, " Wed", DateFormat.DAY_OF_WEEK_FIELD);
-        test.test(" EEEE", cal, " Wednesday", DateFormat.DAY_OF_WEEK_FIELD);
-        test.test(" EEEEE", cal, " Wednesday", DateFormat.DAY_OF_WEEK_FIELD);
-
-        test.test(" D", cal, " 153", DateFormat.DAY_OF_YEAR_FIELD);
-        test.test(" DD", cal, " 153", DateFormat.DAY_OF_YEAR_FIELD);
-        test.test(" DDDD", cal, " 0153", DateFormat.DAY_OF_YEAR_FIELD);
-
-        test.test(" F", cal, " 1", DateFormat.DAY_OF_WEEK_IN_MONTH_FIELD);
-        test.test(" F", new GregorianCalendar(1999, Calendar.NOVEMBER, 14),
-                " 2", DateFormat.DAY_OF_WEEK_IN_MONTH_FIELD);
-        test.test(" FF", cal, " 01", DateFormat.DAY_OF_WEEK_IN_MONTH_FIELD);
-        test.test(" FFFF", cal, " 0001", DateFormat.DAY_OF_WEEK_IN_MONTH_FIELD);
-
-        test.test(" w", cal, " 23", DateFormat.WEEK_OF_YEAR_FIELD);
-        test.test(" ww", cal, " 23", DateFormat.WEEK_OF_YEAR_FIELD);
-        test.test(" wwww", cal, " 0023", DateFormat.WEEK_OF_YEAR_FIELD);
-
-        test.test(" W", cal, " 1", DateFormat.WEEK_OF_MONTH_FIELD);
-        test.test(" W", new GregorianCalendar(1999, Calendar.NOVEMBER, 14),
-                " 3", DateFormat.WEEK_OF_MONTH_FIELD);
-        test.test(" WW", cal, " 01", DateFormat.WEEK_OF_MONTH_FIELD);
-        test.test(" WWWW", cal, " 0001", DateFormat.WEEK_OF_MONTH_FIELD);
-
-        test.test(" a", cal, " PM", DateFormat.AM_PM_FIELD);
-        test.test(" a", new GregorianCalendar(1999, Calendar.NOVEMBER, 14),
-                " AM", DateFormat.AM_PM_FIELD);
-        test.test(" a", new GregorianCalendar(1999, Calendar.NOVEMBER, 14, 12,
-                0), " PM", DateFormat.AM_PM_FIELD);
-        test.test(" aa", cal, " PM", DateFormat.AM_PM_FIELD);
-        test.test(" aaa", cal, " PM", DateFormat.AM_PM_FIELD);
-        test.test(" aaaa", cal, " PM", DateFormat.AM_PM_FIELD);
-        test.test(" aaaaa", cal, " PM", DateFormat.AM_PM_FIELD);
-
-        test.test(" k", cal, " 15", DateFormat.HOUR_OF_DAY1_FIELD);
-        test.test(" k",
-                new GregorianCalendar(1999, Calendar.NOVEMBER, 12, 4, 0), " 4",
-                DateFormat.HOUR_OF_DAY1_FIELD);
-        test.test(" k", new GregorianCalendar(1999, Calendar.NOVEMBER, 12, 12,
-                0), " 12", DateFormat.HOUR_OF_DAY1_FIELD);
-        test.test(" k", new GregorianCalendar(1999, Calendar.NOVEMBER, 12),
-                " 24", DateFormat.HOUR_OF_DAY1_FIELD);
-        test.test(" kk", cal, " 15", DateFormat.HOUR_OF_DAY1_FIELD);
-        test.test(" kkkk", cal, " 0015", DateFormat.HOUR_OF_DAY1_FIELD);
-
-        test.test(" K", cal, " 3", DateFormat.HOUR0_FIELD);
-        test.test(" K", new GregorianCalendar(1999, Calendar.NOVEMBER, 12),
-                " 0", DateFormat.HOUR0_FIELD);
-        test.test(" KK", cal, " 03", DateFormat.HOUR0_FIELD);
-        test.test(" KKKK", cal, " 0003", DateFormat.HOUR0_FIELD);
-
-        format.setTimeZone(new SimpleTimeZone(60000, "ONE MINUTE"));
-        test.test(" z", cal, " GMT+00:01", DateFormat.TIMEZONE_FIELD);
-        test.test(" zzzz", cal, " GMT+00:01", DateFormat.TIMEZONE_FIELD);
-        format.setTimeZone(new SimpleTimeZone(5400000, "ONE HOUR, THIRTY"));
-        test.test(" z", cal, " GMT+01:30", DateFormat.TIMEZONE_FIELD);
-        format
-                .setTimeZone(new SimpleTimeZone(-5400000,
-                        "NEG ONE HOUR, THIRTY"));
-        test.test(" z", cal, " GMT-01:30", DateFormat.TIMEZONE_FIELD);
-
-        format.applyPattern("'Mkz''':.@5");
-        assertEquals("Wrong output", "Mkz':.@5", format.format(new Date()));
-
-        //assertTrue("Tests failed", !test.testsFailed());
-
-        // Test invalid args to format.
-        SimpleDateFormat dateFormat = new SimpleDateFormat();
-        try {
-            dateFormat.format(null, new StringBuffer(), new FieldPosition(1));
-            fail("Expected test to throw NPE.");
-        } catch (NullPointerException ex) {
-            // expected
-        } catch (Throwable ex) {
-            fail("Expected test to throw NPE, not " + ex.getClass().getName());
-        }
-
-        format.setTimeZone(TimeZone.getTimeZone("EST"));
-        test.test(" z", cal, " EDT", DateFormat.TIMEZONE_FIELD);
-        Calendar temp2 = new GregorianCalendar(1999, Calendar.JANUARY, 12);
-        test.test(" z", temp2, " EST", DateFormat.TIMEZONE_FIELD);
-        test.test(" zz", cal, " EDT", DateFormat.TIMEZONE_FIELD);
-        test.test(" zzz", cal, " EDT", DateFormat.TIMEZONE_FIELD);
-        test.test(" zzzz", cal, " Eastern Daylight Time",
-                DateFormat.TIMEZONE_FIELD);
-        test.test(" zzzz", temp2, " Eastern Standard Time",
-                DateFormat.TIMEZONE_FIELD);
-       test.test(" zzzzz", cal, " Eastern Daylight Time",
-                DateFormat.TIMEZONE_FIELD);
-    }
-
-    /**
-     * @tests java.text.SimpleDateFormat#format(java.util.Date)
-     */
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL,
-            notes = "Verifies formatting of timezones.",
-            method = "setTimeZone",
-            args = {java.util.TimeZone.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL,
-            notes = "Verifies formatting of timezones.",
-            method = "format",
-            args = {java.util.Date.class, java.lang.StringBuffer.class, java.text.FieldPosition.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL,
-            notes = "Verifies formatting of timezones.",
-            method = "applyPattern",
-            args = {java.lang.String.class}
-        )
-    })
-    public void test_timeZoneFormatting() {
-        // tests specific to formatting of timezones
-        Date summerDate = new GregorianCalendar(1999, Calendar.JUNE, 2, 15, 3,
-                6).getTime();
-        Date winterDate = new GregorianCalendar(1999, Calendar.JANUARY, 12)
-                .getTime();
-
-        TestFormat test = new TestFormat(
-                "test_formatLjava_util_DateLjava_lang_StringBufferLjava_text_FieldPosition");
-        test.verifyFormatTimezone("GMT-7", "GMT-07:00, GMT-07:00",
-                "-0700, -0700", summerDate);
-        test.verifyFormatTimezone("GMT-7", "GMT-07:00, GMT-07:00",
-                "-0700, -0700", winterDate);
-
-        // Pacific/Kiritimati is one of the timezones supported only in Java
-//         Android doesn't support this time zone
-//        test.verifyFormatTimezone("Pacific/Kiritimati", "LINT, Line Is. Time",
-//                "+1400, +1400", summerDate);
-//        test.verifyFormatTimezone("Pacific/Kiritimati", "LINT, Line Is. Time",
-//                "+1400, +1400", winterDate);
-
-        test.verifyFormatTimezone("GMT+14", "GMT+14:00, GMT+14:00",
-                "+1400, +1400", summerDate);
-        test.verifyFormatTimezone("GMT+14", "GMT+14:00, GMT+14:00",
-                "+1400, +1400", winterDate);
-
-        test.verifyFormatTimezone("PST", "PDT, Pacific Daylight Time",
-                "-0700, -0700", summerDate);
-        test.verifyFormatTimezone("PST", "PST, Pacific Standard Time",
-                "-0800, -0800", winterDate);
-
-        test.verifyFormatTimezone("EDT", "EDT, Eastern Daylight Time",
-                "-0400, -0400", summerDate);
-        test.verifyFormatTimezone("EST", "EST, Eastern Standard Time",
-                "-0500, -0500", winterDate);
-    }
-
-    /**
-     * @tests java.text.SimpleDateFormat#get2DigitYearStart()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "get2DigitYearStart",
-        args = {}
-    )
-    public void test_get2DigitYearStart() {
-        // Test for method java.util.Date
-        // java.text.SimpleDateFormat.get2DigitYearStart()
-        SimpleDateFormat f1 = new SimpleDateFormat("y");
-        Date date = f1.get2DigitYearStart();
-        Calendar cal = new GregorianCalendar();
-        int year = cal.get(Calendar.YEAR);
-        cal.setTime(date);
-        assertTrue("Wrong default year start",
-                cal.get(Calendar.YEAR) == (year - 80));
-    }
-
-    /**
-     * @tests java.text.SimpleDateFormat#getDateFormatSymbols()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getDateFormatSymbols",
-        args = {}
-    )
-    public void test_getDateFormatSymbols() {
-        // Test for method java.text.DateFormatSymbols
-        // java.text.SimpleDateFormat.getDateFormatSymbols()
-        SimpleDateFormat df = (SimpleDateFormat) DateFormat.getInstance();
-        DateFormatSymbols dfs = df.getDateFormatSymbols();
-        assertTrue("Symbols identical", dfs != df.getDateFormatSymbols());
-    }
-
-    /**
-     * @tests java.text.SimpleDateFormat#parse(java.lang.String,
-     *        java.text.ParsePosition)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "parse",
-        args = {java.lang.String.class, java.text.ParsePosition.class}
-    )
-    @AndroidOnly("ICU specific...")
-    @BrokenTest("Different behavior between cts host and run-core-test")
-    public void test_parseLjava_lang_StringLjava_text_ParsePosition() {
-        // Test for method java.util.Date
-        // java.text.SimpleDateFormat.parse(java.lang.String,
-        // java.text.ParsePosition)
-
-        TestFormat test = new TestFormat(
-                "test_formatLjava_util_DateLjava_lang_StringBufferLjava_text_FieldPosition");
-
-        Calendar cal = new GregorianCalendar(1970, Calendar.JANUARY, 1);
-        Date time = cal.getTime();
-        test.parse("h", " 12", time, 1, 3);
-        test.parse("H", " 0", time, 1, 2);
-        test.parse("k", " 24", time, 1, 3);
-        test.parse("K", " 0", time, 1, 2);
-
-        cal = new GregorianCalendar(1970, Calendar.JANUARY, 1, 1, 0);
-        time = cal.getTime();
-        test.parse("h", "1", time, 0, 1);
-        test.parse("H", "1 ", time, 0, 1);
-        test.parse("k", "1", time, 0, 1);
-        test.parse("K", "1", time, 0, 1);
-
-        cal = new GregorianCalendar(1970, Calendar.JANUARY, 1, 11, 0);
-        time = cal.getTime();
-        test.parse("h", "0011 ", time, 0, 4);
-        test.parse("K", "11", time, 0, 2);
-        cal = new GregorianCalendar(1970, Calendar.JANUARY, 1, 23, 0);
-        time = cal.getTime();
-        test.parse("H", "23", time, 0, 2);
-        test.parse("k", "23", time, 0, 2);
-
-        test.parse("h a", " 3 AM", new GregorianCalendar(1970,
-                Calendar.JANUARY, 1, 3, 0).getTime(), 1, 5);
-        test.parse("K a", " 3 pm ", new GregorianCalendar(1970,
-                Calendar.JANUARY, 1, 15, 0).getTime(), 1, 5);
-        test.parse("m:s", "0:59 ", new GregorianCalendar(1970,
-                Calendar.JANUARY, 1, 0, 0, 59).getTime(), 0, 4);
-        test.parse("m:s", "59:0", new GregorianCalendar(1970, Calendar.JANUARY,
-                1, 0, 59, 0).getTime(), 0, 4);
-        test.parse("ms", "059", new GregorianCalendar(1970, Calendar.JANUARY,
-                1, 0, 0, 59).getTime(), 0, 3);
-
-        cal = new GregorianCalendar(1970, Calendar.JANUARY, 1);
-        test.parse("S", "0", cal.getTime(), 0, 1);
-        cal.setTimeZone(TimeZone.getTimeZone("HST"));
-        cal.set(Calendar.MILLISECOND, 999);
-        test.parse("S z", "999 HST", cal.getTime(), 0, 7);
-
-        cal = new GregorianCalendar(1970, Calendar.JANUARY, 1);
-        cal.set(Calendar.ERA, GregorianCalendar.BC);
-
-        test.parse("G", "Bc ", cal.getTime(), 0, 2);
-
-        test.parse("y", "00", new GregorianCalendar(2000, Calendar.JANUARY, 1)
-                .getTime(), 0, 2);
-        test.parse("y", "99", new GregorianCalendar(1999, Calendar.JANUARY, 1)
-                .getTime(), 0, 2);
-        test.parse("y", "1", new GregorianCalendar(1, Calendar.JANUARY, 1)
-                .getTime(), 0, 1);
-        test.parse("y", "-1", new GregorianCalendar(-1, Calendar.JANUARY, 1)
-                .getTime(), 0, 2);
-        test.parse("y", "001", new GregorianCalendar(1, Calendar.JANUARY, 1)
-                .getTime(), 0, 3);
-        test.parse("y", "2005",
-                new GregorianCalendar(2005, Calendar.JANUARY, 1).getTime(), 0,
-                4);
-        test.parse("yy", "00", new GregorianCalendar(2000, Calendar.JANUARY, 1)
-                .getTime(), 0, 2);
-        test.parse("yy", "99", new GregorianCalendar(1999, Calendar.JANUARY, 1)
-                .getTime(), 0, 2);
-        test.parse("yy", "1", new GregorianCalendar(1, Calendar.JANUARY, 1)
-                .getTime(), 0, 1);
-        test.parse("yy", "-1", new GregorianCalendar(-1, Calendar.JANUARY, 1)
-                .getTime(), 0, 2);
-        test.parse("yy", "001", new GregorianCalendar(1, Calendar.JANUARY, 1)
-                .getTime(), 0, 3);
-        test.parse("yy", "2005", new GregorianCalendar(2005, Calendar.JANUARY,
-                1).getTime(), 0, 4);
-        test.parse("yyy", "99", new GregorianCalendar(99, Calendar.JANUARY, 1)
-                .getTime(), 0, 2);
-        test.parse("yyy", "1", new GregorianCalendar(1, Calendar.JANUARY, 1)
-                .getTime(), 0, 1);
-        test.parse("yyy", "-1", new GregorianCalendar(-1, Calendar.JANUARY, 1)
-                .getTime(), 0, 2);
-        test.parse("yyy", "001", new GregorianCalendar(1, Calendar.JANUARY, 1)
-                .getTime(), 0, 3);
-        test.parse("yyy", "2005", new GregorianCalendar(2005, Calendar.JANUARY,
-                1).getTime(), 0, 4);
-        test.parse("yyyy", "99", new GregorianCalendar(99, Calendar.JANUARY, 1)
-                .getTime(), 0, 2);
-        test.parse("yyyy", "  1999", new GregorianCalendar(1999,
-                Calendar.JANUARY, 1).getTime(), 2, 6);
-        test.parse("MM'M'", "4M",
-                new GregorianCalendar(1970, Calendar.APRIL, 1).getTime(), 0, 2);
-        test.parse("MMM", "Feb", new GregorianCalendar(1970, Calendar.FEBRUARY,
-                1).getTime(), 0, 3);
-        test.parse("MMMM d", "April 14 ", new GregorianCalendar(1970,
-                Calendar.APRIL, 14).getTime(), 0, 8);
-        test.parse("MMMMd", "April14 ", new GregorianCalendar(1970,
-                Calendar.APRIL, 14).getTime(), 0, 7);
-        test.parse("E w", "Mon 12", new GregorianCalendar(1970, Calendar.MARCH,
-                16).getTime(), 0, 6);
-        test.parse("Ew", "Mon12", new GregorianCalendar(1970, Calendar.MARCH,
-                16).getTime(), 0, 5);
-        test.parse("M EE ''W", "5 Tue '2", new GregorianCalendar(1970,
-                Calendar.MAY, 5).getTime(), 0, 8);
-        test.parse("MEE''W", "5Tue'2", new GregorianCalendar(1970,
-                Calendar.MAY, 5).getTime(), 0, 6);
-        test.parse("MMM EEE F", " JUL Sunday 3", new GregorianCalendar(1970,
-                Calendar.JULY, 19).getTime(), 1, 13);
-        test.parse("MMMEEEF", " JULSunday3", new GregorianCalendar(1970,
-                Calendar.JULY, 19).getTime(), 1, 11);
-
-        cal = new GregorianCalendar(1970, Calendar.JANUARY, 1);
-        cal.setTimeZone(TimeZone.getTimeZone("GMT+0:1"));
-        cal.set(Calendar.DAY_OF_YEAR, 243);
-        test.parse("D z", "243 GMT+0:0", cal.getTime(), 0, 11);
-        cal.setTimeZone(TimeZone.getTimeZone("EST"));
-        cal.set(1970, Calendar.JANUARY, 1, 4, 30);
-        test.parse("h:m z", "4:30 GMT-5 ", cal.getTime(), 0, 10);
-        test.parse("h z", "14 GMT-24 ", new Date(51840000), 0, 9);
-        test.parse("h z", "14 GMT-23 ", new Date(133200000), 0, 9);
-        test.parse("h z", "14 GMT-0001 ", new Date(54000000), 0, 11);
-        test.parse("h z", "14 GMT+24 ", new Date(48960000), 0, 9);
-        test.parse("h z", "14 GMT+23 ", new Date(-32400000), 0, 9);
-        test.parse("h z", "14 GMT+0001 ", new Date(46800000), 0, 11);
-        test.parse("h z", "14 +0001 ", new Date(46800000), 0, 8);
-        test.parse("h z", "14 -0001 ", new Date(54000000), 0, 8);
-
-        test.parse("yyyyMMddHHmmss", "19990913171901", new GregorianCalendar(
-                1999, Calendar.SEPTEMBER, 13, 17, 19, 01).getTime(), 0, 14);
-    }
-
-    /**
-     * @tests java.text.SimpleDateFormat#parse(java.lang.String,
-     *        java.text.ParsePosition)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "parse",
-        args = {java.lang.String.class, java.text.ParsePosition.class}
-    )
-    @AndroidOnly("ICU specific...")
-    public void test_parseLjava_lang_StringLjava_text_ParsePosition_2() {
-        Date d = new Date(1015822800000L);
-        SimpleDateFormat df = new SimpleDateFormat("", new Locale("en", "US"));
-        df.setTimeZone(TimeZone.getTimeZone("EST"));
-
-        try {
-            df.applyPattern("dd MMMM yyyy EEEE");
-            String output = df.format(d);
-            Date date = df.parse(output);
-            assertTrue("Invalid result 1: " + date, d.equals(date));
-
-            df.applyPattern("dd MMMM yyyy F");
-            output = df.format(d);
-            date = df.parse(output);
-            assertTrue("Invalid result 2: " + date, d.equals(date));
-
-            df.applyPattern("dd MMMM yyyy w");
-            output = df.format(d);
-            date = df.parse(output);
-            assertTrue("Invalid result 3: " + date, d.equals(date));
-
-            df.applyPattern("dd MMMM yyyy W");
-            output = df.format(d);
-            date = df.parse(output);
-            assertTrue("Invalid result 4: " + date, d.equals(date));
-
-            df.applyPattern("dd MMMM yyyy D");
-            date = df.parse("5 January 2002 70");
-            assertTrue("Invalid result 5: " + date, d.equals(date));
-
-            df.applyPattern("W w dd MMMM yyyy EEEE");
-            output = df.format(d);
-            date = df.parse("3 12 5 March 2002 Monday");
-            assertTrue("Invalid result 6: " + date, d.equals(date));
-
-            df.applyPattern("w W dd MMMM yyyy EEEE");
-            output = df.format(d);
-            date = df.parse("12 3 5 March 2002 Monday");
-            assertTrue("Invalid result 6a: " + date, d.equals(date));
-
-            df.applyPattern("F dd MMMM yyyy EEEE");
-            output = df.format(d);
-            date = df.parse("2 5 March 2002 Monday");
-            assertTrue("Invalid result 7: " + date, d.equals(date));
-
-            df.applyPattern("w dd MMMM yyyy EEEE");
-            output = df.format(d);
-            date = df.parse("11 5 January 2002 Monday");
-            assertTrue("Invalid result 8: " + date, d.equals(date));
-
-            df.applyPattern("w dd yyyy EEEE MMMM");
-            output = df.format(d);
-            date = df.parse("11 5 2002 Monday January");
-            assertTrue("Invalid result 9: " + date, d.equals(date));
-
-            df.applyPattern("w yyyy EEEE MMMM dd");
-            output = df.format(d);
-            date = df.parse("17 2002 Monday March 11");
-            assertTrue("Invalid result 10: " + date, d.equals(date));
-
-            df.applyPattern("dd D yyyy MMMM");
-            output = df.format(d);
-            date = df.parse("5 70 2002 January");
-            assertTrue("Invalid result 11: " + date, d.equals(date));
-
-            df.applyPattern("D dd yyyy MMMM");
-            output = df.format(d);
-            date = df.parse("240 11 2002 March");
-            assertTrue("Invalid result 12: " + date, d.equals(date));
-        } catch (ParseException e) {
-            fail("unexpected: " + e);
-        }
-
-        try {
-            format.parse("240 11 2002 March", null);
-            fail("ParsePosition is null: NullPointerException was not thrown.");
-        } catch(NullPointerException pe) {
-            //expected
-        }
-
-        try {
-            format.parse(null, new ParsePosition(0));
-            fail("String is null: NullPointerException was not thrown.");
-        } catch(NullPointerException pe) {
-            //expected
-        }
-    }
-
-    /**
-     * @tests java.text.SimpleDateFormat#set2DigitYearStart(java.util.Date)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "set2DigitYearStart",
-        args = {java.util.Date.class}
-    )
-    public void test_set2DigitYearStartLjava_util_Date() {
-        // Test for method void
-        // java.text.SimpleDateFormat.set2DigitYearStart(java.util.Date)
-        SimpleDateFormat f1 = new SimpleDateFormat("yy");
-        f1.set2DigitYearStart(new GregorianCalendar(1950, Calendar.JANUARY, 1)
-                .getTime());
-        Calendar cal = new GregorianCalendar();
-        try {
-            cal.setTime(f1.parse("49"));
-            assertEquals("Incorrect year 2049", 2049, cal.get(Calendar.YEAR));
-            cal.setTime(f1.parse("50"));
-            int year = cal.get(Calendar.YEAR);
-            assertTrue("Incorrect year 1950: " + year, year == 1950);
-            f1.applyPattern("y");
-            cal.setTime(f1.parse("00"));
-            assertEquals("Incorrect year 2000", 2000, cal.get(Calendar.YEAR));
-            f1.applyPattern("yyy");
-            cal.setTime(f1.parse("50"));
-            assertEquals("Incorrect year 50", 50, cal.get(Calendar.YEAR));
-        } catch (ParseException e) {
-            fail("ParseException");
-        }
-    }
-
-    /**
-     * @tests java.text.SimpleDateFormat#setDateFormatSymbols(java.text.DateFormatSymbols)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setDateFormatSymbols",
-        args = {java.text.DateFormatSymbols.class}
-    )
-    public void test_setDateFormatSymbolsLjava_text_DateFormatSymbols() {
-        // Test for method void
-        // java.text.SimpleDateFormat.setDateFormatSymbols(java.text.DateFormatSymbols)
-        SimpleDateFormat f1 = new SimpleDateFormat("a");
-        DateFormatSymbols symbols = new DateFormatSymbols();
-        symbols.setAmPmStrings(new String[] { "morning", "night" });
-        f1.setDateFormatSymbols(symbols);
-        DateFormatSymbols newSym = f1.getDateFormatSymbols();
-        assertTrue("Set incorrectly", newSym.equals(symbols));
-        assertTrue("Not a clone", f1.getDateFormatSymbols() != symbols);
-        String result = f1.format(new GregorianCalendar(1999, Calendar.JUNE,
-                12, 3, 0).getTime());
-        assertEquals("Incorrect symbols used", "morning", result);
-        symbols.setEras(new String[] { "before", "after" });
-        assertTrue("Identical symbols", !f1.getDateFormatSymbols().equals(
-                symbols));
-
-        try {
-            f1.setDateFormatSymbols(null);
-            fail("NullPointerException was not thrown.");
-        } catch(NullPointerException npe) {
-            //expected
-        }
-    }
-
-    /**
-     * @tests java.text.SimpleDateFormat#toLocalizedPattern()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "toLocalizedPattern",
-        args = {}
-    )
-    @AndroidOnly("ICU specific...")
-    public void test_toLocalizedPattern() {
-        // BEGIN android-changed
-        // Test for method java.lang.String
-        // java.text.SimpleDateFormat.toLocalizedPattern()
-        SimpleDateFormat f2 = new SimpleDateFormat("GyMdkHmsSEDFwWahKzZ",
-                new Locale("de", "CH"));
-        String pattern = f2.toLocalizedPattern();
-        // the default localized pattern characters are the same for all locales
-        // since icu has droped support for this. the default pattern characters
-        // are these: GyMdkHmsSEDFwWahKz
-        //
-        // assertTrue("Wrong pattern: " + pattern, pattern
-        //         .equals("GuMtkHmsSEDFwWahKz"));
-        assertTrue("Wrong pattern: " + pattern, pattern
-                .equals("GyMdkHmsSEDFwWahKzZ"));
-
-
-        // test the new "Z" pattern char
-        f2 = new SimpleDateFormat("G y M d Z", new Locale("de", "CH"));
-        pattern = f2.toLocalizedPattern();
-        // assertTrue("Wrong pattern: " + pattern, pattern.equals("G u M t Z"));
-        assertTrue("Wrong pattern: " + pattern, pattern.equals("G y M d Z"));
-        // END android-changed
-    }
-
-    /**
-     * @tests java.text.SimpleDateFormat#toPattern()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "toPattern",
-        args = {}
-    )
-    public void test_toPattern() {
-        String pattern = "yyyy mm dd";
-        SimpleDateFormat f = new SimpleDateFormat(pattern);
-        assertEquals("Wrong pattern: " + pattern, pattern, f.toPattern());
-
-        pattern = "GyMdkHmsSEDFwWahKz";
-        f = new SimpleDateFormat("GyMdkHmsSEDFwWahKz", new Locale("de", "CH"));
-        assertTrue("Wrong pattern: " + pattern, f.toPattern().equals(pattern));
-
-        pattern = "G y M d Z";
-        f = new SimpleDateFormat(pattern, new Locale("de", "CH"));
-        pattern = f.toPattern();
-        assertTrue("Wrong pattern: " + pattern, f.toPattern().equals(pattern));
-    }
-
-    /**
-     * @tests java.text.SimpleDateFormat#parse(java.lang.String,
-     *        java.text.ParsePosition)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL,
-        notes = "Regression test.",
-        method = "parse",
-        args = {java.lang.String.class, java.text.ParsePosition.class}
-    )
-    public void test_parse_with_spaces() {
-        // Regression for HARMONY-502
-        SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss");
-        df.setLenient(false);
-
-        char allowed_chars[] = { 0x9, 0x20 };
-        String allowed_char_names[] = { "tab", "space" };
-        for (int i = 0; i < allowed_chars.length; i++) {
-            Date expected = new GregorianCalendar(1970, Calendar.JANUARY, 1, 9,
-                    7, 6).getTime();
-            ParsePosition pp = new ParsePosition(0);
-            Date d = df.parse(allowed_chars[i] + "9:07:06", pp);
-            assertNotNull("hour may be prefixed by " + allowed_char_names[i], d);
-            assertEquals(expected, d);
-
-            pp = new ParsePosition(0);
-            d = df.parse("09:" + allowed_chars[i] + "7:06", pp);
-            assertNotNull("minute may be prefixed by " + allowed_char_names[i],
-                    d);
-            assertEquals(expected, d);
-
-            pp = new ParsePosition(0);
-            d = df.parse("09:07:" + allowed_chars[i] + "6", pp);
-            assertNotNull("second may be prefixed by " + allowed_char_names[i],
-                    d);
-            assertEquals(expected, d);
-        }
-
-        char not_allowed_chars[] = {
-                // whitespace
-                0x1c, 0x1d, 0x1e, 0x1f, 0xa, 0xb, 0xc, 0xd, 0x2001, 0x2002,
-                0x2003, 0x2004, 0x2005, 0x2006, 0x2008, 0x2009, 0x200a, 0x200b,
-                0x2028, 0x2029, 0x3000,
-                // non-breaking space
-                0xA0, 0x2007, 0x202F };
-
-        for (int i = 0; i < not_allowed_chars.length; i++) {
-
-            ParsePosition pp = new ParsePosition(0);
-            Date d = df.parse(not_allowed_chars[i] + "9:07", pp);
-            assertNull(d);
-
-            pp = new ParsePosition(0);
-            d = df.parse("09:" + not_allowed_chars[i] + "7", pp);
-            assertNull(d);
-
-            pp = new ParsePosition(0);
-            d = df.parse("09:07:" + not_allowed_chars[i] + "6", pp);
-            assertNull(d);
-        }
-    }
-}
diff --git a/luni/src/test/java/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpiTest.java b/luni/src/test/java/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpiTest.java
index 734e11d..6008cdb 100644
--- a/luni/src/test/java/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpiTest.java
+++ b/luni/src/test/java/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpiTest.java
@@ -1,23 +1,37 @@
-// Copyright 2009 Google Inc. All Rights Reserved.
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 package org.bouncycastle.jce.provider;
 
+import java.io.IOException;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.KeyStoreException;
+import java.security.cert.CertPathValidatorException;
+import java.security.cert.CertificateException;
+import java.security.cert.TrustAnchor;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
 import junit.framework.TestCase;
 import org.apache.harmony.security.provider.cert.X509CertImpl;
 import org.apache.harmony.security.provider.cert.X509CertPathImpl;
-import org.bouncycastle.asn1.x509.X509CertificateStructure;
-import org.bouncycastle.asn1.ASN1Sequence;
+import org.apache.harmony.xnet.provider.jsse.IndexedPKIXParameters;
 import org.bouncycastle.asn1.ASN1InputStream;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Set;
-import java.util.HashSet;
-import java.security.cert.CertificateException;
-import java.security.cert.TrustAnchor;
-import java.security.cert.CertPathValidatorException;
-import java.security.KeyStoreException;
-import java.security.InvalidAlgorithmParameterException;
+import org.bouncycastle.asn1.ASN1Sequence;
+import org.bouncycastle.asn1.x509.X509CertificateStructure;
 
 /**
  * Verify the behavior of PKIXCertPathValidatorSpi.
diff --git a/luni/src/test/java/tests/api/java/lang/reflect/AllTests.java b/luni/src/test/java/tests/api/java/lang/reflect/AllTests.java
index dd427e1..9a5505f 100644
--- a/luni/src/test/java/tests/api/java/lang/reflect/AllTests.java
+++ b/luni/src/test/java/tests/api/java/lang/reflect/AllTests.java
@@ -45,8 +45,6 @@
         suite.addTestSuite(BoundedGenericMethodsTests.class);
         suite.addTestSuite(GenericMethodsTests.class);
         suite.addTestSuite(WildcardTypeTest.class);
-        suite.addTestSuite(GenericTypesTest.class);
-        suite.addTestSuite(GenericReflectionCornerCases.class);
         suite.addTestSuite(GenericSignatureFormatErrorTest.class);
         // $JUnit-END$
 
diff --git a/luni/src/test/java/tests/api/java/math/AllTests.java b/luni/src/test/java/tests/api/java/math/AllTests.java
index 0e058ee..4c25231 100644
--- a/luni/src/test/java/tests/api/java/math/AllTests.java
+++ b/luni/src/test/java/tests/api/java/math/AllTests.java
@@ -26,7 +26,6 @@
     public static Test suite() {
         TestSuite suite = new TestSuite("Tests for java.math");
         // $JUnit-BEGIN$
-        suite.addTestSuite(BigDecimalTest.class);
         suite.addTestSuite(BigIntegerTest.class);
         suite.addTestSuite(RoundingModeTest.class);
         suite.addTestSuite(MathContextTest.class);
diff --git a/luni/src/test/java/tests/api/java/math/BigDecimalTest.java b/luni/src/test/java/tests/api/java/math/BigDecimalTest.java
deleted file mode 100644
index 4a74bc4..0000000
--- a/luni/src/test/java/tests/api/java/math/BigDecimalTest.java
+++ /dev/null
@@ -1,1111 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package tests.api.java.math;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.math.RoundingMode;
-import java.math.MathContext;
-
-public class BigDecimalTest extends junit.framework.TestCase {
-    BigInteger value = new BigInteger("12345908");
-
-    BigInteger value2 = new BigInteger("12334560000");
-
-    /**
-     * @tests java.math.BigDecimal#BigDecimal(java.math.BigInteger)
-     */
-    public void test_ConstructorLjava_math_BigInteger() {
-        BigDecimal big = new BigDecimal(value);
-        assertTrue("the BigDecimal value is not initialized properly", big
-                .unscaledValue().equals(value)
-                && big.scale() == 0);
-    }
-
-    /**
-     * @tests java.math.BigDecimal#BigDecimal(java.math.BigInteger, int)
-     */
-    public void test_ConstructorLjava_math_BigIntegerI() {
-        BigDecimal big = new BigDecimal(value2, 5);
-        assertTrue("the BigDecimal value is not initialized properly", big
-                .unscaledValue().equals(value2)
-                && big.scale() == 5);
-        assertTrue("the BigDecimal value is not represented properly", big
-                .toString().equals("123345.60000"));
-    }
-
-    /**
-     * @tests java.math.BigDecimal#BigDecimal(double)
-     */
-    public void test_ConstructorD() {
-        //
-        // These numbers have an exact representation as doubles:
-        //
-        BigDecimal big = new BigDecimal(123E04);
-        assertTrue(
-                "the BigDecimal value taking a double argument is not initialized properly",
-                big.toString().equals("1230000"));
-        big = new BigDecimal(123.375);
-        assertTrue("init(D) failed for 123.375; became " + big,
-                big.toString().equals("123.375") );
-        big = new BigDecimal(Math.pow(2, -33));
-        assertTrue("init(D) failed for 2^(-33) = 1.16415321826934814453125E-10; became " + big,
-                big.toString().equals("1.16415321826934814453125E-10") );
-        big = new BigDecimal(123456 * Math.pow(2, -33));
-        assertTrue("init(D) failed for 123456 * 2^(-33) = 0.000014372169971466064453125; became " + big,
-                big.toString().equals("0.000014372169971466064453125") );
-        big = new BigDecimal(-123456 * Math.pow(2, -33));
-        assertTrue("init(D) failed for 123456 * 2^(-33) = -0.000014372169971466064453125; became " + big,
-                big.toString().equals("-0.000014372169971466064453125") );
-
-        // Following numbers can't:
-        //
-        big = new BigDecimal(1.2345E-12);
-        assertTrue("the double representation is not correct", big
-                .doubleValue() == 1.2345E-12);
-        big = new BigDecimal(-12345E-3);
-        assertTrue("the double representation is not correct", big
-                .doubleValue() == -12.345);
-        big = new BigDecimal(5.1234567897654321e138);
-        assertTrue("the double representation is not correct", big
-                .doubleValue() == 5.1234567897654321E138
-                && big.scale() == 0);
-        big = new BigDecimal(0.1);
-        assertTrue(
-                "the double representation of 0.1 bigDecimal is not correct",
-                big.doubleValue() == 0.1);
-        big = new BigDecimal(0.00345);
-        assertTrue(
-                "the double representation of 0.00345 bigDecimal is not correct",
-                big.doubleValue() == 0.00345);
-        // regression test for HARMONY-2429
-        big = new BigDecimal(-0.0);
-        assertTrue(
-                "the double representation of -0.0 bigDecimal is not correct",
-                big.scale() == 0);
-    }
-
-    /**
-     * @tests java.math.BigDecimal#BigDecimal(java.lang.String)
-     */
-    public void test_ConstructorLjava_lang_String() throws NumberFormatException {
-        BigDecimal big = new BigDecimal("345.23499600293850");
-        assertTrue("the BigDecimal value is not initialized properly", big
-                .toString().equals("345.23499600293850")
-                && big.scale() == 14);
-        big = new BigDecimal("-12345");
-        assertTrue("the BigDecimal value is not initialized properly", big
-                .toString().equals("-12345")
-                && big.scale() == 0);
-        big = new BigDecimal("123.");
-        assertTrue("the BigDecimal value is not initialized properly", big
-                .toString().equals("123")
-                && big.scale() == 0);
-
-        new BigDecimal("1.234E02");
-    }
-
-    /**
-     * @tests java.math.BigDecimal#BigDecimal(java.lang.String)
-     */
-    public void test_constructor_String_plus_exp() {
-        /*
-         * BigDecimal does not support a + sign in the exponent when converting
-         * from a String.
-         *
-         * mc 081106: who says so?!?
-         */
-        BigDecimal bd;
-        bd = new BigDecimal("+23e-0");
-        assertEquals("incorrect value",  "23", bd.toString());
-        bd = new BigDecimal("-23e+0");
-        assertEquals("incorrect value",  "-23", bd.toString());
-    }
-
-    /**
-     * @tests java.math.BigDecimal#BigDecimal(java.lang.String)
-     */
-    public void test_constructor_String_empty() {
-        try {
-            new BigDecimal("");
-            fail("NumberFormatException expected");
-        } catch (NumberFormatException e) {
-        }
-    }
-
-    /**
-     * @tests java.math.BigDecimal#BigDecimal(java.lang.String)
-     */
-    public void test_constructor_String_plus_minus_exp() {
-        try {
-            new BigDecimal("+35e+-2");
-            fail("NumberFormatException expected");
-        } catch (NumberFormatException e) {
-        }
-
-        try {
-            new BigDecimal("-35e-+2");
-            fail("NumberFormatException expected");
-        } catch (NumberFormatException e) {
-        }
-    }
-
-    /**
-     * @tests java.math.BigDecimal#BigDecimal(char[])
-     */
-    public void test_constructor_CC_plus_minus_exp() {
-        try {
-            new BigDecimal("+35e+-2".toCharArray());
-            fail("NumberFormatException expected");
-        } catch (NumberFormatException e) {
-        }
-
-        try {
-            new BigDecimal("-35e-+2".toCharArray());
-            fail("NumberFormatException expected");
-        } catch (NumberFormatException e) {
-        }
-    }
-
-    /**
-     * @tests java.math.BigDecimal#abs()
-     */
-    public void test_abs() {
-        BigDecimal big = new BigDecimal("-1234");
-        BigDecimal bigabs = big.abs();
-        assertTrue("the absolute value of -1234 is not 1234", bigabs.toString()
-                .equals("1234"));
-        big = new BigDecimal(new BigInteger("2345"), 2);
-        bigabs = big.abs();
-        assertTrue("the absolute value of 23.45 is not 23.45", bigabs
-                .toString().equals("23.45"));
-    }
-
-    /**
-     * @tests java.math.BigDecimal#add(java.math.BigDecimal)
-     */
-    public void test_addLjava_math_BigDecimal() {
-        BigDecimal add1 = new BigDecimal("23.456");
-        BigDecimal add2 = new BigDecimal("3849.235");
-        BigDecimal sum = add1.add(add2);
-        assertTrue("the sum of 23.456 + 3849.235 is wrong", sum.unscaledValue()
-                .toString().equals("3872691")
-                && sum.scale() == 3);
-        assertTrue("the sum of 23.456 + 3849.235 is not printed correctly", sum
-                .toString().equals("3872.691"));
-        BigDecimal add3 = new BigDecimal(12.34E02D);
-        assertTrue("the sum of 23.456 + 12.34E02 is not printed correctly",
-                (add1.add(add3)).toString().equals("1257.456"));
-    }
-
-    /**
-     * @tests java.math.BigDecimal#compareTo(java.math.BigDecimal)
-     */
-    public void test_compareToLjava_math_BigDecimal() {
-        BigDecimal comp1 = new BigDecimal("1.00");
-        BigDecimal comp2 = new BigDecimal(1.000000D);
-        assertTrue("1.00 and 1.000000 should be equal",
-                comp1.compareTo(comp2) == 0);
-        BigDecimal comp3 = new BigDecimal("1.02");
-        assertTrue("1.02 should be bigger than 1.00",
-                comp3.compareTo(comp1) == 1);
-        BigDecimal comp4 = new BigDecimal(0.98D);
-        assertTrue("0.98 should be less than 1.00",
-                comp4.compareTo(comp1) == -1);
-    }
-
-    /**
-     * @tests java.math.BigDecimal#divide(java.math.BigDecimal, int)
-     */
-    public void test_divideLjava_math_BigDecimalI() {
-        BigDecimal divd1 = new BigDecimal(value, 2);
-        BigDecimal divd2 = new BigDecimal("2.335");
-        BigDecimal divd3 = divd1.divide(divd2, BigDecimal.ROUND_UP);
-        assertTrue("123459.08/2.335 is not correct", divd3.toString().equals(
-                "52873.27")
-                && divd3.scale() == divd1.scale());
-        assertTrue(
-                "the unscaledValue representation of 123459.08/2.335 is not correct",
-                divd3.unscaledValue().toString().equals("5287327"));
-        divd2 = new BigDecimal(123.4D);
-        divd3 = divd1.divide(divd2, BigDecimal.ROUND_DOWN);
-        assertTrue("123459.08/123.4  is not correct", divd3.toString().equals(
-                "1000.47")
-                && divd3.scale() == 2);
-        divd2 = new BigDecimal(000D);
-
-        try {
-            divd1.divide(divd2, BigDecimal.ROUND_DOWN);
-            fail("divide by zero is not caught");
-        } catch (ArithmeticException e) {
-        }
-    }
-
-    /**
-     * @tests java.math.BigDecimal#divide(java.math.BigDecimal, int, int)
-     */
-    public void test_divideLjava_math_BigDecimalII() {
-        BigDecimal divd1 = new BigDecimal(value2, 4);
-        BigDecimal divd2 = new BigDecimal("0.0023");
-        BigDecimal divd3 = divd1.divide(divd2, 3, BigDecimal.ROUND_HALF_UP);
-        assertTrue("1233456/0.0023 is not correct", divd3.toString().equals(
-                "536285217.391")
-                && divd3.scale() == 3);
-        divd2 = new BigDecimal(1345.5E-02D);
-        divd3 = divd1.divide(divd2, 0, BigDecimal.ROUND_DOWN);
-        assertTrue(
-                "1233456/13.455 is not correct or does not have the correct scale",
-                divd3.toString().equals("91672") && divd3.scale() == 0);
-        divd2 = new BigDecimal(0000D);
-
-        try {
-            divd1.divide(divd2, 4, BigDecimal.ROUND_DOWN);
-            fail("divide by zero is not caught");
-        } catch (ArithmeticException e) {
-        }
-    }
-
-    /**
-     * @tests java.math.BigDecimal#doubleValue()
-     */
-    public void test_doubleValue() {
-        BigDecimal bigDB = new BigDecimal(-1.234E-112);
-//        Commenting out this part because it causes an endless loop (see HARMONY-319 and HARMONY-329)
-//        assertTrue(
-//                "the double representation of this BigDecimal is not correct",
-//                bigDB.doubleValue() == -1.234E-112);
-        bigDB = new BigDecimal(5.00E-324);
-        assertTrue("the double representation of bigDecimal is not correct",
-                bigDB.doubleValue() == 5.00E-324);
-        bigDB = new BigDecimal(1.79E308);
-        assertTrue("the double representation of bigDecimal is not correct",
-                bigDB.doubleValue() == 1.79E308 && bigDB.scale() == 0);
-        bigDB = new BigDecimal(-2.33E102);
-        assertTrue(
-                "the double representation of bigDecimal -2.33E102 is not correct",
-                bigDB.doubleValue() == -2.33E102 && bigDB.scale() == 0);
-        bigDB = new BigDecimal(Double.MAX_VALUE);
-        bigDB = bigDB.add(bigDB);
-        assertTrue(
-                "a  + number out of the double range should return infinity",
-                bigDB.doubleValue() == Double.POSITIVE_INFINITY);
-        bigDB = new BigDecimal(-Double.MAX_VALUE);
-        bigDB = bigDB.add(bigDB);
-        assertTrue(
-                "a  - number out of the double range should return neg infinity",
-                bigDB.doubleValue() == Double.NEGATIVE_INFINITY);
-    }
-
-    /**
-     * @tests java.math.BigDecimal#equals(java.lang.Object)
-     */
-    public void test_equalsLjava_lang_Object() {
-        BigDecimal equal1 = new BigDecimal(1.00D);
-        BigDecimal equal2 = new BigDecimal("1.0");
-        assertFalse("1.00 and 1.0 should not be equal",
-                equal1.equals(equal2));
-        equal2 = new BigDecimal(1.01D);
-        assertFalse("1.00 and 1.01 should not be equal",
-                equal1.equals(equal2));
-        equal2 = new BigDecimal("1.00");
-        assertFalse("1.00D and 1.00 should not be equal",
-                equal1.equals(equal2));
-        BigInteger val = new BigInteger("100");
-        equal1 = new BigDecimal("1.00");
-        equal2 = new BigDecimal(val, 2);
-        assertTrue("1.00(string) and 1.00(bigInteger) should be equal", equal1
-                .equals(equal2));
-        equal1 = new BigDecimal(100D);
-        equal2 = new BigDecimal("2.34576");
-        assertFalse("100D and 2.34576 should not be equal", equal1
-                .equals(equal2));
-        assertFalse("bigDecimal 100D does not equal string 23415", equal1
-                .equals("23415"));
-    }
-
-    /**
-     * @tests java.math.BigDecimal#floatValue()
-     */
-    public void test_floatValue() {
-        BigDecimal fl1 = new BigDecimal("234563782344567");
-        assertTrue("the float representation of bigDecimal 234563782344567",
-                fl1.floatValue() == 234563782344567f);
-        BigDecimal fl2 = new BigDecimal(2.345E37);
-        assertTrue("the float representation of bigDecimal 2.345E37", fl2
-                .floatValue() == 2.345E37F);
-        fl2 = new BigDecimal(-1.00E-44);
-        assertTrue("the float representation of bigDecimal -1.00E-44", fl2
-                .floatValue() == -1.00E-44F);
-        fl2 = new BigDecimal(-3E12);
-        assertTrue("the float representation of bigDecimal -3E12", fl2
-                .floatValue() == -3E12F);
-        fl2 = new BigDecimal(Double.MAX_VALUE);
-        assertTrue(
-                "A number can't be represented by float should return infinity",
-                fl2.floatValue() == Float.POSITIVE_INFINITY);
-        fl2 = new BigDecimal(-Double.MAX_VALUE);
-        assertTrue(
-                "A number can't be represented by float should return infinity",
-                fl2.floatValue() == Float.NEGATIVE_INFINITY);
-
-    }
-
-    /**
-     * @tests java.math.BigDecimal#hashCode()
-     */
-    public void test_hashCode() {
-        // anything that is equal must have the same hashCode
-        BigDecimal hash = new BigDecimal("1.00");
-        BigDecimal hash2 = new BigDecimal(1.00D);
-        assertTrue("the hashCode of 1.00 and 1.00D is equal",
-                hash.hashCode() != hash2.hashCode() && !hash.equals(hash2));
-        hash2 = new BigDecimal("1.0");
-        assertTrue("the hashCode of 1.0 and 1.00 is equal",
-                hash.hashCode() != hash2.hashCode() && !hash.equals(hash2));
-        BigInteger val = new BigInteger("100");
-        hash2 = new BigDecimal(val, 2);
-        assertTrue("hashCode of 1.00 and 1.00(bigInteger) is not equal", hash
-                .hashCode() == hash2.hashCode()
-                && hash.equals(hash2));
-        hash = new BigDecimal(value, 2);
-        hash2 = new BigDecimal("-1233456.0000");
-        assertTrue("hashCode of 123459.08 and -1233456.0000 is not equal", hash
-                .hashCode() != hash2.hashCode()
-                && !hash.equals(hash2));
-        hash2 = new BigDecimal(value.negate(), 2);
-        assertTrue("hashCode of 123459.08 and -123459.08 is not equal", hash
-                .hashCode() != hash2.hashCode()
-                && !hash.equals(hash2));
-    }
-
-    /**
-     * @tests java.math.BigDecimal#intValue()
-     */
-    public void test_intValue() {
-        BigDecimal int1 = new BigDecimal(value, 3);
-        assertTrue("the int value of 12345.908 is not 12345",
-                int1.intValue() == 12345);
-        int1 = new BigDecimal("1.99");
-        assertTrue("the int value of 1.99 is not 1", int1.intValue() == 1);
-        int1 = new BigDecimal("23423419083091823091283933");
-        // ran JDK and found representation for the above was -249268259
-        assertTrue("the int value of 23423419083091823091283933 is wrong", int1
-                .intValue() == -249268259);
-        int1 = new BigDecimal(-1235D);
-        assertTrue("the int value of -1235 is not -1235",
-                int1.intValue() == -1235);
-    }
-
-    /**
-     * @tests java.math.BigDecimal#longValue()
-     */
-    public void test_longValue() {
-        BigDecimal long1 = new BigDecimal(value2.negate(), 0);
-        assertTrue("the long value of 12334560000 is not 12334560000", long1
-                .longValue() == -12334560000L);
-        long1 = new BigDecimal(-1345.348E-123D);
-        assertTrue("the long value of -1345.348E-123D is not zero", long1
-                .longValue() == 0);
-        long1 = new BigDecimal("31323423423419083091823091283933");
-        // ran JDK and found representation for the above was
-        // -5251313250005125155
-        assertTrue(
-                "the long value of 31323423423419083091823091283933 is wrong",
-                long1.longValue() == -5251313250005125155L);
-    }
-
-    /**
-     * @tests java.math.BigDecimal#max(java.math.BigDecimal)
-     */
-    public void test_maxLjava_math_BigDecimal() {
-        BigDecimal max1 = new BigDecimal(value2, 1);
-        BigDecimal max2 = new BigDecimal(value2, 4);
-        assertTrue("1233456000.0 is not greater than 1233456", max1.max(max2)
-                .equals(max1));
-        max1 = new BigDecimal(-1.224D);
-        max2 = new BigDecimal(-1.2245D);
-        assertTrue("-1.224 is not greater than -1.2245", max1.max(max2).equals(
-                max1));
-        max1 = new BigDecimal(123E18);
-        max2 = new BigDecimal(123E19);
-        assertTrue("123E19 is the not the max", max1.max(max2).equals(max2));
-    }
-
-    /**
-     * @tests java.math.BigDecimal#min(java.math.BigDecimal)
-     */
-    public void test_minLjava_math_BigDecimal() {
-        BigDecimal min1 = new BigDecimal(-12345.4D);
-        BigDecimal min2 = new BigDecimal(-12345.39D);
-        assertTrue("-12345.39 should have been returned", min1.min(min2)
-                .equals(min1));
-        min1 = new BigDecimal(value2, 5);
-        min2 = new BigDecimal(value2, 0);
-        assertTrue("123345.6 should have been returned", min1.min(min2).equals(
-                min1));
-    }
-
-    /**
-     * @tests java.math.BigDecimal#movePointLeft(int)
-     */
-    public void test_movePointLeftI() {
-        BigDecimal movePtLeft = new BigDecimal("123456265.34");
-        BigDecimal alreadyMoved = movePtLeft.movePointLeft(5);
-        assertTrue("move point left 5 failed", alreadyMoved.scale() == 7
-                && alreadyMoved.toString().equals("1234.5626534"));
-        movePtLeft = new BigDecimal(value2.negate(), 0);
-        alreadyMoved = movePtLeft.movePointLeft(12);
-        assertTrue("move point left 12 failed", alreadyMoved.scale() == 12
-                && alreadyMoved.toString().equals("-0.012334560000"));
-        movePtLeft = new BigDecimal(123E18);
-        alreadyMoved = movePtLeft.movePointLeft(2);
-        assertTrue("move point left 2 failed",
-                alreadyMoved.scale() == movePtLeft.scale() + 2
-                        && alreadyMoved.doubleValue() == 1.23E18);
-        movePtLeft = new BigDecimal(1.123E-12);
-        alreadyMoved = movePtLeft.movePointLeft(3);
-        assertTrue("move point left 3 failed",
-                alreadyMoved.scale() == movePtLeft.scale() + 3
-                        && alreadyMoved.doubleValue() == 1.123E-15);
-        movePtLeft = new BigDecimal(value, 2);
-        alreadyMoved = movePtLeft.movePointLeft(-2);
-        assertTrue("move point left -2 failed",
-                alreadyMoved.scale() == movePtLeft.scale() - 2
-                        && alreadyMoved.toString().equals("12345908"));
-    }
-
-    /**
-     * @tests java.math.BigDecimal#movePointRight(int)
-     */
-    public void test_movePointRightI() {
-        BigDecimal movePtRight = new BigDecimal("-1.58796521458");
-        BigDecimal alreadyMoved = movePtRight.movePointRight(8);
-        assertTrue("move point right 8 failed", alreadyMoved.scale() == 3
-                && alreadyMoved.toString().equals("-158796521.458"));
-        movePtRight = new BigDecimal(value, 2);
-        alreadyMoved = movePtRight.movePointRight(4);
-        assertTrue("move point right 4 failed", alreadyMoved.scale() == 0
-                && alreadyMoved.toString().equals("1234590800"));
-        movePtRight = new BigDecimal(134E12);
-        alreadyMoved = movePtRight.movePointRight(2);
-        assertTrue("move point right 2 failed", alreadyMoved.scale() == 0
-                && alreadyMoved.toString().equals("13400000000000000"));
-        movePtRight = new BigDecimal(-3.4E-10);
-        alreadyMoved = movePtRight.movePointRight(5);
-        assertTrue("move point right 5 failed",
-                alreadyMoved.scale() == movePtRight.scale() - 5
-                        && alreadyMoved.doubleValue() == -0.000034);
-        alreadyMoved = alreadyMoved.movePointRight(-5);
-        assertTrue("move point right -5 failed", alreadyMoved
-                .equals(movePtRight));
-    }
-
-    /**
-     * @tests java.math.BigDecimal#multiply(java.math.BigDecimal)
-     */
-    public void test_multiplyLjava_math_BigDecimal() {
-        BigDecimal multi1 = new BigDecimal(value, 5);
-        BigDecimal multi2 = new BigDecimal(2.345D);
-        BigDecimal result = multi1.multiply(multi2);
-        assertTrue("123.45908 * 2.345 is not correct: " + result, result
-                .toString().startsWith("289.51154260")
-                && result.scale() == multi1.scale() + multi2.scale());
-        multi1 = new BigDecimal("34656");
-        multi2 = new BigDecimal("-2");
-        result = multi1.multiply(multi2);
-        assertTrue("34656 * 2 is not correct", result.toString().equals(
-                "-69312")
-                && result.scale() == 0);
-        multi1 = new BigDecimal(-2.345E-02);
-        multi2 = new BigDecimal(-134E130);
-        result = multi1.multiply(multi2);
-        assertTrue("-2.345E-02 * -134E130 is not correct " + result.doubleValue(),
-                result.doubleValue() == 3.1422999999999997E130
-                        && result.scale() == multi1.scale() + multi2.scale());
-        multi1 = new BigDecimal("11235");
-        multi2 = new BigDecimal("0");
-        result = multi1.multiply(multi2);
-        assertTrue("11235 * 0 is not correct", result.doubleValue() == 0
-                && result.scale() == 0);
-        multi1 = new BigDecimal("-0.00234");
-        multi2 = new BigDecimal(13.4E10);
-        result = multi1.multiply(multi2);
-        assertTrue("-0.00234 * 13.4E10 is not correct",
-                result.doubleValue() == -313560000
-                        && result.scale() == multi1.scale() + multi2.scale());
-    }
-
-    /**
-     * @tests java.math.BigDecimal#negate()
-     */
-    public void test_negate() {
-        BigDecimal negate1 = new BigDecimal(value2, 7);
-        assertTrue("the negate of 1233.4560000 is not -1233.4560000", negate1
-                .negate().toString().equals("-1233.4560000"));
-        negate1 = new BigDecimal("-23465839");
-        assertTrue("the negate of -23465839 is not 23465839", negate1.negate()
-                .toString().equals("23465839"));
-        negate1 = new BigDecimal(-3.456E6);
-        assertTrue("the negate of -3.456E6 is not 3.456E6", negate1.negate()
-                .negate().equals(negate1));
-    }
-
-    /**
-     * @tests java.math.BigDecimal#scale()
-     */
-    public void test_scale() {
-        BigDecimal scale1 = new BigDecimal(value2, 8);
-        assertTrue("the scale of the number 123.34560000 is wrong", scale1
-                .scale() == 8);
-        BigDecimal scale2 = new BigDecimal("29389.");
-        assertTrue("the scale of the number 29389. is wrong",
-                scale2.scale() == 0);
-        BigDecimal scale3 = new BigDecimal(3.374E13);
-        assertTrue("the scale of the number 3.374E13 is wrong",
-                scale3.scale() == 0);
-        BigDecimal scale4 = new BigDecimal("-3.45E-203");
-        // note the scale is calculated as 15 digits of 345000.... + exponent -
-        // 1. -1 for the 3
-        assertTrue("the scale of the number -3.45E-203 is wrong: "
-                + scale4.scale(), scale4.scale() == 205);
-        scale4 = new BigDecimal("-345.4E-200");
-        assertTrue("the scale of the number -345.4E-200 is wrong", scale4
-                .scale() == 201);
-    }
-
-    /**
-     * @tests java.math.BigDecimal#setScale(int)
-     */
-    public void test_setScaleI() {
-        // rounding mode defaults to zero
-        BigDecimal setScale1 = new BigDecimal(value, 3);
-        BigDecimal setScale2 = setScale1.setScale(5);
-        BigInteger setresult = new BigInteger("1234590800");
-        assertTrue("the number 12345.908 after setting scale is wrong",
-                setScale2.unscaledValue().equals(setresult)
-                        && setScale2.scale() == 5);
-
-        try {
-            setScale2 = setScale1.setScale(2, BigDecimal.ROUND_UNNECESSARY);
-            fail("arithmetic Exception not caught as a result of loosing precision");
-        } catch (ArithmeticException e) {
-        }
-    }
-
-    /**
-     * @tests java.math.BigDecimal#setScale(int, int)
-     */
-    public void test_setScaleII() {
-        BigDecimal setScale1 = new BigDecimal(2.323E102);
-        BigDecimal setScale2 = setScale1.setScale(4);
-        assertTrue("the number 2.323E102 after setting scale is wrong",
-                setScale2.scale() == 4);
-        assertTrue("the representation of the number 2.323E102 is wrong",
-                setScale2.doubleValue() == 2.323E102);
-
-        setScale1 = new BigDecimal("-1.253E-12");
-        setScale2 = setScale1.setScale(17, BigDecimal.ROUND_CEILING);
-        assertTrue("the scale of the number -1.253E-12 after setting scale is wrong",
-                setScale2.scale() == 17);
-        assertTrue(
-                "the representation of the number -1.253E-12 after setting scale is wrong, " + setScale2.toString(),
-                setScale2.toString().equals("-1.25300E-12"));
-
-        // testing rounding Mode ROUND_CEILING
-        setScale1 = new BigDecimal(value, 4);
-        setScale2 = setScale1.setScale(1, BigDecimal.ROUND_CEILING);
-        assertTrue(
-                "the number 1234.5908 after setting scale to 1/ROUND_CEILING is wrong",
-                setScale2.toString().equals("1234.6") && setScale2.scale() == 1);
-        BigDecimal setNeg = new BigDecimal(value.negate(), 4);
-        setScale2 = setNeg.setScale(1, BigDecimal.ROUND_CEILING);
-        assertTrue(
-                "the number -1234.5908 after setting scale to 1/ROUND_CEILING is wrong",
-                setScale2.toString().equals("-1234.5")
-                        && setScale2.scale() == 1);
-
-        // testing rounding Mode ROUND_DOWN
-        setScale2 = setNeg.setScale(1, BigDecimal.ROUND_DOWN);
-        assertTrue(
-                "the number -1234.5908 after setting scale to 1/ROUND_DOWN is wrong",
-                setScale2.toString().equals("-1234.5")
-                        && setScale2.scale() == 1);
-        setScale1 = new BigDecimal(value, 4);
-        setScale2 = setScale1.setScale(1, BigDecimal.ROUND_DOWN);
-        assertTrue(
-                "the number 1234.5908 after setting scale to 1/ROUND_DOWN is wrong",
-                setScale2.toString().equals("1234.5") && setScale2.scale() == 1);
-
-        // testing rounding Mode ROUND_FLOOR
-        setScale2 = setScale1.setScale(1, BigDecimal.ROUND_FLOOR);
-        assertTrue(
-                "the number 1234.5908 after setting scale to 1/ROUND_FLOOR is wrong",
-                setScale2.toString().equals("1234.5") && setScale2.scale() == 1);
-        setScale2 = setNeg.setScale(1, BigDecimal.ROUND_FLOOR);
-        assertTrue(
-                "the number -1234.5908 after setting scale to 1/ROUND_FLOOR is wrong",
-                setScale2.toString().equals("-1234.6")
-                        && setScale2.scale() == 1);
-
-        // testing rounding Mode ROUND_HALF_DOWN
-        setScale2 = setScale1.setScale(3, BigDecimal.ROUND_HALF_DOWN);
-        assertTrue(
-                "the number 1234.5908 after setting scale to 3/ROUND_HALF_DOWN is wrong",
-                setScale2.toString().equals("1234.591")
-                        && setScale2.scale() == 3);
-        setScale1 = new BigDecimal(new BigInteger("12345000"), 5);
-        setScale2 = setScale1.setScale(1, BigDecimal.ROUND_HALF_DOWN);
-        assertTrue(
-                "the number 123.45908 after setting scale to 1/ROUND_HALF_DOWN is wrong",
-                setScale2.toString().equals("123.4") && setScale2.scale() == 1);
-        setScale2 = new BigDecimal("-1234.5000").setScale(0,
-                BigDecimal.ROUND_HALF_DOWN);
-        assertTrue(
-                "the number -1234.5908 after setting scale to 0/ROUND_HALF_DOWN is wrong",
-                setScale2.toString().equals("-1234") && setScale2.scale() == 0);
-
-        // testing rounding Mode ROUND_HALF_EVEN
-        setScale1 = new BigDecimal(1.2345789D);
-        setScale2 = setScale1.setScale(4, BigDecimal.ROUND_HALF_EVEN);
-        assertTrue(
-                "the number 1.2345789 after setting scale to 4/ROUND_HALF_EVEN is wrong",
-                setScale2.doubleValue() == 1.2346D && setScale2.scale() == 4);
-        setNeg = new BigDecimal(-1.2335789D);
-        setScale2 = setNeg.setScale(2, BigDecimal.ROUND_HALF_EVEN);
-        assertTrue(
-                "the number -1.2335789 after setting scale to 2/ROUND_HALF_EVEN is wrong",
-                setScale2.doubleValue() == -1.23D && setScale2.scale() == 2);
-        setScale2 = new BigDecimal("1.2345000").setScale(3,
-                BigDecimal.ROUND_HALF_EVEN);
-        assertTrue(
-                "the number 1.2345789 after setting scale to 3/ROUND_HALF_EVEN is wrong",
-                setScale2.doubleValue() == 1.234D && setScale2.scale() == 3);
-        setScale2 = new BigDecimal("-1.2345000").setScale(3,
-                BigDecimal.ROUND_HALF_EVEN);
-        assertTrue(
-                "the number -1.2335789 after setting scale to 3/ROUND_HALF_EVEN is wrong",
-                setScale2.doubleValue() == -1.234D && setScale2.scale() == 3);
-
-        // testing rounding Mode ROUND_HALF_UP
-        setScale1 = new BigDecimal("134567.34650");
-        setScale2 = setScale1.setScale(3, BigDecimal.ROUND_HALF_UP);
-        assertTrue(
-                "the number 134567.34658 after setting scale to 3/ROUND_HALF_UP is wrong",
-                setScale2.toString().equals("134567.347")
-                        && setScale2.scale() == 3);
-        setNeg = new BigDecimal("-1234.4567");
-        setScale2 = setNeg.setScale(0, BigDecimal.ROUND_HALF_UP);
-        assertTrue(
-                "the number -1234.4567 after setting scale to 0/ROUND_HALF_UP is wrong",
-                setScale2.toString().equals("-1234") && setScale2.scale() == 0);
-
-        // testing rounding Mode ROUND_UNNECESSARY
-        try {
-            setScale1.setScale(3, BigDecimal.ROUND_UNNECESSARY);
-            fail("arithmetic Exception not caught for round unnecessary");
-        } catch (ArithmeticException e) {
-        }
-
-        // testing rounding Mode ROUND_UP
-        setScale1 = new BigDecimal("100000.374");
-        setScale2 = setScale1.setScale(2, BigDecimal.ROUND_UP);
-        assertTrue(
-                "the number 100000.374 after setting scale to 2/ROUND_UP is wrong",
-                setScale2.toString().equals("100000.38")
-                        && setScale2.scale() == 2);
-        setNeg = new BigDecimal(-134.34589D);
-        setScale2 = setNeg.setScale(2, BigDecimal.ROUND_UP);
-        assertTrue(
-                "the number -134.34589 after setting scale to 2/ROUND_UP is wrong",
-                setScale2.doubleValue() == -134.35D && setScale2.scale() == 2);
-
-        // testing invalid rounding modes
-        try {
-            setScale2 = setScale1.setScale(0, -123);
-            fail("IllegalArgumentException is not caught for wrong rounding mode");
-        } catch (IllegalArgumentException e) {
-        }
-    }
-
-    /**
-     * @tests java.math.BigDecimal#setScale(int, java.math.RoundingMode)
-     */
-    public void test_setScaleILjava_math_RoundingMode() {
-        BigDecimal setScale1 = new BigDecimal(2.323E102);
-        BigDecimal setScale2 = setScale1.setScale(4);
-        assertTrue("the number 2.323E102 after setting scale is wrong",
-                setScale2.scale() == 4);
-        assertTrue("the representation of the number 2.323E102 is wrong",
-                setScale2.doubleValue() == 2.323E102);
-
-        setScale1 = new BigDecimal("-1.253E-12");
-        setScale2 = setScale1.setScale(17, RoundingMode.CEILING);
-        assertTrue("the scale of the number -1.253E-12 after setting scale is wrong",
-                setScale2.scale() == 17);
-        assertTrue(
-                "the representation of the number -1.253E-12 after setting scale is wrong, " + setScale2.toString(),
-                setScale2.toString().equals("-1.25300E-12"));
-
-        // testing rounding Mode RoundingMode.CEILING
-        setScale1 = new BigDecimal(value, 4);
-        setScale2 = setScale1.setScale(1, RoundingMode.CEILING);
-        assertTrue(
-                "the number 1234.5908 after setting scale to 1/RoundingMode.CEILING is wrong",
-                setScale2.toString().equals("1234.6") && setScale2.scale() == 1);
-        BigDecimal setNeg = new BigDecimal(value.negate(), 4);
-        setScale2 = setNeg.setScale(1, RoundingMode.CEILING);
-        assertTrue(
-                "the number -1234.5908 after setting scale to 1/RoundingMode.CEILING is wrong",
-                setScale2.toString().equals("-1234.5")
-                        && setScale2.scale() == 1);
-
-        // testing rounding Mode RoundingMode.DOWN
-        setScale2 = setNeg.setScale(1, RoundingMode.DOWN);
-        assertTrue(
-                "the number -1234.5908 after setting scale to 1/RoundingMode.DOWN is wrong",
-                setScale2.toString().equals("-1234.5")
-                        && setScale2.scale() == 1);
-        setScale1 = new BigDecimal(value, 4);
-        setScale2 = setScale1.setScale(1, RoundingMode.DOWN);
-        assertTrue(
-                "the number 1234.5908 after setting scale to 1/RoundingMode.DOWN is wrong",
-                setScale2.toString().equals("1234.5") && setScale2.scale() == 1);
-
-        // testing rounding Mode RoundingMode.FLOOR
-        setScale2 = setScale1.setScale(1, RoundingMode.FLOOR);
-        assertTrue(
-                "the number 1234.5908 after setting scale to 1/RoundingMode.FLOOR is wrong",
-                setScale2.toString().equals("1234.5") && setScale2.scale() == 1);
-        setScale2 = setNeg.setScale(1, RoundingMode.FLOOR);
-        assertTrue(
-                "the number -1234.5908 after setting scale to 1/RoundingMode.FLOOR is wrong",
-                setScale2.toString().equals("-1234.6")
-                        && setScale2.scale() == 1);
-
-        // testing rounding Mode RoundingMode.HALF_DOWN
-        setScale2 = setScale1.setScale(3, RoundingMode.HALF_DOWN);
-        assertTrue(
-                "the number 1234.5908 after setting scale to 3/RoundingMode.HALF_DOWN is wrong",
-                setScale2.toString().equals("1234.591")
-                        && setScale2.scale() == 3);
-        setScale1 = new BigDecimal(new BigInteger("12345000"), 5);
-        setScale2 = setScale1.setScale(1, RoundingMode.HALF_DOWN);
-        assertTrue(
-                "the number 123.45908 after setting scale to 1/RoundingMode.HALF_DOWN is wrong",
-                setScale2.toString().equals("123.4") && setScale2.scale() == 1);
-        setScale2 = new BigDecimal("-1234.5000").setScale(0,
-                RoundingMode.HALF_DOWN);
-        assertTrue(
-                "the number -1234.5908 after setting scale to 0/RoundingMode.HALF_DOWN is wrong",
-                setScale2.toString().equals("-1234") && setScale2.scale() == 0);
-
-        // testing rounding Mode RoundingMode.HALF_EVEN
-        setScale1 = new BigDecimal(1.2345789D);
-        setScale2 = setScale1.setScale(4, RoundingMode.HALF_EVEN);
-        assertTrue(
-                "the number 1.2345789 after setting scale to 4/RoundingMode.HALF_EVEN is wrong",
-                setScale2.doubleValue() == 1.2346D && setScale2.scale() == 4);
-        setNeg = new BigDecimal(-1.2335789D);
-        setScale2 = setNeg.setScale(2, RoundingMode.HALF_EVEN);
-        assertTrue(
-                "the number -1.2335789 after setting scale to 2/RoundingMode.HALF_EVEN is wrong",
-                setScale2.doubleValue() == -1.23D && setScale2.scale() == 2);
-        setScale2 = new BigDecimal("1.2345000").setScale(3,
-                RoundingMode.HALF_EVEN);
-        assertTrue(
-                "the number 1.2345789 after setting scale to 3/RoundingMode.HALF_EVEN is wrong",
-                setScale2.doubleValue() == 1.234D && setScale2.scale() == 3);
-        setScale2 = new BigDecimal("-1.2345000").setScale(3,
-                RoundingMode.HALF_EVEN);
-        assertTrue(
-                "the number -1.2335789 after setting scale to 3/RoundingMode.HALF_EVEN is wrong",
-                setScale2.doubleValue() == -1.234D && setScale2.scale() == 3);
-
-        // testing rounding Mode RoundingMode.HALF_UP
-        setScale1 = new BigDecimal("134567.34650");
-        setScale2 = setScale1.setScale(3, RoundingMode.HALF_UP);
-        assertTrue(
-                "the number 134567.34658 after setting scale to 3/RoundingMode.HALF_UP is wrong",
-                setScale2.toString().equals("134567.347")
-                        && setScale2.scale() == 3);
-        setNeg = new BigDecimal("-1234.4567");
-        setScale2 = setNeg.setScale(0, RoundingMode.HALF_UP);
-        assertTrue(
-                "the number -1234.4567 after setting scale to 0/RoundingMode.HALF_UP is wrong",
-                setScale2.toString().equals("-1234") && setScale2.scale() == 0);
-
-        // testing rounding Mode RoundingMode.UNNECESSARY
-        try {
-            setScale1.setScale(3, RoundingMode.UNNECESSARY);
-            fail("arithmetic Exception not caught for round unnecessary");
-        } catch (ArithmeticException e) {
-        }
-
-        // testing rounding Mode RoundingMode.UP
-        setScale1 = new BigDecimal("100000.374");
-        setScale2 = setScale1.setScale(2, RoundingMode.UP);
-        assertTrue(
-                "the number 100000.374 after setting scale to 2/RoundingMode.UP is wrong",
-                setScale2.toString().equals("100000.38")
-                        && setScale2.scale() == 2);
-        setNeg = new BigDecimal(-134.34589D);
-        setScale2 = setNeg.setScale(2, RoundingMode.UP);
-        assertTrue(
-                "the number -134.34589 after setting scale to 2/RoundingMode.UP is wrong",
-                setScale2.doubleValue() == -134.35D && setScale2.scale() == 2);
-
-        // testing invalid rounding modes
-        try {
-            setScale2 = setScale1.setScale(0, -123);
-            fail("IllegalArgumentException is not caught for wrong rounding mode");
-        } catch (IllegalArgumentException e) {
-        }
-    }
-
-    /**
-     * @tests java.math.BigDecimal#signum()
-     */
-    public void test_signum() {
-        BigDecimal sign = new BigDecimal(123E-104);
-        assertTrue("123E-104 is not positive in signum()", sign.signum() == 1);
-        sign = new BigDecimal("-1234.3959");
-        assertTrue("-1234.3959 is not negative in signum()",
-                sign.signum() == -1);
-        sign = new BigDecimal(000D);
-        assertTrue("000D is not zero in signum()", sign.signum() == 0);
-    }
-
-    /**
-     * @tests java.math.BigDecimal#subtract(java.math.BigDecimal)
-     */
-    public void test_subtractLjava_math_BigDecimal() {
-        BigDecimal sub1 = new BigDecimal("13948");
-        BigDecimal sub2 = new BigDecimal("2839.489");
-        BigDecimal result = sub1.subtract(sub2);
-        assertTrue("13948 - 2839.489 is wrong: " + result, result.toString()
-                .equals("11108.511")
-                && result.scale() == 3);
-        BigDecimal result2 = sub2.subtract(sub1);
-        assertTrue("2839.489 - 13948 is wrong", result2.toString().equals(
-                "-11108.511")
-                && result2.scale() == 3);
-        assertTrue("13948 - 2839.489 is not the negative of 2839.489 - 13948",
-                result.equals(result2.negate()));
-        sub1 = new BigDecimal(value, 1);
-        sub2 = new BigDecimal("0");
-        result = sub1.subtract(sub2);
-        assertTrue("1234590.8 - 0 is wrong", result.equals(sub1));
-        sub1 = new BigDecimal(1.234E-03);
-        sub2 = new BigDecimal(3.423E-10);
-        result = sub1.subtract(sub2);
-        assertTrue("1.234E-03 - 3.423E-10 is wrong, " + result.doubleValue(),
-                result.doubleValue() == 0.0012339996577);
-        sub1 = new BigDecimal(1234.0123);
-        sub2 = new BigDecimal(1234.0123000);
-        result = sub1.subtract(sub2);
-        assertTrue("1234.0123 - 1234.0123000 is wrong, " + result.doubleValue(),
-                result.doubleValue() == 0.0);
-    }
-
-    /**
-     * @tests java.math.BigDecimal#toBigInteger()
-     */
-    public void test_toBigInteger() {
-        BigDecimal sub1 = new BigDecimal("-29830.989");
-        BigInteger result = sub1.toBigInteger();
-
-        assertTrue("the bigInteger equivalent of -29830.989 is wrong", result
-                .toString().equals("-29830"));
-        sub1 = new BigDecimal(-2837E10);
-        result = sub1.toBigInteger();
-        assertTrue("the bigInteger equivalent of -2837E10 is wrong", result
-                .doubleValue() == -2837E10);
-        sub1 = new BigDecimal(2.349E-10);
-        result = sub1.toBigInteger();
-        assertTrue("the bigInteger equivalent of 2.349E-10 is wrong", result
-                .equals(BigInteger.ZERO));
-        sub1 = new BigDecimal(value2, 6);
-        result = sub1.toBigInteger();
-        assertTrue("the bigInteger equivalent of 12334.560000 is wrong", result
-                .toString().equals("12334"));
-    }
-
-    /**
-     * @tests java.math.BigDecimal#toString()
-     */
-    public void test_toString() {
-        BigDecimal toString1 = new BigDecimal("1234.000");
-        assertTrue("the toString representation of 1234.000 is wrong",
-                toString1.toString().equals("1234.000"));
-        toString1 = new BigDecimal("-123.4E-5");
-        assertTrue("the toString representation of -123.4E-5 is wrong: "
-                + toString1, toString1.toString().equals("-0.001234"));
-        toString1 = new BigDecimal("-1.455E-20");
-        assertTrue("the toString representation of -1.455E-20 is wrong",
-                toString1.toString().equals("-1.455E-20"));
-        toString1 = new BigDecimal(value2, 4);
-        assertTrue("the toString representation of 1233456.0000 is wrong",
-                toString1.toString().equals("1233456.0000"));
-    }
-
-    /**
-     * @tests java.math.BigDecimal#unscaledValue()
-     */
-    public void test_unscaledValue() {
-        BigDecimal unsVal = new BigDecimal("-2839485.000");
-        assertTrue("the unscaledValue of -2839485.000 is wrong", unsVal
-                .unscaledValue().toString().equals("-2839485000"));
-        unsVal = new BigDecimal(123E10);
-        assertTrue("the unscaledValue of 123E10 is wrong", unsVal
-                .unscaledValue().toString().equals("1230000000000"));
-        unsVal = new BigDecimal("-4.56E-13");
-        assertTrue("the unscaledValue of -4.56E-13 is wrong: "
-                + unsVal.unscaledValue(), unsVal.unscaledValue().toString()
-                .equals("-456"));
-        unsVal = new BigDecimal(value, 3);
-        assertTrue("the unscaledValue of 12345.908 is wrong", unsVal
-                .unscaledValue().toString().equals("12345908"));
-
-    }
-
-    /**
-     * @tests java.math.BigDecimal#valueOf(long)
-     */
-    public void test_valueOfJ() {
-        BigDecimal valueOfL = BigDecimal.valueOf(9223372036854775806L);
-        assertTrue("the bigDecimal equivalent of 9223372036854775806 is wrong",
-                valueOfL.unscaledValue().toString().equals(
-                        "9223372036854775806")
-                        && valueOfL.scale() == 0);
-        assertTrue(
-                "the toString representation of 9223372036854775806 is wrong",
-                valueOfL.toString().equals("9223372036854775806"));
-        valueOfL = BigDecimal.valueOf(0L);
-        assertTrue("the bigDecimal equivalent of 0 is wrong", valueOfL
-                .unscaledValue().toString().equals("0")
-                && valueOfL.scale() == 0);
-    }
-
-    /**
-     * @tests java.math.BigDecimal#valueOf(long, int)
-     */
-    public void test_valueOfJI() {
-        BigDecimal valueOfJI = BigDecimal.valueOf(9223372036854775806L, 5);
-        assertTrue(
-                "the bigDecimal equivalent of 92233720368547.75806 is wrong",
-                valueOfJI.unscaledValue().toString().equals(
-                        "9223372036854775806")
-                        && valueOfJI.scale() == 5);
-        assertTrue(
-                "the toString representation of 9223372036854775806 is wrong",
-                valueOfJI.toString().equals("92233720368547.75806"));
-        valueOfJI = BigDecimal.valueOf(1234L, 8);
-        assertTrue(
-                "the bigDecimal equivalent of 92233720368547.75806 is wrong",
-                valueOfJI.unscaledValue().toString().equals("1234")
-                        && valueOfJI.scale() == 8);
-        assertTrue(
-                "the toString representation of 9223372036854775806 is wrong",
-                valueOfJI.toString().equals("0.00001234"));
-        valueOfJI = BigDecimal.valueOf(0, 3);
-        assertTrue(
-                "the bigDecimal equivalent of 92233720368547.75806 is wrong",
-                valueOfJI.unscaledValue().toString().equals("0")
-                        && valueOfJI.scale() == 3);
-        assertTrue(
-                "the toString representation of 9223372036854775806 is wrong",
-                valueOfJI.toString().equals("0.000"));
-
-    }
-
-    public void test_BigDecimal_serialization() throws Exception {
-        // Regression for HARMONY-1896
-        char[] in = { '1', '5', '6', '7', '8', '7', '.', '0', '0' };
-        BigDecimal bd = new BigDecimal(in, 0, 9);
-
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        ObjectOutputStream oos = new ObjectOutputStream(bos);
-        oos.writeObject(bd);
-
-        ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
-        ObjectInputStream ois = new ObjectInputStream(bis);
-        BigDecimal nbd = (BigDecimal) ois.readObject();
-
-        assertEquals(bd.intValue(), nbd.intValue());
-        assertEquals(bd.doubleValue(), nbd.doubleValue(), 0.0);
-        assertEquals(bd.toString(), nbd.toString());
-    }
-
-    /**
-     * @tests java.math.BigDecimal#stripTrailingZero(long)
-     */
-    public void test_stripTrailingZero() {
-        BigDecimal sixhundredtest = new BigDecimal("600.0");
-        assertTrue("stripTrailingZero failed for 600.0",
-                ((sixhundredtest.stripTrailingZeros()).scale() == -2)
-                );
-
-        /* Single digit, no trailing zero, odd number */
-        BigDecimal notrailingzerotest = new BigDecimal("1");
-        assertTrue("stripTrailingZero failed for 1",
-                ((notrailingzerotest.stripTrailingZeros()).scale() == 0)
-                );
-
-        // BEGIN android-changed: preserve RI compatibility, so BigDecimal.equals (which checks
-        // value *and* scale) continues to work. https://issues.apache.org/jira/browse/HARMONY-4623
-        /* Zero */
-        BigDecimal zerotest = new BigDecimal("0.0000");
-        assertEquals("stripTrailingZero failed for 0.0000",
-                4, (zerotest.stripTrailingZeros()).scale() );
-        // END android-changed
-    }
-
-    public void testMathContextConstruction() {
-        String a = "-12380945E+61";
-        BigDecimal aNumber = new BigDecimal(a);
-        int precision = 6;
-        RoundingMode rm = RoundingMode.HALF_DOWN;
-        MathContext mcIntRm = new MathContext(precision, rm);
-        MathContext mcStr = new MathContext("precision=6 roundingMode=HALF_DOWN");
-        MathContext mcInt = new MathContext(precision);
-        BigDecimal res = aNumber.abs(mcInt);
-        assertEquals("MathContext Constructor with int precision failed",
-                res,
-                new BigDecimal("1.23809E+68"));
-
-        assertEquals("Equal MathContexts are not Equal ",
-                mcIntRm,
-                mcStr);
-
-        assertEquals("Different MathContext are reported as Equal ",
-                mcInt.equals(mcStr),
-                false);
-
-        assertEquals("Equal MathContexts have different hashcodes ",
-                mcIntRm.hashCode(),
-                mcStr.hashCode());
-
-        assertEquals("MathContext.toString() returning incorrect value",
-                mcIntRm.toString(),
-                "precision=6 roundingMode=HALF_DOWN");
-    }
-}
diff --git a/luni/src/test/java/tests/api/java/net/AllTests.java b/luni/src/test/java/tests/api/java/net/AllTests.java
index 61c9555..7733b96 100644
--- a/luni/src/test/java/tests/api/java/net/AllTests.java
+++ b/luni/src/test/java/tests/api/java/net/AllTests.java
@@ -16,6 +16,7 @@
 
 package tests.api.java.net;
 
+import java.net.OldURLClassLoaderTest;
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
@@ -39,7 +40,6 @@
         suite.addTestSuite(DatagramSocketImplFactoryTest.class);
         suite.addTestSuite(DatagramSocketImplTest.class);
         suite.addTestSuite(DatagramSocketTest.class);
-        suite.addTestSuite(ExcludedProxyTest.class);
         suite.addTestSuite(FileNameMapTest.class);
         suite.addTestSuite(HttpRetryExceptionTest.class);
         suite.addTestSuite(IDNTest.class);
@@ -67,7 +67,6 @@
         suite.addTestSuite(UnixSocketTest.class);
         suite.addTestSuite(URISyntaxExceptionTest.class);
         suite.addTestSuite(URITest.class);
-        suite.addTestSuite(URLClassLoaderTest.class);
         suite.addTestSuite(URLDecoderTest.class);
         suite.addTestSuite(URLEncoderTest.class);
         suite.addTestSuite(UnknownHostExceptionTest.class);
diff --git a/luni/src/test/java/tests/api/java/net/ExcludedProxyTest.java b/luni/src/test/java/tests/api/java/net/ExcludedProxyTest.java
deleted file mode 100644
index 7e01e18..0000000
--- a/luni/src/test/java/tests/api/java/net/ExcludedProxyTest.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package tests.api.java.net;
-
-import dalvik.annotation.BrokenTest;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.Socket;
-import java.net.InetSocketAddress;
-import java.net.Proxy;
-import java.net.SocketAddress;
-import java.net.URL;
-import java.net.URLConnection;
-
-import tests.support.Support_Configuration;
-import tests.support.resource.Support_Resources;
-import junit.framework.TestCase;
-import tests.util.TestEnvironment;
-
-/*
- * This test is designed for collecting all the testcases which needs a proxy
- * server. They will be moved to corresponding test class when ProxyHandler of
- * Jetty is ready in the future.
- *
- */
-
-@TestTargetClass(Proxy.class)
-public class ExcludedProxyTest extends TestCase {
-
-    @Override protected void setUp() throws Exception {
-        super.setUp();
-        TestEnvironment.reset();
-    }
-
-    /**
-     * @tests java.net.HttpURLConnection#usingProxy()
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Tests Proxy functionality. Indirect test.",
-        method = "Proxy",
-        args = {java.net.Proxy.Type.class, java.net.SocketAddress.class}
-    )
-    @BrokenTest("the host address isn't working anymore")
-    public void test_usingProxy() throws Exception {
-        try {
-            System.setProperty("http.proxyHost",
-                    Support_Configuration.ProxyServerTestHost);
-
-            URL u1 = new URL("http://" + Support_Configuration.HomeAddress);
-            URLConnection conn1 = u1.openConnection();
-            conn1.getInputStream();
-
-            boolean exception = false;
-            try {
-                System.setProperty("http.proxyPort", "81");
-                URL u3 = new URL("http://"
-                        + Support_Configuration.InetTestAddress);
-                URLConnection conn3 = u3.openConnection();
-                conn3.getInputStream();
-                fail("Should throw IOException");
-            } catch (IOException e) {
-                // expected
-            }
-
-            System.setProperty("http.proxyPort", "80");
-
-            URL u2 = new URL("http://"
-                    + Support_Configuration.ProxyServerTestHost
-                    + "/cgi-bin/test.pl");
-            java.net.HttpURLConnection conn2 = (java.net.HttpURLConnection) u2
-                    .openConnection();
-            conn2.setDoOutput(true);
-            conn2.setRequestMethod("POST");
-            OutputStream out2 = conn2.getOutputStream();
-            String posted2 = "this is a test";
-            out2.write(posted2.getBytes());
-            out2.close();
-            conn2.getResponseCode();
-            InputStream is2 = conn2.getInputStream();
-            String response2 = "";
-            byte[] b2 = new byte[1024];
-            int count2 = 0;
-            while ((count2 = is2.read(b2)) > 0)
-                response2 += new String(b2, 0, count2);
-            assertTrue("Response to POST method invalid", response2
-                    .equals(posted2));
-
-            String posted4 = "just a test";
-            URL u4 = new URL("http://"
-                    + Support_Configuration.ProxyServerTestHost
-                    + "/cgi-bin/test.pl");
-            java.net.HttpURLConnection conn4 = (java.net.HttpURLConnection) u4
-                    .openConnection();
-            conn4.setDoOutput(true);
-            conn4.setRequestMethod("POST");
-            conn4.setRequestProperty("Content-length", String.valueOf(posted4
-                    .length()));
-            OutputStream out = conn4.getOutputStream();
-            out.write(posted4.getBytes());
-            out.close();
-            conn4.getResponseCode();
-            InputStream is = conn4.getInputStream();
-            String response = "";
-            byte[] b4 = new byte[1024];
-            int count = 0;
-            while ((count = is.read(b4)) > 0)
-                response += new String(b4, 0, count);
-            assertTrue("Response to POST method invalid", response
-                    .equals(posted4));
-        } finally {
-            System.setProperties(null);
-        }
-    }
-
-    /**
-     * @tests java.net.SocketImpl#SocketImpl()
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Tests Proxy functionality. Indirect test.",
-        method = "Proxy",
-        args = {java.net.Proxy.Type.class, java.net.SocketAddress.class}
-    )
-    @BrokenTest("the host address isn't working anymore")
-    public void test_Constructor() {
-        try {
-            try {
-                System.setProperty("socksProxyHost",
-                        Support_Configuration.SocksServerTestHost);
-                System.setProperty("socksProxyPort", String
-                        .valueOf(Support_Configuration.SocksServerTestPort));
-                Socket s = new Socket(Support_Configuration.HomeAddress, 80);
-                OutputStream os = s.getOutputStream();
-                os.write("GET / HTTP/1.0\r\n\r\n".getBytes());
-                s.getInputStream();
-            } catch (IOException e) {
-                fail("Could not open socket: "
-                        + Support_Configuration.HomeAddress + " " + e);
-            }
-            boolean exception = false;
-            try {
-                System.setProperty("socksProxyHost",
-                        Support_Configuration.SocksServerTestHost);
-                System
-                        .setProperty(
-                                "socksProxyPort",
-                                String
-                                        .valueOf(Support_Configuration.SocksServerTestPort + 1));
-                Socket s = new Socket(Support_Configuration.HomeAddress, 80);
-                OutputStream os = s.getOutputStream();
-                os.write("GET / HTTP/1.0\r\n\r\n".getBytes());
-                s.getInputStream();
-            } catch (IOException e) {
-                exception = true;
-            }
-            assertTrue("Exception should have been thrown", exception);
-        } finally {
-            System.setProperties(null);
-        }
-    }
-
-    /**
-     * @tests java.net.URL#openConnection(Proxy)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Tests Proxy functionality. Indirect test.",
-        method = "Proxy",
-        args = {java.net.Proxy.Type.class, java.net.SocketAddress.class}
-    )
-    @BrokenTest("the host address isn't working anymore")
-    public void test_openConnectionLjava_net_Proxy() throws IOException {
-        SocketAddress addr1 = new InetSocketAddress(
-                Support_Configuration.ProxyServerTestHost, 808);
-        SocketAddress addr2 = new InetSocketAddress(
-                Support_Configuration.ProxyServerTestHost, 1080);
-        Proxy proxy1 = new Proxy(Proxy.Type.HTTP, addr1);
-        Proxy proxy2 = new Proxy(Proxy.Type.SOCKS, addr2);
-        Proxy proxyList[] = { proxy1, proxy2 };
-        for (int i = 0; i < proxyList.length; ++i) {
-            String posted = "just a test";
-            URL u = new URL("http://"
-                    + Support_Configuration.ProxyServerTestHost
-                    + "/cgi-bin/test.pl");
-            java.net.HttpURLConnection conn = (java.net.HttpURLConnection) u
-                    .openConnection(proxyList[i]);
-            conn.setDoOutput(true);
-            conn.setRequestMethod("POST");
-            conn.setRequestProperty("Content-length", String.valueOf(posted
-                    .length()));
-            OutputStream out = conn.getOutputStream();
-            out.write(posted.getBytes());
-            out.close();
-            conn.getResponseCode();
-            InputStream is = conn.getInputStream();
-            String response = "";
-            byte[] b = new byte[1024];
-            int count = 0;
-            while ((count = is.read(b)) > 0) {
-                response += new String(b, 0, count);
-            }
-            assertTrue("Response to POST method invalid", response
-                    .equals(posted));
-        }
-
-        URL httpUrl = new URL("http://abc.com");
-        URL jarUrl = new URL("jar:"
-                + Support_Resources.getResourceURL("/JUC/lf.jar!/plus.bmp"));
-        URL ftpUrl = new URL("ftp://" + Support_Configuration.FTPTestAddress
-                + "/nettest.txt");
-        URL fileUrl = new URL("file://abc");
-        URL[] urlList = { httpUrl, jarUrl, ftpUrl, fileUrl };
-        for (int i = 0; i < urlList.length; ++i) {
-            try {
-                urlList[i].openConnection(null);
-            } catch (IllegalArgumentException iae) {
-                // expected
-            }
-        }
-        // should not throw exception
-        fileUrl.openConnection(Proxy.NO_PROXY);
-    }
-}
diff --git a/luni/src/test/java/tests/api/java/net/SocketTest.java b/luni/src/test/java/tests/api/java/net/SocketTest.java
index d67e15d..c946ae8 100644
--- a/luni/src/test/java/tests/api/java/net/SocketTest.java
+++ b/luni/src/test/java/tests/api/java/net/SocketTest.java
@@ -3067,10 +3067,11 @@
     )
     public void test_connect_unknownhost() throws Exception {
         Socket socket = new Socket();
+        InetSocketAddress socketAddress = new InetSocketAddress("unknownhost", 12345);
         try {
-            socket.connect(new InetSocketAddress("unknownhost", 12345));
-            fail("Should throw UnknownHostException");
-        } catch (UnknownHostException e) {
+            socket.connect(socketAddress);
+            fail("Should throw IOException");
+        } catch (IOException e) {
             // expected
         }
     }
@@ -3087,11 +3088,11 @@
     )
     public void test_connect_unresolved_unknown() throws Exception {
         Socket socket = new Socket();
+        InetSocketAddress unresolved = InetSocketAddress.createUnresolved("unknownhost", 12345);
         try {
-            socket.connect(InetSocketAddress.createUnresolved("unknownhost",
-                    12345));
-            fail("Should throw UnknownHostException");
-        } catch (UnknownHostException e) {
+            socket.connect(unresolved);
+            fail("Should throw IOException");
+        } catch (IOException e) {
             // expected
         }
     }
@@ -3108,12 +3109,13 @@
     )
     public void test_connect_unresolved() throws Exception {
         Socket socket = new Socket();
+        InetSocketAddress unresolvedSocketAddress = InetSocketAddress.createUnresolved(
+                Support_Configuration.SocksServerTestHost,
+                Support_Configuration.SocksServerTestPort);
         try {
-            socket.connect(InetSocketAddress.createUnresolved(
-                    Support_Configuration.SocksServerTestHost,
-                    Support_Configuration.SocksServerTestPort));
-            fail("Should throw UnknownHostException");
-        } catch (UnknownHostException e) {
+            socket.connect(unresolvedSocketAddress);
+            fail("Should throw IOException");
+        } catch (IOException e) {
             // expected
         }
     }
diff --git a/luni/src/test/java/tests/api/java/net/URLClassLoaderTest.java b/luni/src/test/java/tests/api/java/net/URLClassLoaderTest.java
deleted file mode 100644
index 979834f..0000000
--- a/luni/src/test/java/tests/api/java/net/URLClassLoaderTest.java
+++ /dev/null
@@ -1,634 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package tests.api.java.net;
-
-import dalvik.annotation.BrokenTest;
-import dalvik.annotation.SideEffect;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
-import org.apache.harmony.security.tests.support.TestCertUtils;
-
-import tests.support.Support_Configuration;
-import tests.support.Support_PortManager;
-import tests.support.Support_TestWebData;
-import tests.support.Support_TestWebServer;
-import tests.support.resource.Support_Resources;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.net.URLStreamHandler;
-import java.net.URLStreamHandlerFactory;
-import java.security.CodeSource;
-import java.security.Permission;
-import java.security.PermissionCollection;
-import java.security.cert.Certificate;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Vector;
-import java.util.jar.Manifest;
-
-@TestTargetClass(
-    value = URLClassLoader.class,
-    untestedMethods = {
-        @TestTargetNew(
-            level = TestLevel.NOT_NECESSARY,
-            notes = "findClass uses defineClass which is not implemented",
-            method = "findClass",
-            args = {java.lang.String.class}
-        )
-    }
-)
-public class URLClassLoaderTest extends junit.framework.TestCase {
-
-    class BogusClassLoader extends ClassLoader {
-        public URL getResource(String res) {
-            try {
-                return new URL("http://test/BogusClassLoader");
-            } catch (MalformedURLException e) {
-                return null;
-            }
-        }
-    }
-
-    public class URLClassLoaderExt extends URLClassLoader {
-
-        public URLClassLoaderExt(URL[] urls) {
-            super(urls);
-        }
-
-        public Class<?> findClass(String cl) throws ClassNotFoundException {
-            return super.findClass(cl);
-        }
-    }
-
-    URLClassLoader ucl;
-    SecurityManager sm = new SecurityManager() {
-
-        public void checkPermission(Permission perm) {
-        }
-
-        public void checkCreateClassLoader() {
-            throw new SecurityException();
-        }
-    };
-
-    /**
-     * @tests java.net.URLClassLoader#URLClassLoader(java.net.URL[])
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "URLClassLoader",
-        args = {java.net.URL[].class}
-    )
-    public void test_Constructor$Ljava_net_URL() throws MalformedURLException {
-        URL[] u = new URL[0];
-        ucl = new URLClassLoader(u);
-        assertTrue("Failed to set parent", ucl != null
-                && ucl.getParent() == URLClassLoader.getSystemClassLoader());
-
-
-        URL [] urls = {new URL("http://foo.com/foo"),
-                       new URL("jar:file://foo.jar!/foo.c"),
-                       new URL("ftp://foo1/foo2/foo.c")};
-
-        URLClassLoader ucl1 = new URLClassLoader(urls);
-        assertTrue(urls.length == ucl1.getURLs().length);
-
-        try {
-            Class.forName("test", false, ucl);
-            fail("Should throw ClassNotFoundException");
-        } catch (ClassNotFoundException e) {
-            // expected
-        }
-
-        SecurityManager oldSm = System.getSecurityManager();
-        System.setSecurityManager(sm);
-        try {
-            new URLClassLoader(u);
-            fail("SecurityException should be thrown.");
-        } catch (SecurityException e) {
-            // expected
-        } finally {
-            System.setSecurityManager(oldSm);
-        }
-
-        try {
-            new URLClassLoader(new URL[] { null });
-        } catch(Exception e) {
-            fail("Unexpected exception was thrown: " + e.getMessage());
-        }
-    }
-
-    /**
-     * @tests java.net.URLClassLoader#URLClassLoader(java.net.URL[],
-     *        java.lang.ClassLoader)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "URLClassLoader",
-        args = {java.net.URL[].class, java.lang.ClassLoader.class}
-    )
-    public void test_Constructor$Ljava_net_URLLjava_lang_ClassLoader() {
-        ClassLoader cl = new BogusClassLoader();
-        URL[] u = new URL[0];
-        ucl = new URLClassLoader(u, cl);
-        URL res = ucl.getResource("J");
-        assertNotNull(res);
-        assertEquals("Failed to set parent", "/BogusClassLoader", res.getFile());
-
-        SecurityManager oldSm = System.getSecurityManager();
-        System.setSecurityManager(sm);
-        try {
-            new URLClassLoader(u, cl);
-            fail("SecurityException should be thrown.");
-        } catch (SecurityException e) {
-            // expected
-        } finally {
-            System.setSecurityManager(oldSm);
-        }
-    }
-
-    /**
-     * @tests java.net.URLClassLoader#findResources(java.lang.String)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "IOException checking missing. "
-            + "A test case that loads a resource from a webserver is missing.",
-        method = "findResources",
-        args = {java.lang.String.class}
-    )
-    @SideEffect("Support_TestWebServer requires isolation.")
-    public void test_findResourcesLjava_lang_String() throws Exception {
-        Enumeration<URL> res = null;
-        String[] resValues = { "This is a test resource file.",
-                "This is a resource from a subdir"};
-
-        String tmp = System.getProperty("java.io.tmpdir") + "/";
-
-        File tmpDir = new File(tmp);
-        File test1 = new File(tmp + "test0");
-        test1.deleteOnExit();
-        FileOutputStream out = new FileOutputStream(test1);
-        out.write(resValues[0].getBytes());
-        out.flush();
-        out.close();
-
-        File subDir = new File(tmp + "subdir/");
-        subDir.mkdir();
-        File test2 = new File(tmp + "subdir/test0");
-        test2.deleteOnExit();
-        out = new FileOutputStream(test2);
-        out.write(resValues[1].getBytes());
-        out.flush();
-        out.close();
-
-        URL[] urls = new URL[2];
-        urls[0] = new URL("file://" + tmpDir.getAbsolutePath() + "/");
-        urls[1] = new URL("file://" + subDir.getAbsolutePath() + "/");
-
-        ucl = new URLClassLoader(urls);
-        res = ucl.findResources("test0");
-        assertNotNull("Failed to locate resources", res);
-
-        int i = 0;
-        while (res.hasMoreElements()) {
-            StringBuffer sb = getResContent(res.nextElement());
-            assertEquals("Returned incorrect resource/or in wrong order",
-                    resValues[i++], sb.toString());
-        }
-        assertEquals("Incorrect number of resources returned", 2, i);
-    }
-
-    /**
-     * @tests java.net.URLClassLoader#getURLs()
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getURLs",
-        args = {}
-    )
-    public void test_getURLs() throws MalformedURLException {
-        URL[] urls = new URL[4];
-        urls[0] = new URL("http://" + Support_Configuration.HomeAddress);
-        urls[1] = new URL("http://" + Support_Configuration.TestResources + "/");
-        urls[2] = new URL("ftp://" + Support_Configuration.TestResources + "/");
-        urls[3] = new URL("jar:file:c://" + Support_Configuration.TestResources
-                + "!/");
-        ucl = new URLClassLoader(urls);
-        URL[] ucUrls = ucl.getURLs();
-        for (int i = 0; i < urls.length; i++) {
-            assertEquals("Returned incorrect URL[]", urls[i], ucUrls[i]);
-        }
-    }
-
-    /**
-     * @tests java.net.URLClassLoader#newInstance(java.net.URL[])
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "newInstance",
-        args = {java.net.URL[].class}
-    )
-    @BrokenTest("web address used from support doesn't work anymore")
-    public void test_newInstance$Ljava_net_URL() throws MalformedURLException,
-            ClassNotFoundException {
-        // Verify that loaded class' have correct permissions
-        Class cl = null;
-        URL res = null;
-        URL[] urls = new URL[1];
-        urls[0] = new URL(Support_Resources.getResourceURL("/UCL/UCL.jar"));
-        ucl = URLClassLoader.newInstance(urls);
-        cl = ucl.loadClass("ucl.ResClass");
-
-        res = cl.getClassLoader().getResource("XX.class");
-        assertNotNull("Failed to load class", cl);
-        assertNotNull(
-                "Loaded class unable to access resource from same codeSource",
-                res);
-        cl = null;
-
-        urls[0] = new URL("jar:"
-                + Support_Resources.getResourceURL("/UCL/UCL.jar!/"));
-        ucl = URLClassLoader.newInstance(urls);
-        cl = ucl.loadClass("ucl.ResClass");
-        assertNotNull("Failed to load class from explicit jar URL", cl);
-    }
-
-    /**
-     * @tests java.net.URLClassLoader#newInstance(java.net.URL[],
-     *        java.lang.ClassLoader)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "newInstance",
-        args = {java.net.URL[].class, java.lang.ClassLoader.class}
-    )
-    public void test_newInstance$Ljava_net_URLLjava_lang_ClassLoader() {
-        ClassLoader cl = new BogusClassLoader();
-        URL[] u = new URL[0];
-        ucl = URLClassLoader.newInstance(u, cl);
-        URL res = ucl.getResource("J");
-        assertNotNull(res);
-        assertEquals("Failed to set parent", "/BogusClassLoader", res.getFile());
-    }
-
-    /**
-     * @tests java.net.URLClassLoader#URLClassLoader(java.net.URL[],
-     *        java.lang.ClassLoader, java.net.URLStreamHandlerFactory)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "URLClassLoader",
-        args = {java.net.URL[].class, java.lang.ClassLoader.class,
-                java.net.URLStreamHandlerFactory.class}
-    )
-    public void test_Constructor$Ljava_net_URLLjava_lang_ClassLoaderLjava_net_URLStreamHandlerFactory() {
-        class TestFactory implements URLStreamHandlerFactory {
-            public URLStreamHandler createURLStreamHandler(String protocol) {
-                return null;
-            }
-        }
-        ClassLoader cl = new BogusClassLoader();
-        URL[] u = new URL[0];
-        ucl = new URLClassLoader(u, cl, new TestFactory());
-        URL res = ucl.getResource("J");
-        assertNotNull(res);
-        assertEquals("Failed to set parent", "/BogusClassLoader", res.getFile());
-
-        SecurityManager oldSm = System.getSecurityManager();
-        System.setSecurityManager(sm);
-        try {
-            new URLClassLoader(u, cl, new TestFactory());
-            fail("SecurityException should be thrown.");
-        } catch (SecurityException e) {
-            // expected
-        } finally {
-            System.setSecurityManager(oldSm);
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "addURL",
-        args = { URL.class }
-    )
-    public void test_addURLLjava_net_URL() throws MalformedURLException {
-        URL[] u = new URL[0];
-
-        URL [] urls = {new URL("http://foo.com/foo"),
-                       new URL("jar:file://foo.jar!/foo.c"),
-                       new URL("ftp://foo1/foo2/foo.c"), null};
-
-        TestURLClassLoader tucl = new TestURLClassLoader(u);
-
-        for(int i = 0; i < urls.length;) {
-            tucl.addURL(urls[i]);
-            i++;
-            URL [] result = tucl.getURLs();
-            assertEquals("Result array length is incorrect: " + i,
-                                                            i, result.length);
-            for(int j = 0; j < result.length; j++) {
-                assertEquals("Result array item is incorrect: " + j,
-                                                            urls[j], result[j]);
-            }
-        }
-    }
-
-    @TestTargetNew(
-        level = TestLevel.SUFFICIENT,
-        notes = "",
-        method = "getPermissions",
-        args = { CodeSource.class }
-    )
-    public void test_getPermissions() throws MalformedURLException {
-        URL url = new URL("http://" + Support_Configuration.SpecialInetTestAddress);
-        Certificate[] chain = TestCertUtils.getCertChain();
-        CodeSource cs = new CodeSource(url, chain);
-        TestURLClassLoader cl = new TestURLClassLoader(new URL[] {url});
-        PermissionCollection permCol = cl.getPermissions(cs);
-        assertNotNull(permCol);
-
-        URL url1 = new URL("file://foo/foo.c");
-        TestURLClassLoader cl1 = new TestURLClassLoader(new URL[] {url});
-        CodeSource cs1 = new CodeSource(url1, chain);
-        PermissionCollection permCol1 = cl1.getPermissions(cs1);
-        assertNotNull(permCol1);
-    }
-
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "definePackage",
-        args = { java.lang.String.class, java.util.jar.Manifest.class,
-                 java.net.URL.class }
-    )
-    public void test_definePackage() throws MalformedURLException {
-        Manifest manifest = new Manifest();
-        URL[] u = new URL[0];
-        TestURLClassLoader tucl = new TestURLClassLoader(u);
-
-        URL [] urls = {new URL("http://foo.com/foo"),
-                new URL("jar:file://foo.jar!/foo.c"),
-                new URL("ftp://foo1/foo2/foo.c"),
-                new URL("file://new/package/name/"),
-                null};
-
-        String packageName = "new.package.name";
-
-        for(int i = 0; i < urls.length; i++) {
-            Package pack = tucl.definePackage(packageName + i, manifest, urls[i]);
-            assertEquals(packageName + i, pack.getName());
-            assertNull("Implementation Title is not null",
-                    pack.getImplementationTitle());
-            assertNull("Implementation Vendor is not null",
-                    pack.getImplementationVendor());
-            assertNull("Implementation Version is not null.",
-                    pack.getImplementationVersion());
-        }
-
-        try {
-            tucl.definePackage(packageName + "0", manifest, null);
-            fail("IllegalArgumentException was not thrown.");
-        } catch(IllegalArgumentException iae) {
-            //expected
-        }
-    }
-
-    class TestURLClassLoader extends URLClassLoader {
-        public TestURLClassLoader(URL[] urls) {
-            super(urls);
-        }
-
-        public void addURL(URL url) {
-            super.addURL(url);
-        }
-
-        public Package definePackage(String name,
-                                     Manifest man,
-                                     URL url)
-                                     throws IllegalArgumentException {
-            return super.definePackage(name, man, url);
-        }
-
-        public Class<?> findClass(String name)
-                                        throws ClassNotFoundException {
-            return super.findClass(name);
-        }
-
-        protected PermissionCollection getPermissions(CodeSource codesource) {
-            return super.getPermissions(codesource);
-        }
-    }
-
-    /**
-     * @tests java.net.URLClassLoader#findResource(java.lang.String)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "findResource",
-        args = {java.lang.String.class}
-    )
-    @SideEffect("Support_TestWebServer requires isolation.")
-    public void test_findResourceLjava_lang_String() throws Exception {
-        int port = Support_PortManager.getNextPort();
-        File tmp = File.createTempFile("test", ".txt");
-
-        Support_TestWebServer server = new Support_TestWebServer();
-        try {
-
-            server.initServer(port, tmp.getAbsolutePath(), "text/html");
-
-            URL[] urls = { new URL("http://localhost:" + port + "/") };
-            ucl = new URLClassLoader(urls);
-            URL res = ucl.findResource("test1");
-            assertNotNull("Failed to locate resource", res);
-
-            StringBuffer sb = getResContent(res);
-            assertEquals("Returned incorrect resource", new String(Support_TestWebData.test1),
-                    sb.toString());
-        } finally {
-            server.close();
-        }
-    }
-
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.PARTIAL,
-            notes = "Checks getResource, indirectly checks findResource",
-            clazz = ClassLoader.class,
-            method = "getResource",
-            args = {java.lang.String.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "Checks getResource, indirectly checks findResource",
-            method = "findResource",
-            args = {java.lang.String.class}
-        )
-    })
-    public void testFindResource_H3461() throws Exception {
-        File tmpDir = new File(System.getProperty("java.io.tmpdir"));
-        File dir = new File(tmpDir, "encode#me");
-        File f, f2;
-        URLClassLoader loader;
-        URL dirUrl;
-
-        if (!dir.exists()) {
-            dir.mkdir();
-        }
-        dir.deleteOnExit();
-        dirUrl = dir.toURI().toURL();
-        loader = new URLClassLoader( new URL[] { dirUrl });
-
-        f = File.createTempFile("temp", ".dat", dir);
-        f.deleteOnExit();
-        f2 = File.createTempFile("bad#name#", ".dat", dir);
-        f2.deleteOnExit();
-
-        assertNotNull("Unable to load resource from path with problematic name",
-            loader.getResource(f.getName()));
-        assertEquals("URL was not correctly encoded",
-            f2.toURI().toURL(),
-            loader.getResource(f2.getName()));
-    }
-
-    /**
-     * @tests java.net.URLClassLoader#getResource(java.lang.String)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getResource",
-        args = {java.lang.String.class}
-    )
-    public void test_getResourceLjava_lang_String()
-            throws MalformedURLException {
-        URL url1 = new URL("file:///");
-        URLClassLoader loader = new URLClassLoader(new URL[] { url1 });
-        long start = System.currentTimeMillis();
-        // try without the leading /
-        URL result = loader.getResource("dir1/file1");
-        long end = System.currentTimeMillis();
-        long time = end - start;
-        if (time < 100) {
-            time = 100;
-        }
-
-        start = System.currentTimeMillis();
-        // try with the leading forward slash
-        result = loader.getResource("/dir1/file1");
-        end = System.currentTimeMillis();
-        long uncTime = end - start;
-        assertTrue("too long. UNC path formed? UNC time: " + uncTime
-                + " regular time: " + time, uncTime <= (time * 4));
-    }
-
-    /**
-     * Regression for Harmony-2237
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Regression test",
-        method = "findResource",
-        args = {java.lang.String.class}
-    )
-    @SideEffect("Support_TestWebServer requires isolation.")
-    public void test_findResource_String() throws Exception {
-        File tempFile1 = File.createTempFile("textFile", ".txt");
-        tempFile1.createNewFile();
-        tempFile1.deleteOnExit();
-        File tempFile2 = File.createTempFile("jarFile", ".jar");
-        tempFile2.delete();
-        tempFile2.deleteOnExit();
-
-        Support_TestWebServer server = new Support_TestWebServer();
-        int port = Support_PortManager.getNextPort();
-        try {
-            server.initServer(port, false);
-
-            String tempPath1 = tempFile1.getParentFile().getAbsolutePath() + "/";
-            InputStream is = getClass().getResourceAsStream(
-                    "/tests/resources/hyts_patch.jar");
-            Support_Resources.copyLocalFileto(tempFile2, is);
-            String tempPath2 = tempFile2.getAbsolutePath();
-            String tempPath3 = "http://localhost:" + port + "/";
-            URLClassLoader urlLoader = getURLClassLoader(tempPath1, tempPath2);
-            assertNull("Found inexistant resource",
-                    urlLoader.findResource("XXX"));
-            assertNotNull("Couldn't find resource from directory",
-                    urlLoader.findResource(tempFile1.getName()));
-            assertNotNull("Couldn't find resource from jar",
-                    urlLoader.findResource("Blah.txt"));
-            urlLoader = getURLClassLoader(tempPath1, tempPath2, tempPath3);
-            assertNotNull("Couldn't find resource from web",
-                    urlLoader.findResource("test1"));
-            assertNull("Found inexistant resource from web",
-                    urlLoader.findResource("test3"));
-        } finally {
-            server.close();
-        }
-    }
-
-    private static URLClassLoader getURLClassLoader(String... classPath)
-            throws MalformedURLException {
-        List<URL> urlList = new ArrayList<URL>();
-        for (String path : classPath) {
-            String url;
-            File f = new File(path);
-            if (f.isDirectory()) {
-                url = "file:" + path;
-            } else if (path.startsWith("http")) {
-                url = path;
-            } else {
-                url = "jar:file:" + path + "!/";
-            }
-            urlList.add(new URL(url));
-        }
-        return new URLClassLoader(urlList.toArray(new URL[urlList.size()]));
-    }
-
-    private StringBuffer getResContent(URL res) throws IOException {
-        StringBuffer sb = new StringBuffer();
-        InputStream is = res.openStream();
-
-        int c;
-        while ((c = is.read()) != -1) {
-            sb.append((char) c);
-        }
-        is.close();
-        return sb;
-    }
-}
diff --git a/luni/src/test/java/tests/api/javax/net/ssl/HandshakeCompletedEventTest.java b/luni/src/test/java/tests/api/javax/net/ssl/HandshakeCompletedEventTest.java
index 2945e33..9aa9612 100644
--- a/luni/src/test/java/tests/api/javax/net/ssl/HandshakeCompletedEventTest.java
+++ b/luni/src/test/java/tests/api/javax/net/ssl/HandshakeCompletedEventTest.java
@@ -666,7 +666,7 @@
      * for the result.
      */
     private KeyManager[] getKeyManagers(String keys) throws Exception {
-        byte[] bytes = new Base64().decode(keys.getBytes());
+        byte[] bytes = Base64.decode(keys.getBytes());
         InputStream inputStream = new ByteArrayInputStream(bytes);
 
         KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
@@ -740,4 +740,3 @@
         }
     }
 }
-
diff --git a/luni/src/test/java/tests/api/javax/net/ssl/SSLServerSocketTest.java b/luni/src/test/java/tests/api/javax/net/ssl/SSLServerSocketTest.java
index 53addf0..20ce035 100644
--- a/luni/src/test/java/tests/api/javax/net/ssl/SSLServerSocketTest.java
+++ b/luni/src/test/java/tests/api/javax/net/ssl/SSLServerSocketTest.java
@@ -568,7 +568,7 @@
      */
     private KeyManager[] getKeyManagers() throws Exception {
         String keys = (useBKS ? SERVER_KEYS_BKS : SERVER_KEYS_JKS);
-        byte[] bytes = new Base64().decode(keys.getBytes());
+        byte[] bytes = Base64.decode(keys.getBytes());
         InputStream inputStream = new ByteArrayInputStream(bytes);
 
         KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
diff --git a/luni/src/test/java/tests/api/javax/net/ssl/SSLSessionTest.java b/luni/src/test/java/tests/api/javax/net/ssl/SSLSessionTest.java
index bce302a..56fb9a0 100644
--- a/luni/src/test/java/tests/api/javax/net/ssl/SSLSessionTest.java
+++ b/luni/src/test/java/tests/api/javax/net/ssl/SSLSessionTest.java
@@ -867,7 +867,7 @@
      * for the result.
      */
     private KeyStore getKeyStore(String keys) throws Exception {
-        byte[] bytes = new Base64().decode(keys.getBytes());
+        byte[] bytes = Base64.decode(keys.getBytes());
         InputStream inputStream = new ByteArrayInputStream(bytes);
 
         KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
diff --git a/luni/src/test/java/tests/api/javax/net/ssl/SSLSocketTest.java b/luni/src/test/java/tests/api/javax/net/ssl/SSLSocketTest.java
index 44fec4e..0742a23 100644
--- a/luni/src/test/java/tests/api/javax/net/ssl/SSLSocketTest.java
+++ b/luni/src/test/java/tests/api/javax/net/ssl/SSLSocketTest.java
@@ -870,7 +870,7 @@
      * for the result.
      */
     private KeyManager[] getKeyManagers(String keys) throws Exception {
-        byte[] bytes = new Base64().decode(keys.getBytes());
+        byte[] bytes = Base64.decode(keys.getBytes());
         InputStream inputStream = new ByteArrayInputStream(bytes);
 
         KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
diff --git a/luni/src/test/java/tests/targets/security/cert/CertPathBuilderTest.java b/luni/src/test/java/tests/security/CertPathBuilderTest.java
similarity index 93%
rename from luni/src/test/java/tests/targets/security/cert/CertPathBuilderTest.java
rename to luni/src/test/java/tests/security/CertPathBuilderTest.java
index 2ac8131..1c82999 100644
--- a/luni/src/test/java/tests/targets/security/cert/CertPathBuilderTest.java
+++ b/luni/src/test/java/tests/security/CertPathBuilderTest.java
@@ -13,18 +13,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security.cert;
+package tests.security;
 
 import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetNew;
 import dalvik.annotation.TestTargets;
-
-import junit.framework.TestCase;
-
 import java.security.cert.CertPath;
 import java.security.cert.CertPathBuilder;
 import java.security.cert.CertPathBuilderResult;
 import java.security.cert.CertPathParameters;
+import junit.framework.TestCase;
 public abstract class CertPathBuilderTest extends TestCase {
 
     private final String algorithmName;
@@ -41,8 +39,8 @@
         params = getCertPathParameters();
     }
 
-    abstract CertPathParameters getCertPathParameters() throws Exception;
-    abstract void validateCertPath(CertPath path);
+    public abstract CertPathParameters getCertPathParameters() throws Exception;
+    public abstract void validateCertPath(CertPath path);
 
     @TestTargets({
         @TestTargetNew(
diff --git a/luni/src/test/java/tests/targets/security/cert/CertPathValidatorTest.java b/luni/src/test/java/tests/security/CertPathValidatorTest.java
similarity index 90%
rename from luni/src/test/java/tests/targets/security/cert/CertPathValidatorTest.java
rename to luni/src/test/java/tests/security/CertPathValidatorTest.java
index db5942d..2821f47 100644
--- a/luni/src/test/java/tests/targets/security/cert/CertPathValidatorTest.java
+++ b/luni/src/test/java/tests/security/CertPathValidatorTest.java
@@ -13,18 +13,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security.cert;
+package tests.security;
 
 import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetNew;
 import dalvik.annotation.TestTargets;
-
-import junit.framework.TestCase;
-
 import java.security.cert.CertPath;
 import java.security.cert.CertPathParameters;
 import java.security.cert.CertPathValidator;
 import java.security.cert.CertPathValidatorResult;
+import junit.framework.TestCase;
 
 public abstract class CertPathValidatorTest extends TestCase {
 
@@ -35,9 +33,9 @@
         this.algorithmName = algorithmName;
     }
 
-    abstract CertPathParameters getParams();
-    abstract CertPath getCertPath();
-    abstract void validateResult(CertPathValidatorResult validatorResult);
+    public abstract CertPathParameters getParams();
+    public abstract CertPath getCertPath();
+    public abstract void validateResult(CertPathValidatorResult validatorResult);
 
     @TestTargets({
         @TestTargetNew(
diff --git a/luni/src/test/java/tests/targets/security/cert/CertificateFactoryTest.java b/luni/src/test/java/tests/security/CertificateFactoryTest.java
similarity index 95%
rename from luni/src/test/java/tests/targets/security/cert/CertificateFactoryTest.java
rename to luni/src/test/java/tests/security/CertificateFactoryTest.java
index a5d7a46..1bfa2aa 100644
--- a/luni/src/test/java/tests/targets/security/cert/CertificateFactoryTest.java
+++ b/luni/src/test/java/tests/security/CertificateFactoryTest.java
@@ -13,19 +13,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security.cert;
+package tests.security;
 
 import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetNew;
 import dalvik.annotation.TestTargets;
-
-import junit.framework.TestCase;
-
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
 import java.security.cert.CertificateFactory;
+import junit.framework.TestCase;
 
 public abstract class CertificateFactoryTest extends TestCase {
 
diff --git a/luni/src/test/java/tests/targets/security/SecureRandomTest.java b/luni/src/test/java/tests/security/SecureRandomTest.java
similarity index 98%
rename from luni/src/test/java/tests/targets/security/SecureRandomTest.java
rename to luni/src/test/java/tests/security/SecureRandomTest.java
index 3203902..cf9c6dc 100644
--- a/luni/src/test/java/tests/targets/security/SecureRandomTest.java
+++ b/luni/src/test/java/tests/security/SecureRandomTest.java
@@ -13,17 +13,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
+package tests.security;
 
 import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetNew;
 import dalvik.annotation.TestTargets;
-
-import junit.framework.TestCase;
-
 import java.security.NoSuchAlgorithmException;
 import java.security.SecureRandom;
 import java.util.Arrays;
+import junit.framework.TestCase;
 public abstract class SecureRandomTest extends TestCase {
 
 
diff --git a/luni/src/test/java/tests/security/cert/AllTests.java b/luni/src/test/java/tests/security/cert/AllTests.java
index e5b9d47..ab86e89 100644
--- a/luni/src/test/java/tests/security/cert/AllTests.java
+++ b/luni/src/test/java/tests/security/cert/AllTests.java
@@ -16,6 +16,7 @@
 
 package tests.security.cert;
 
+import java.security.cert.OldPKIXParametersTest;
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
@@ -64,7 +65,6 @@
         suite.addTestSuite(PKIXCertPathBuilderResultTest.class);
         suite.addTestSuite(PKIXCertPathCheckerTest.class);
         suite.addTestSuite(PKIXCertPathValidatorResultTest.class);
-        suite.addTestSuite(PKIXParametersTest.class);
         suite.addTestSuite(PolicyQualifierInfoTest.class);
         suite.addTestSuite(TrustAnchorTest.class);
         suite.addTestSuite(X509CRL2Test.class);
diff --git a/luni/src/test/java/tests/security/cert/PKIXParametersTest.java b/luni/src/test/java/tests/security/cert/PKIXParametersTest.java
deleted file mode 100644
index 1b88b58..0000000
--- a/luni/src/test/java/tests/security/cert/PKIXParametersTest.java
+++ /dev/null
@@ -1,1879 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-/**
- * @author Vladimir N. Molotkov
- * @version $Revision$
- */
-
-package tests.security.cert;
-
-import dalvik.annotation.AndroidOnly;
-import dalvik.annotation.BrokenTest;
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import junit.framework.TestCase;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.CertPathParameters;
-import java.security.cert.CertPathValidatorException;
-import java.security.cert.CertStore;
-import java.security.cert.CertificateFactory;
-import java.security.cert.CollectionCertStoreParameters;
-import java.security.cert.PKIXCertPathChecker;
-import java.security.cert.PKIXParameters;
-import java.security.cert.TrustAnchor;
-import java.security.cert.X509CertSelector;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.harmony.security.tests.support.cert.TestUtils;
-
-import tests.targets.security.KeyStoreTestPKCS12;
-
-/**
- * Tests for <code>PKIXParameters</code> fields and methods
- */
-@TestTargetClass(PKIXParameters.class)
-public class PKIXParametersTest extends TestCase {
-    /**
-     * Some valid issuer name
-     */
-    private final static String testIssuer =
-        "CN=VM,OU=DRL Security,O=Intel,L=Novosibirsk,ST=NSO,C=RU";
-
-    //
-    // Tests
-    //
-
-    /**
-     * Test #1 for <code>PKIXParameters(Set)</code> constructor<br>
-     * Assertion: Creates an instance of <code>PKIXParameters</code> with the
-     * specified <code>Set</code> of most-trusted CAs. Each element of the set
-     * is a <code>TrustAnchor</code>
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies positive case.",
-        method = "PKIXParameters",
-        args = {java.util.Set.class}
-    )
-    public final void testPKIXParametersSet01()
-            throws InvalidAlgorithmParameterException {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-        // use valid parameter
-        CertPathParameters cpp = new PKIXParameters(taSet);
-        assertTrue(cpp instanceof PKIXParameters);
-    }
-
-    /**
-     * Test #2 for <code>PKIXParameters(Set)</code> constructor<br>
-     * Assertion: ... the <code>Set</code> is copied to protect against
-     * subsequent modifications
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Doesn't verify exceptions.",
-        method = "PKIXParameters",
-        args = {java.util.Set.class}
-    )
-    @SuppressWarnings("unchecked")
-    public final void testPKIXParametersSet02()
-            throws InvalidAlgorithmParameterException {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-        HashSet<TrustAnchor> originalSet = (HashSet<TrustAnchor>) taSet;
-        HashSet<TrustAnchor> originalSetCopy = (HashSet<TrustAnchor>) originalSet
-                .clone();
-        // create test object using originalSet
-        PKIXParameters pp = new PKIXParameters(originalSetCopy);
-        // modify originalSet
-        originalSetCopy.clear();
-        // check that test object's internal state
-        // has not been affected by the above modification
-        Set returnedSet = pp.getTrustAnchors();
-        assertEquals(originalSet, returnedSet);
-    }
-
-    /**
-     * Test #3 for <code>PKIXParameters(Set)</code> constructor<br>
-     * Assertion: <code>NullPointerException</code> - if the specified
-     * <code>Set</code> is null
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies NullPointerException.",
-        method = "PKIXParameters",
-        args = {java.util.Set.class}
-    )
-    public final void testPKIXParametersSet03() throws Exception {
-        try {
-            // pass null
-            new PKIXParameters((Set<TrustAnchor>) null);
-            fail("NPE expected");
-        } catch (NullPointerException e) {
-        }
-    }
-
-    /**
-     * Test #4 for <code>PKIXParameters(Set)</code> constructor<br>
-     * Assertion: <code>InvalidAlgorithmParameterException</code> - if the
-     * specified <code>Set</code> is empty (
-     * <code>trustAnchors.isEmpty() == true</code>)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies InvalidAlgorithmParameterException.",
-        method = "PKIXParameters",
-        args = {java.util.Set.class}
-    )
-    public final void testPKIXParametersSet04() {
-        try {
-            // use empty set
-            new PKIXParameters(new HashSet<TrustAnchor>());
-            fail("InvalidAlgorithmParameterException expected");
-        } catch (InvalidAlgorithmParameterException e) {
-        }
-    }
-
-    /**
-     * Test #5 for <code>PKIXParameters(Set)</code> constructor<br>
-     * Assertion: <code>ClassCastException</code> - if any of the elements in
-     * the <code>Set</code> are not of type
-     * <code>java.security.cert.TrustAnchor</code>
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies ClassCastException.",
-        method = "PKIXParameters",
-        args = {java.util.Set.class}
-    )
-    @SuppressWarnings("unchecked")
-    public final void testPKIXParametersSet05() throws Exception {
-        Set taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        // add wrong object to valid set
-        assertTrue(taSet.add(new Object()));
-        try {
-            new PKIXParameters(taSet);
-            fail("ClassCastException expected");
-        } catch (ClassCastException e) {
-        }
-    }
-
-    /**
-     * Test #3 for <code>PKIXParameters(KeyStore)</code> constructor<br>
-     * Assertion: <code>NullPointerException</code> - if the
-     * <code>keystore</code> is <code>null</code>
-     *
-     * @throws InvalidAlgorithmParameterException
-     * @throws KeyStoreException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies NullPointerException.",
-        method = "PKIXParameters",
-        args = {java.security.KeyStore.class}
-    )
-    public final void testPKIXParametersKeyStore03() throws Exception {
-        try {
-            // pass null
-            new PKIXParameters((KeyStore) null);
-            fail("NPE expected");
-        } catch (NullPointerException e) {
-        }
-    }
-
-    /**
-     * Test for <code>clone()</code> method<br>
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "clone",
-        args = {}
-    )
-    public final void testClone() throws InvalidAlgorithmParameterException {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters cpp = new PKIXParameters(taSet);
-        PKIXParameters cppc = (PKIXParameters) cpp.clone();
-
-        assertEquals(cpp.getPolicyQualifiersRejected(), cppc
-                .getPolicyQualifiersRejected());
-        assertEquals(cpp.getCertPathCheckers(), cppc.getCertPathCheckers());
-        assertEquals(cpp.getCertStores(), cppc.getCertStores());
-        assertEquals(cpp.getDate(), cppc.getDate());
-        assertEquals(cpp.getInitialPolicies(), cppc.getInitialPolicies());
-        assertEquals(cpp.getSigProvider(), cppc.getSigProvider());
-        assertEquals(cpp.getTargetCertConstraints(), cppc
-                .getTargetCertConstraints());
-        assertEquals(cpp.getTrustAnchors(), cppc.getTrustAnchors());
-
-        assertEquals(cpp.isAnyPolicyInhibited(), cppc.isAnyPolicyInhibited());
-        assertEquals(cpp.isExplicitPolicyRequired(), cppc
-                .isExplicitPolicyRequired());
-        assertEquals(cpp.isPolicyMappingInhibited(), cppc
-                .isPolicyMappingInhibited());
-        assertEquals(cpp.isRevocationEnabled(), cppc.isRevocationEnabled());
-
-        cpp.setDate(Calendar.getInstance().getTime());
-        cpp.setPolicyQualifiersRejected(!cppc.getPolicyQualifiersRejected());
-        assertFalse(cpp.getDate().equals(cppc.getDate()));
-        assertFalse(cpp.getPolicyQualifiersRejected() == cppc
-                .getPolicyQualifiersRejected());
-
-        cppc.setExplicitPolicyRequired(!cpp.isExplicitPolicyRequired());
-        cppc.setRevocationEnabled(!cpp.isRevocationEnabled());
-
-        assertFalse(cpp.isExplicitPolicyRequired() == cppc
-                .isExplicitPolicyRequired());
-        assertFalse(cpp.isRevocationEnabled() == cppc.isRevocationEnabled());
-
-        PKIXParameters cpp1 = null;
-        try {
-            cpp1.clone();
-        } catch (NullPointerException e) {
-            // expected
-        }
-    }
-
-    /**
-     * Test #1 for <code>getPolicyQualifiersRejected()</code> method<br>
-     * Assertion: When a <code>PKIXParameters</code> object is created, this
-     * flag is set to <code>true</code><br>
-     * Assertion: returns the current value of the PolicyQualifiersRejected flag
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getPolicyQualifiersRejected",
-        args = {}
-    )
-    public final void testGetPolicyQualifiersRejected() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        assertTrue(p.getPolicyQualifiersRejected());
-    }
-
-    /**
-     * Test for <code>setPolicyQualifiersRejected()</code> method<br>
-     * Assertion: set the new value of the <code>PolicyQualifiersRejected</code>
-     * flag
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setPolicyQualifiersRejected",
-        args = {boolean.class}
-    )
-    public final void testSetPolicyQualifiersRejected() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        p.setPolicyQualifiersRejected(false);
-        assertFalse("setFalse", p.getPolicyQualifiersRejected());
-        p.setPolicyQualifiersRejected(true);
-        assertTrue("setTrue", p.getPolicyQualifiersRejected());
-    }
-
-    /**
-     * Test for <code>isAnyPolicyInhibited()</code> method<br>
-     * Assertion: returns <code>true</code> if the any policy OID is inhibited,
-     * <code>false</code> otherwise<br>
-     * Assertion: By default, the any policy OID is not inhibited (
-     * <code>isAnyPolicyInhibited()</code> returns false).
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isAnyPolicyInhibited",
-        args = {}
-    )
-    public final void testIsAnyPolicyInhibited() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        assertFalse(p.isAnyPolicyInhibited());
-    }
-
-    /**
-     * Test for <code>setAnyPolicyInhibited()</code> method<br>
-     * Assertion: sets state to determine if the any policy OID should be
-     * processed if it is included in a certificate
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setAnyPolicyInhibited",
-        args = {boolean.class}
-    )
-    public final void testSetAnyPolicyInhibited() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        p.setAnyPolicyInhibited(true);
-        assertTrue("setTrue", p.isAnyPolicyInhibited());
-        p.setAnyPolicyInhibited(false);
-        assertFalse("setFalse", p.isAnyPolicyInhibited());
-    }
-
-    /**
-     * Test for <code>isExplicitPolicyRequired()</code> method<br>
-     * Assertion: returns <code>true</code> if explicit policy is required,
-     * <code>false</code> otherwise<br>
-     * Assertion: by default, the ExplicitPolicyRequired flag is false
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isExplicitPolicyRequired",
-        args = {}
-    )
-    public final void testIsExplicitPolicyRequired() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        assertFalse(p.isExplicitPolicyRequired());
-    }
-
-    /**
-     * Test for <code>setExplicitPolicyRequired()</code> method<br>
-     * Assertion: sets the ExplicitPolicyRequired flag
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setExplicitPolicyRequired",
-        args = {boolean.class}
-    )
-    public final void testSetExplicitPolicyRequired() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        p.setExplicitPolicyRequired(true);
-        assertTrue("setTrue", p.isExplicitPolicyRequired());
-        p.setExplicitPolicyRequired(false);
-        assertFalse("setFalse", p.isExplicitPolicyRequired());
-    }
-
-    /**
-     * Test for <code>isPolicyMappingInhibited()</code> method<br>
-     * Assertion: returns true if policy mapping is inhibited, false otherwise
-     * Assertion: by default, policy mapping is not inhibited (the flag is
-     * false)
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isPolicyMappingInhibited",
-        args = {}
-    )
-    public final void testIsPolicyMappingInhibited() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName() + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        assertFalse(p.isPolicyMappingInhibited());
-
-        CertificateFactory cf = CertificateFactory.getInstance("X.509");
-        TestUtils.initCertPathSSCertChain();
-        Set<TrustAnchor> taSet2 = Collections.singleton(new TrustAnchor(
-               TestUtils.rootCertificateSS, null));
-        p = new PKIXParameters(taSet2);
-
-        assertFalse(p.isPolicyMappingInhibited());
-        p.setPolicyMappingInhibited(true);
-        assertTrue(p.isRevocationEnabled());
-    }
-
-    /**
-     * Test for <code>setPolicyMappingInhibited()</code> method<br>
-     * Assertion: sets the PolicyMappingInhibited flag
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setPolicyMappingInhibited",
-        args = {boolean.class}
-    )
-    public final void testSetPolicyMappingInhibited() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        p.setPolicyMappingInhibited(true);
-        assertTrue("setTrue", p.isPolicyMappingInhibited());
-        p.setPolicyMappingInhibited(false);
-        assertFalse("setFalse", p.isPolicyMappingInhibited());
-    }
-
-    /**
-     * Test for <code>isPolicyMappingInhibited()</code> method<br>
-     * Assertion: returns the current value of the RevocationEnabled flag
-     * Assertion: when a <code>PKIXParameters</code> object is created, this
-     * flag is set to true
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "isRevocationEnabled",
-        args = {}
-    )
-    public final void testIsRevocationEnabled() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        assertTrue(p.isRevocationEnabled());
-
-        CertificateFactory cf = CertificateFactory.getInstance("X.509");
-       TestUtils.initCertPathSSCertChain();
-       Set<TrustAnchor> taSet2 = Collections.singleton(new TrustAnchor(
-              TestUtils.rootCertificateSS, null));
-       p = new PKIXParameters(taSet2);
-
-       assertTrue(p.isRevocationEnabled());
-       p.setRevocationEnabled(false);
-       assertFalse(p.isRevocationEnabled());
-    }
-
-    /**
-     * Test for <code>isPolicyMappingInhibited()</code> method<br>
-     * Assertion: sets the RevocationEnabled flag
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setRevocationEnabled",
-        args = {boolean.class}
-    )
-    public final void testSetRevocationEnabled() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        p.setRevocationEnabled(false);
-        assertFalse("setFalse", p.isRevocationEnabled());
-        p.setRevocationEnabled(true);
-        assertTrue("setTrue", p.isRevocationEnabled());
-    }
-
-    /**
-     * Test for <code>getSigProvider()</code> method<br>
-     * Assertion: returns the signature provider's name, or null if not set
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "getSigProvider",
-        args = {}
-    )
-    public final void testGetSigProvider() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        assertNull("not set", p.getSigProvider());
-        p.setSigProvider("Some Provider");
-        assertNotNull("set", p.getSigProvider());
-    }
-
-    /**
-     * Test for <code>setSigProvider(String)</code> method<br>
-     * Assertion: sets the signature provider's name
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setSigProvider",
-        args = {java.lang.String.class}
-    )
-    public final void testSetSigProvider() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        String sigProviderName = "Some Provider";
-        p.setSigProvider(sigProviderName);
-        assertTrue("set", sigProviderName.equals(p.getSigProvider()));
-        p.setSigProvider(null);
-        assertNull("unset", p.getSigProvider());
-    }
-
-    /**
-     * Test #1 for <code>getTargetCertConstraints()</code> method<br>
-     * Assertion: returns a <code>CertSelector</code> specifying the constraints
-     * on the target certificate (or <code>null</code>)
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies that getTargetCertConstraints method returns null, if no constraints are defined.",
-        method = "getTargetCertConstraints",
-        args = {}
-    )
-    public final void testGetTargetCertConstraints01() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        assertNull(p.getTargetCertConstraints());
-    }
-
-    /**
-     * Test #2 for <code>getTargetCertConstraints()</code> method<br>
-     * Assertion: note that the <code>CertSelector</code> returned is cloned to
-     * protect against subsequent modifications
-     *
-     * @throws InvalidAlgorithmParameterException
-     * @throws IOException
-     */
-    @TestTargets({
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "Verifies that returned CertSelector is cloned to protect against subsequent modifications.",
-        method = "setTargetCertConstraints",
-        args = {java.security.cert.CertSelector.class}
-    ),
-    @TestTargetNew(
-            level = TestLevel.PARTIAL_COMPLETE,
-            notes = "",
-            method = "getTargetCertConstraints",
-            args = {}
-        )
-    })
-    public final void testGetTargetCertConstraints02() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        X509CertSelector x509cs = new X509CertSelector();
-        PKIXParameters p = new PKIXParameters(taSet);
-        p.setTargetCertConstraints(x509cs);
-        // get cert selector
-        X509CertSelector cs1 = (X509CertSelector)p.getTargetCertConstraints();
-        X509CertSelector cs3 = (X509CertSelector)p.getTargetCertConstraints();
-        assertNotNull(cs1);
-        // modify returned selector
-        cs1.setIssuer(testIssuer);
-        // get cert selector again
-        X509CertSelector cs2 = (X509CertSelector)p.getTargetCertConstraints();
-        // check that selector is not the same
-        assertNotSame("notTheSame", cs1, cs2);
-        // check that selector's internal state has
-        // not been changed by above modification
-        assertFalse("internal stateNotChanged", testIssuer.equals(cs2.getIssuerAsString()));
-    }
-
-    /**
-     * Test for <code>setTargetCertConstraints(CertSelector)</code> method<br>
-     * Assertion: sets the required constraints on the target certificate. The
-     * constraints are specified as an instance of CertSelector<br>
-     * Assertion: ... If <code>null</code>, no constraints are defined
-     *
-     * @throws IOException
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "setTargetCertConstraints",
-        args = {java.security.cert.CertSelector.class}
-    )
-    public final void testSetTargetCertConstraints01() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        X509CertSelector x509cs = new X509CertSelector();
-        x509cs.setIssuer(testIssuer);
-        PKIXParameters p = new PKIXParameters(taSet);
-        p.setTargetCertConstraints(x509cs);
-        assertEquals("set", testIssuer, ((X509CertSelector) p
-                .getTargetCertConstraints()).getIssuerAsString());
-        p.setTargetCertConstraints(null);
-        assertNull("unset", p.getTargetCertConstraints());
-    }
-
-    /**
-     * Test #2 for <code>setTargetCertConstraints(CertSelector)</code> method<br>
-     * Assertion: ... the CertSelector specified is cloned to protect against
-     * subsequent modifications
-     *
-     * @throws IOException
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Additional test.",
-        method = "setTargetCertConstraints",
-        args = {java.security.cert.CertSelector.class}
-    )
-    public final void testSetTargetCertConstraints02() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        X509CertSelector x509cs = new X509CertSelector();
-        PKIXParameters p = new PKIXParameters(taSet);
-        p.setTargetCertConstraints(x509cs);
-        // modify selector
-        x509cs.setIssuer(testIssuer);
-        // get selector
-        X509CertSelector x509cs1 = (X509CertSelector) p
-                .getTargetCertConstraints();
-        // check that selector's internal state has
-        // not been changed by above modification
-        assertFalse(testIssuer.equals(x509cs1.getIssuerAsString()));
-    }
-
-    /**
-     * Test #1 for <code>getCertStores()</code> method<br>
-     * Assertion: list ... (may be empty, but never <code>null</code>)
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies that getCertStores method returns empty list, but not null.",
-        method = "getCertStores",
-        args = {}
-    )
-    public final void testGetCertStores01() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        assertNotNull("notNull", p.getCertStores());
-        assertTrue("isEmpty", p.getCertStores().isEmpty());
-    }
-
-    /**
-     * Test #2 for <code>getCertStores()</code> method<br>
-     * Assertion: returns an immutable <code>List</code> of
-     * <code>CertStores</code>
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies that getCertStores method returns an immutable List of CertStores.",
-        method = "getCertStores",
-        args = {}
-    )
-    public final void testGetCertStores02() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        List<CertStore> cs = p.getCertStores();
-
-        try {
-            // try to modify returned list
-            cs.add((CertStore) (new Object()));
-            fail("must be immutable");
-        } catch (Exception e) {
-        }
-    }
-
-    /**
-     * Test #1 for <code>setCertStores(List)</code> method<br>
-     * Assertion: Sets the list of CertStores ...
-     *
-     * @throws NoSuchAlgorithmException
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Doesn't verify ClassCastException.",
-        method = "setCertStores",
-        args = {java.util.List.class}
-    )
-    public final void testSetCertStores01() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        p.setCertStores(TestUtils.getCollectionCertStoresList());
-        // check that list has been set
-        assertFalse(p.getCertStores().isEmpty());
-    }
-
-    /**
-     * Test #2 for <code>setCertStores(List)</code> method<br>
-     * Assertion: list ... may be <code>null</code>
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Doesn't verify ClassCastException.",
-        method = "setCertStores",
-        args = {java.util.List.class}
-    )
-    public final void testSetCertStores02() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        // add null
-        p.setCertStores(null);
-        // check that we have non null empty list now
-        assertNotNull("notNull1", p.getCertStores());
-        assertTrue("isEmpty1", p.getCertStores().isEmpty());
-        // add empty
-        p.setCertStores(new ArrayList<CertStore>());
-        assertNotNull("notNull2", p.getCertStores());
-        assertTrue("isEmpty2", p.getCertStores().isEmpty());
-    }
-
-    /**
-     * Test #3 for <code>setCertStores(List)</code> method<br>
-     * Assertion: list is copied to protect against subsequent modifications
-     *
-     * @throws NoSuchAlgorithmException
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies that the list is copied to protect against subsequent modifications.",
-        method = "setCertStores",
-        args = {java.util.List.class}
-    )
-    public final void testSetCertStores03() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        List<CertStore> l = TestUtils.getCollectionCertStoresList();
-        p.setCertStores(l);
-        // modify list just set
-        l.clear();
-        // check that list maintained internally has
-        // not been changed by the above modification
-        assertFalse(p.getCertStores().isEmpty());
-    }
-
-    /**
-     * Test #4 for <code>setCertStores(List)</code> method<br>
-     * Assertion: <code>ClassCastException</code> - if any of the elements in
-     * the list are not of type <code>java.security.cert.CertStore</code>
-     *
-     * @throws InvalidAlgorithmParameterException
-     * @throws NoSuchAlgorithmException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies ClassCastException.",
-        method = "setCertStores",
-        args = {java.util.List.class}
-    )
-    @SuppressWarnings("unchecked")
-    public final void testSetCertStores04() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        List l = TestUtils.getCollectionCertStoresList();
-        // add wrong object to valid set
-        assertTrue(l.add(new Object()));
-
-        try {
-            p.setCertStores(l);
-            fail("ClassCastException expected");
-        } catch (ClassCastException e) {
-        }
-    }
-
-    /**
-     * Test #1 for <code>addCertStore(CertStore)</code> method<br>
-     * Assertion: adds a <code>CertStore</code> to the end of the list of
-     * <code>CertStores</code>
-     *
-     * @throws InvalidAlgorithmParameterException
-     * @throws NoSuchAlgorithmException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Doesn't verify ClassCastException.",
-        method = "addCertStore",
-        args = {java.security.cert.CertStore.class}
-    )
-    public final void testAddCertStore01() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        p.addCertStore(CertStore.getInstance("Collection",
-                new CollectionCertStoreParameters()));
-        assertFalse(p.getCertStores().isEmpty());
-    }
-
-    /**
-     * Test #2 for <code>addCertStore(CertStore)</code> method<br>
-     * Assertion: if <code>null</code>, the store is ignored (not added to list)
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies null as a parameter.",
-        method = "addCertStore",
-        args = {java.security.cert.CertStore.class}
-    )
-    public final void testAddCertStore02() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        p.addCertStore(null);
-        assertTrue(p.getCertStores().isEmpty());
-    }
-
-    /**
-     * Test #1 for <code>getCertPathCheckers()</code> method<br>
-     * Assertion: list ... may be empty, but not <code>null</code>
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies that getCertPathCheckers method returns not empty list.",
-        method = "getCertPathCheckers",
-        args = {}
-    )
-    public final void testGetCertPathCheckers01() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        List l = p.getCertPathCheckers();
-        assertNotNull("notNull", l);
-        assertTrue("isEmpty", l.isEmpty());
-    }
-
-    /**
-     * Test #2 for <code>getCertPathCheckers()</code> method<br>
-     * Assertion: returns an immutable <code>List</code> of
-     * <code>PKIXCertPathChecker</code>s
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies that getCertPathCheckers method returns an immutable List of PKIXCertPathChecker objects.",
-        method = "getCertPathCheckers",
-        args = {}
-    )
-    public final void testGetCertPathCheckers02() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        List<PKIXCertPathChecker> l = p.getCertPathCheckers();
-
-        try {
-            // try to modify returned list
-            l.add((PKIXCertPathChecker) new Object());
-            fail("must be immutable");
-        } catch (Exception e) {
-        }
-    }
-
-    /**
-     * Test #3 for <code>getCertPathCheckers()</code> method<br>
-     * Assertion: The returned List is immutable, and each
-     * <code>PKIXCertPathChecker</code> in the <code>List</code> is cloned to
-     * protect against subsequent modifications
-     *
-     * @throws InvalidAlgorithmParameterException
-     * @throws CertPathValidatorException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies that the returned List is immutable, and each PKIXCertPathChecker in the List is cloned to protect against subsequent modifications.",
-        method = "getCertPathCheckers",
-        args = {}
-    )
-    public final void testGetCertPathCheckers03() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        PKIXCertPathChecker cpc = TestUtils.getTestCertPathChecker();
-        List<PKIXCertPathChecker> l = new ArrayList<PKIXCertPathChecker>();
-        assertTrue("addedOk", l.add(cpc));
-        p.setCertPathCheckers(l);
-        // retrieve checker and modify it
-        PKIXCertPathChecker cpc1 = p.getCertPathCheckers().get(0);
-        cpc1.init(true);
-        assertTrue("modifiedOk", cpc1.isForwardCheckingSupported());
-        // retrieve checker again and check
-        // that its state has not been changed
-        // by the above modification
-        PKIXCertPathChecker cpc2 = p.getCertPathCheckers().get(0);
-        assertFalse("isCloned", cpc2.isForwardCheckingSupported());
-    }
-
-    /**
-     * Test #1 for <code>setCertPathCheckers(List)</code> method<br>
-     * Assertion: sets a <code>List</code> of additional certification path
-     * checkers
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Doesn't verify exceptions.",
-        method = "setCertPathCheckers",
-        args = {java.util.List.class}
-    )
-    public final void testSetCertPathCheckers01() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        PKIXCertPathChecker cpc = TestUtils.getTestCertPathChecker();
-        List<PKIXCertPathChecker> l = new ArrayList<PKIXCertPathChecker>();
-        assertTrue("addedOk", l.add(cpc));
-        p.setCertPathCheckers(l);
-        List l1 = p.getCertPathCheckers();
-        assertNotNull("notNull", l1);
-        assertFalse("isNotEmpty", l1.isEmpty());
-    }
-
-    /**
-     * Test #2 for <code>setCertPathCheckers(List)</code> method<br>
-     * Assertion: <code>List</code> ... may be null
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Doesn't verify exceptions.",
-        method = "setCertPathCheckers",
-        args = {java.util.List.class}
-    )
-    public final void testSetCertPathCheckers02() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        p.setCertPathCheckers(null);
-        List<PKIXCertPathChecker> l1 = p.getCertPathCheckers();
-        assertNotNull("notNull1", l1);
-        assertTrue("isEmpty1", l1.isEmpty());
-        p.setCertPathCheckers(new ArrayList<PKIXCertPathChecker>());
-        List l2 = p.getCertPathCheckers();
-        assertNotNull("notNull2", l2);
-        assertTrue("isEmpty2", l2.isEmpty());
-    }
-
-    /**
-     * Test #3 for <code>setCertPathCheckers(List)</code> method<br>
-     * Assertion: <code>List</code> supplied here is copied and each
-     * <code>PKIXCertPathChecker</code> in the list is cloned to protect against
-     * subsequent modifications
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Doesn't verify exceptions.",
-        method = "setCertPathCheckers",
-        args = {java.util.List.class}
-    )
-    public final void testSetCertPathCheckers03() throws Exception {
-        // checks that list copied
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        PKIXCertPathChecker cpc = TestUtils.getTestCertPathChecker();
-        List<PKIXCertPathChecker> l = new ArrayList<PKIXCertPathChecker>();
-        assertTrue("addedOk", l.add(cpc));
-        p.setCertPathCheckers(l);
-        // modify list
-        l.clear();
-        // retrieve list and check
-        // that its state has not been changed
-        // by the above modification
-        assertFalse("isCopied", p.getCertPathCheckers().isEmpty());
-    }
-
-    /**
-     * Test #4 for <code>setCertPathCheckers(List)</code> method<br>
-     * Assertion: <code>List</code> supplied here is copied and each
-     * <code>PKIXCertPathChecker</code> in the list is cloned to protect against
-     * subsequent modifications
-     *
-     * @throws InvalidAlgorithmParameterException
-     * @throws InvalidAlgorithmParameterException
-     * @throws CertPathValidatorException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Doesn't verify exceptions.",
-        method = "setCertPathCheckers",
-        args = {java.util.List.class}
-    )
-    public final void testSetCertPathCheckers04() throws Exception {
-        // checks that checkers cloned
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        PKIXCertPathChecker cpc = TestUtils.getTestCertPathChecker();
-        List<PKIXCertPathChecker> l = new ArrayList<PKIXCertPathChecker>();
-        assertTrue("addedOk", l.add(cpc));
-        p.setCertPathCheckers(l);
-        // modify checker
-        cpc.init(true);
-        // retrieve list and check that CertPathChecker's
-        // state it contains has not been changed by the
-        // above modification
-        PKIXCertPathChecker cpc1 = p.getCertPathCheckers().get(0);
-        assertFalse("isCopied", cpc1.isForwardCheckingSupported());
-    }
-
-    /**
-     * Test #5 for <code>setCertPathCheckers(List)</code> method<br>
-     * Assertion: <code>ClassCastException</code> - if any of the elements in
-     * the list are not of type
-     * <code>java.security.cert.PKIXCertPathChecker</code>
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verify exception.",
-        method = "setCertPathCheckers",
-        args = {java.util.List.class}
-    )
-    @SuppressWarnings("unchecked")
-    public final void testSetCertPathCheckers05() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        PKIXCertPathChecker cpc = TestUtils.getTestCertPathChecker();
-        List l = new ArrayList<PKIXCertPathChecker>();
-        assertTrue("addedOk", l.add(cpc));
-        // add wrong object to the list
-        assertTrue("addedOk", l.add(new Object()));
-
-        try {
-            p.setCertPathCheckers(l);
-            fail("ClassCastException expected");
-        } catch (ClassCastException e) {
-        }
-    }
-
-    /**
-     * Test #1 for <code>addCertPathChecker(PKIXCertPathChecker)</code> method<br>
-     * Assertion: adds a <code>CertPathChecker</code> to the end of the list of
-     * <code>CertPathChecker</code>s
-     *
-     * @throws CertPathValidatorException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "addCertPathChecker",
-        args = {java.security.cert.PKIXCertPathChecker.class}
-    )
-    public final void testAddCertPathChecker01() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        PKIXCertPathChecker cpc = TestUtils.getTestCertPathChecker();
-        List<PKIXCertPathChecker> l = new ArrayList<PKIXCertPathChecker>();
-        assertTrue("addedOk", l.add(cpc));
-        p.setCertPathCheckers(l);
-        // create one more PKIXCertPathChecker
-        PKIXCertPathChecker cpc1 = TestUtils.getTestCertPathChecker();
-        cpc1.init(true);
-        p.addCertPathChecker(cpc1);
-        // check that we have two PKIXCertPathCheckers and
-        // they are in right order
-        List l1 = p.getCertPathCheckers();
-        assertEquals("listSize", 2, l1.size());
-        assertFalse("order1", ((PKIXCertPathChecker) l1.get(0))
-                .isForwardCheckingSupported());
-        assertTrue("order2", ((PKIXCertPathChecker) l1.get(1))
-                .isForwardCheckingSupported());
-    }
-
-    /**
-     * Test #2 for <code>addCertPathChecker(PKIXCertPathChecker)</code> method<br>
-     * Assertion: if null, the checker is ignored (not added to list).
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies that if PKIXCertPathChecker parameter is null, the checker is ignored (not added to list).",
-        method = "addCertPathChecker",
-        args = {java.security.cert.PKIXCertPathChecker.class}
-    )
-    public final void testAddCertPathChecker02() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        PKIXCertPathChecker cpc = TestUtils.getTestCertPathChecker();
-        List<PKIXCertPathChecker> l = new ArrayList<PKIXCertPathChecker>();
-        assertTrue("addedOk", l.add(cpc));
-        p.setCertPathCheckers(l);
-        // try to add null
-        p.addCertPathChecker(null);
-        // check that we have one PKIXCertPathChecker
-        List l1 = p.getCertPathCheckers();
-        assertEquals("listSize", 1, l1.size());
-    }
-
-    /**
-     * Test #3 for <code>addCertPathChecker(PKIXCertPathChecker)</code> method<br>
-     * Assertion: <code>PKIXCertPathChecker</code> is cloned to protect against
-     * subsequent modifications
-     *
-     * @throws InvalidAlgorithmParameterException
-     * @throws CertPathValidatorException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies that PKIXCertPathChecker is cloned to protect against subsequent modifications.",
-        method = "addCertPathChecker",
-        args = {java.security.cert.PKIXCertPathChecker.class}
-    )
-    public final void testAddCertPathChecker03() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        // checks that checkers cloned
-        PKIXParameters p = new PKIXParameters(taSet);
-        PKIXCertPathChecker cpc = TestUtils.getTestCertPathChecker();
-
-        p.addCertPathChecker(cpc);
-        // modify checker
-        cpc.init(true);
-        // retrieve list and check that CertPathChecker's
-        // state it contains has not been changed by the
-        // above modification
-        List l = p.getCertPathCheckers();
-        PKIXCertPathChecker cpc1 = (PKIXCertPathChecker) l.get(0);
-        assertEquals("listSize", 1, l.size());
-        assertFalse("isCopied", cpc1.isForwardCheckingSupported());
-    }
-
-    /**
-     * Test #1 for <code>getDate()</code> method<br>
-     * Assertion: the <code>Date</code>, or <code>null</code> if not set
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "",
-        method = "getDate",
-        args = {}
-    )
-    public final void testGetDate01() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        // the Date has not been set
-        // the method must return null
-        assertNull("null", p.getDate());
-        Date currentDate = new Date();
-        p.setDate(currentDate);
-        // the Date returned must match
-        assertEquals("notNull", currentDate, p.getDate());
-    }
-
-    /**
-     * Test #2 for <code>getDate()</code> method<br>
-     * Assertion: <code>Date</code> returned is copied to protect against
-     * subsequent modifications
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies that returned Date is copied to protect against subsequent modifications.",
-        method = "getDate",
-        args = {}
-    )
-    public final void testGetDate02() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        Date currentDate = new Date();
-        p.setDate((Date) currentDate.clone());
-        Date ret1 = p.getDate();
-        // modify Date returned
-        ret1.setTime(0L);
-        // check that internal Date has not been
-        // changed by the above modification
-        assertEquals(currentDate, p.getDate());
-    }
-
-    /**
-     * @tests java.security.cert.PKIXParameters#setDate(Date)
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "setDate",
-        args = {java.util.Date.class}
-    )
-    @AndroidOnly("On the RI p.setDate(null) does not reset the date to null "
-            + "as specified.")
-    public final void test_setDateLjava_util_Date() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        assertNotNull("could not create test TrustAnchor set", taSet);
-
-        // test: 'date' is unset and param is null
-        PKIXParameters p = new PKIXParameters(taSet);
-        p.setDate(null);
-        assertNull(p.getDate());
-
-        // test: 'date' is not null
-        p = new PKIXParameters(taSet);
-        Date toBeSet = new Date(555L);
-        p.setDate(toBeSet);
-        assertEquals(555L, p.getDate().getTime());
-        // modify initial 'date' - it should be copied by constructor
-        toBeSet.setTime(0L);
-        // check that internal 'date' has not been
-        // changed by the above modification
-        assertEquals(555L, p.getDate().getTime());
-        // set another 'date'
-        p.setDate(new Date(333L));
-        assertEquals(333L, p.getDate().getTime());
-
-        // Regression for HARMONY-2882 (non-bug difference from RI)
-        p = new PKIXParameters(taSet);
-        p.setDate(new Date(555L));
-        p.setDate(null); // reset 'date' back to current time
-        assertNull(p.getDate());
-    }
-
-    /**
-     * Test #1 for <code>getInitialPolicies()</code> method<br>
-     * Assertion: The default return value is an empty <code>Set</code>
-     * Assertion: Never returns <code>null</code>
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies that getInitialPolicies method returns an empty Set and never null.",
-        method = "getInitialPolicies",
-        args = {}
-    )
-    public final void testGetInitialPolicies01() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        assertNotNull("notNull", p.getInitialPolicies());
-        assertTrue("isEmpty", p.getInitialPolicies().isEmpty());
-    }
-
-    /**
-     * Test #2 for <code>getInitialPolicies()</code> method<br>
-     * Assertion: returns an immutable <code>Set</code> of initial policy OIDs
-     * in <code>String</code> format<br>
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies that getInitialPolicies method returns an immutable Set of initial policy in String format.",
-        method = "getInitialPolicies",
-        args = {}
-    )
-    public final void testGetInitialPolicies02() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        Set<String> s = p.getInitialPolicies();
-        try {
-            // try to modify returned set
-            s.add((String) new Object());
-            fail("must be immutable");
-        } catch (Exception e) {
-        }
-    }
-
-    /**
-     * Test #1 for <code>setInitialPolicies(Set)</code> method<br>
-     * Assertion: sets the <code>Set</code> of initial policy identifiers (OID
-     * strings)
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Doesn't verify ClassCastException.",
-        method = "setInitialPolicies",
-        args = {java.util.Set.class}
-    )
-    public final void testSetInitialPolicies01() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        Set<String> s = new HashSet<String>();
-        s.add("1.2.3.4.5.6.7");
-        PKIXParameters p = new PKIXParameters(taSet);
-        p.setInitialPolicies(s);
-        assertEquals(1, p.getInitialPolicies().size());
-    }
-
-    /**
-     * Test #2 for <code>setInitialPolicies(Set)</code> method<br>
-     * Assertion: <code>Set</code> may be <code>null</code>
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies null as a parameter.",
-        method = "setInitialPolicies",
-        args = {java.util.Set.class}
-    )
-    public final void testSetInitialPolicies02() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        p.setInitialPolicies(null);
-        assertTrue(p.getInitialPolicies().isEmpty());
-    }
-
-    /**
-     * Test #3 for <code>setInitialPolicies(Set)</code> method<br>
-     * Assertion: <code>Set</code> may be empty
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Doesn't verify ClassCastException.",
-        method = "setInitialPolicies",
-        args = {java.util.Set.class}
-    )
-    public final void testSetInitialPolicies03() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        p.setInitialPolicies(new HashSet<String>());
-        assertTrue(p.getInitialPolicies().isEmpty());
-    }
-
-    /**
-     * Test #4 for <code>setInitialPolicies(Set)</code> method<br>
-     * Assertion: <code>Set</code> is copied to protect against subsequent
-     * modifications
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies that Set is copied to protect against subsequent modifications.",
-        method = "setInitialPolicies",
-        args = {java.util.Set.class}
-    )
-    public final void testSetInitialPolicies04() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        Set<String> s = new HashSet<String>();
-        s.add("1.2.3.4.5.6.7");
-        s.add("1.2.3.4.5.6.8");
-        PKIXParameters p = new PKIXParameters(taSet);
-        p.setInitialPolicies(s);
-        // modify original set
-        s.clear();
-        // check that set maintained internally has
-        // not been changed by the above modification
-        assertEquals(2, p.getInitialPolicies().size());
-    }
-
-    /**
-     * Test #5 for <code>setInitialPolicies(Set)</code> method<br>
-     * Assertion: <code>ClassCastException</code> - if any of the elements in
-     * the set are not of type <code>String</code>
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies ClassCastException.",
-        method = "setInitialPolicies",
-        args = {java.util.Set.class}
-    )
-    @SuppressWarnings("unchecked")
-    public final void testSetInitialPolicies05() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        Set s = new HashSet();
-        s.add("1.2.3.4.5.6.7");
-        s.add(new Object());
-        PKIXParameters p = new PKIXParameters(taSet);
-        try {
-            p.setInitialPolicies(s);
-            fail("ClassCastException expected");
-        } catch (ClassCastException e) {
-        }
-    }
-
-    /**
-     * Test #1 for <code>getTrustAnchors()</code> method<br>
-     * Assertion: an immutable <code>Set</code> of <code>TrustAnchors</code>
-     * (never <code>null</code>)
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies that getTrustAnchors returns an immutable Set of TrustAnchors, and never null.",
-        method = "getTrustAnchors",
-        args = {}
-    )
-    public final void testGetTrustAnchors01() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        assertNotNull("notNull", p.getTrustAnchors());
-    }
-
-    /**
-     * Test #2 for <code>getTrustAnchors()</code> method<br>
-     * Assertion: an immutable <code>Set</code> of <code>TrustAnchors</code>
-     * (never <code>null</code>)
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies that getTrustAnchors returns an immutable set of TrustAnchors, and never null.",
-        method = "getTrustAnchors",
-        args = {}
-    )
-    public final void testGetTrustAnchors02() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        Set<TrustAnchor> s = p.getTrustAnchors();
-        try {
-            // try to modify returned set
-            s.add((TrustAnchor) new Object());
-            fail("must be immutable");
-        } catch (Exception e) {
-        }
-    }
-
-    /**
-     * Test #1 for <code>setTrustAnchors(Set)</code> method<br>
-     * Assertion: Sets the <code>Set</code> of most-trusted CAs
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Doesn't verify exceptions.",
-        method = "setTrustAnchors",
-        args = {java.util.Set.class}
-    )
-    public final void testSetTrustAnchors01() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        Set<TrustAnchor> taSet1 = TestUtils.getTrustAnchorSet();
-        PKIXParameters p = new PKIXParameters(taSet);
-        p.setTrustAnchors(taSet1);
-        assertFalse(p.getTrustAnchors().isEmpty());
-    }
-
-    /**
-     * Test #2 for <code>setTrustAnchors(Set)</code> method<br>
-     * Assertion: <code>InvalidAlgorithmParameterException</code> - if the
-     * specified <code>Set</code> is empty (
-     * <code>trustAnchors.isEmpty() == true</code>)
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies InvalidAlgorithmParameterException.",
-        method = "setTrustAnchors",
-        args = {java.util.Set.class}
-    )
-    public final void testSetTrustAnchors02() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        try {
-            // use empty set
-            p.setTrustAnchors(new HashSet<TrustAnchor>());
-            fail("InvalidAlgorithmParameterException expected");
-        } catch (InvalidAlgorithmParameterException e) {
-        }
-    }
-
-    /**
-     * Test #3 for <code>setTrustAnchors(Set)</code> method<br>
-     * Assertion: <code>NullPointerException</code> - if the specified
-     * <code>Set</code> is <code>null</code>)
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies NullPointerException.",
-        method = "setTrustAnchors",
-        args = {java.util.Set.class}
-    )
-    public final void testSetTrustAnchors03() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        try {
-            // use null
-            p.setTrustAnchors(null);
-            fail("NPE expected");
-        } catch (NullPointerException e) {
-        }
-    }
-
-    /**
-     * Test #4 for <code>setTrustAnchors(Set)</code> method<br>
-     * Assertion: <code>ClassCastException</code> - if any of the elements in
-     * the set are not of type <code>java.security.cert.TrustAnchor</code>
-     *
-     * @throws InvalidAlgorithmParameterException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies ClassCastException.",
-        method = "setTrustAnchors",
-        args = {java.util.Set.class}
-    )
-    @SuppressWarnings("unchecked")
-    public final void testSetTrustAnchors04() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        Set s = new HashSet(p.getTrustAnchors());
-        s.add(new Object());
-        try {
-            p.setTrustAnchors(s);
-            fail("ClassCastException expected");
-        } catch (ClassCastException e) {
-        }
-    }
-
-    /**
-     * Test for <code>toString</code> method<br>
-     */
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        notes = "",
-        method = "toString",
-        args = {}
-    )
-    public final void testToString() throws Exception {
-        Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
-        if (taSet == null) {
-            fail(getName()
-                    + ": not performed (could not create test TrustAnchor set)");
-        }
-
-        PKIXParameters p = new PKIXParameters(taSet);
-        assertNotNull(p.toString());
-
-        PKIXParameters p1 = null;
-        try {
-            p1.toString();
-            fail("NullPointerException expected");
-        } catch (NullPointerException e) {
-            // expected
-        }
-    }
-
-    /**
-     * Test #4 for <code>PKIXParameters(KeyStore)</code> constructor<br>
-     *
-     * @throws InvalidAlgorithmParameterException
-     * @throws KeyStoreException
-     */
-    @TestTargetNew(
-        level = TestLevel.PARTIAL_COMPLETE,
-        notes = "Verifies everything except null argument",
-        method = "PKIXParameters",
-        args = {java.security.KeyStore.class}
-    )
-    @BrokenTest("Fails in CTS environment, but passes in CoreTestRunner")
-    public final void testPKIXParametersKeyStore04() throws Exception {
-
-
-        KeyStore store = KeyStore.getInstance("PKCS12");
-        KeyStoreTestPKCS12 k = new KeyStoreTestPKCS12();
-        ByteArrayInputStream stream = new ByteArrayInputStream(k.keyStoreData);
-
-        try {
-            PKIXParameters p = new PKIXParameters(store);
-        } catch (KeyStoreException e) {
-            // ok
-        }
-
-        store = KeyStore.getInstance("PKCS12");
-        store.load(stream, new String(KeyStoreTestPKCS12.keyStorePassword)
-                .toCharArray());
-        stream.close();
-
-        try {
-              PKIXParameters p = new PKIXParameters(store);
-        } catch (InvalidAlgorithmParameterException e) {
-            // ok
-        }
-
-
-        KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
-        keystore.load(null,null);
-        keystore.setCertificateEntry("test", TestUtils.rootCertificateSS);
-
-
-        PKIXParameters p = new PKIXParameters(keystore);
-    }
-}
diff --git a/luni/src/test/java/tests/targets/security/AllTests.java b/luni/src/test/java/tests/targets/security/AllTests.java
index 2a509a7..e8f8f1c 100644
--- a/luni/src/test/java/tests/targets/security/AllTests.java
+++ b/luni/src/test/java/tests/targets/security/AllTests.java
@@ -32,14 +32,6 @@
         suite.addTestSuite(MessageDigestTestSHA384.class);
         suite.addTestSuite(MessageDigestTestSHA512.class);
 
-        suite.addTestSuite(KeyPairGeneratorTestRSA.class);
-        suite.addTestSuite(KeyPairGeneratorTestDSA.class);
-        suite.addTestSuite(KeyPairGeneratorTestDH.class);
-
-        suite.addTestSuite(KeyFactoryTestRSA.class);
-        suite.addTestSuite(KeyFactoryTestDSA.class);
-        suite.addTestSuite(KeyFactoryTestDH.class);
-
         suite.addTestSuite(SignatureTestMD2withRSA.class);
         suite.addTestSuite(SignatureTestMD5withRSA.class);
         suite.addTestSuite(SignatureTestNONEwithDSA.class);
@@ -50,23 +42,10 @@
         suite.addTestSuite(SignatureTestSHA384withRSA.class);
         suite.addTestSuite(SignatureTestSHA512withRSA.class);
 
-        suite.addTestSuite(AlgorithmParameterGeneratorTestAES.class);
-        suite.addTestSuite(AlgorithmParameterGeneratorTestDH.class);
-        suite.addTestSuite(AlgorithmParameterGeneratorTestDSA.class);
-
-        suite.addTestSuite(AlgorithmParametersTestDES.class);
-        suite.addTestSuite(AlgorithmParametersTestDESede.class);
-        suite.addTestSuite(AlgorithmParametersTestDSA.class);
-        suite.addTestSuite(AlgorithmParametersTestOAEP.class);
-        suite.addTestSuite(AlgorithmParametersTestAES.class);
-        suite.addTestSuite(AlgorithmParametersTestDH.class);
-
         suite.addTestSuite(KeyStoreTestPKCS12.class);
 
         suite.addTestSuite(SecureRandomTestSHA1PRNG.class);
 
-        suite.addTestSuite(DHTest.class);
-
         // $JUnit-END$
         return suite;
     }
diff --git a/luni/src/test/java/tests/targets/security/CipherHelper.java b/luni/src/test/java/tests/targets/security/CipherHelper.java
deleted file mode 100644
index a6ff89a..0000000
--- a/luni/src/test/java/tests/targets/security/CipherHelper.java
+++ /dev/null
@@ -1,535 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package tests.targets.security;
-
-import junit.framework.Assert;
-
-import java.security.AlgorithmParameters;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.InvalidKeyException;
-import java.security.Key;
-import java.security.KeyPair;
-import java.security.KeyPairGenerator;
-import java.security.NoSuchAlgorithmException;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.security.Signature;
-import java.security.SignatureException;
-import java.security.spec.AlgorithmParameterSpec;
-import java.security.spec.InvalidParameterSpecException;
-import java.util.Arrays;
-
-import javax.crypto.BadPaddingException;
-import javax.crypto.Cipher;
-import javax.crypto.IllegalBlockSizeException;
-import javax.crypto.KeyAgreement;
-import javax.crypto.KeyGenerator;
-import javax.crypto.NoSuchPaddingException;
-import javax.crypto.SecretKey;
-
-abstract class TestHelper<T/*, U*/> {
-    void test(T testObject) {
-        Assert.fail("test called unimplemented method");
-    }
-
-//    void test(T testObject1, U testObject2) {
-//        Assert.fail("test called unimplemented method");
-//    }
-}
-
-
-abstract class CipherHelper<T/*, U*/> extends TestHelper<T/*, Key*/> {
-
-    private final String algorithmName;
-    private final String plainData;
-    private final int mode1;
-    private final int mode2;
-
-    CipherHelper(String algorithmName, String plainData, int mode1, int mode2) {
-        this.algorithmName = algorithmName;
-        this.plainData = plainData;
-        this.mode1 = mode1;
-        this.mode2 = mode2;
-    }
-
-
-
-//    @Override
-    void test(Key encryptKey, Key decryptKey) {
-        Cipher cipher = null;
-        try {
-            cipher = Cipher.getInstance(algorithmName);
-        } catch (NoSuchAlgorithmException e) {
-            Assert.fail(e.getMessage());
-        } catch (NoSuchPaddingException e) {
-            Assert.fail(e.getMessage());
-        }
-        try {
-            cipher.init(mode1, encryptKey);
-        } catch (InvalidKeyException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        byte[] encrypted = crypt(cipher, plainData.getBytes());
-
-        try {
-            cipher.init(mode2, decryptKey);
-        } catch (InvalidKeyException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        byte[] decrypted = crypt(cipher, encrypted);
-
-        String decryptedString = new String(decrypted);
-
-        Assert.assertEquals("transformed data does not match", plainData,
-                decryptedString);
-    }
-
-    byte[] crypt(Cipher cipher, byte[] input) {
-        try {
-            return cipher.doFinal(input);
-        } catch (IllegalBlockSizeException e) {
-            Assert.fail(e.getMessage());
-        } catch (BadPaddingException e) {
-            Assert.fail(e.getMessage());
-        }
-        return null;
-    }
-}
-
-
-class CipherAsymmetricCryptHelper extends CipherHelper<KeyPair/*, U*/> {
-
-    private static final String plainData = "some data to encrypt and decrypt test";
-
-    CipherAsymmetricCryptHelper(String algorithmName) {
-        super(algorithmName, plainData, Cipher.ENCRYPT_MODE,
-                Cipher.DECRYPT_MODE);
-    }
-
-    @Override
-    void test(KeyPair keyPair) {
-        test(keyPair.getPrivate(), keyPair.getPublic());
-    }
-}
-
-
-class CipherSymmetricCryptHelper extends CipherHelper<SecretKey/*, U*/> {
-
-    private static final String plainData = "some data to encrypt and decrypt test";
-
-    CipherSymmetricCryptHelper(String algorithmName) {
-        super(algorithmName, plainData, Cipher.ENCRYPT_MODE,
-                Cipher.DECRYPT_MODE);
-    }
-
-    @Override
-    void test(SecretKey key) {
-        test(key, key);
-    }
-}
-
-class SignatureHelper extends TestHelper<KeyPair> {
-
-    private final String algorithmName;
-    private final String plainData = "some data do sign and verify";
-
-    protected SignatureHelper(String algorithmName) {
-        this.algorithmName = algorithmName;
-    }
-
-    @Override
-    void test(KeyPair keyPair) {
-        test(keyPair.getPrivate(), keyPair.getPublic());
-    }
-
-//    @Override
-    void test(PrivateKey encryptKey, PublicKey decryptKey) {
-
-        Signature signature = null;
-        try {
-            signature = Signature.getInstance(algorithmName);
-        } catch (NoSuchAlgorithmException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        try {
-            signature.initSign(encryptKey);
-        } catch (InvalidKeyException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        try {
-            signature.update(plainData.getBytes());
-        } catch (SignatureException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        byte[] signed = null;
-        try {
-            signed = signature.sign();
-        } catch (SignatureException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        try {
-            signature.initVerify(decryptKey);
-        } catch (InvalidKeyException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        try {
-            signature.update(plainData.getBytes());
-        } catch (SignatureException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        try {
-            Assert.assertTrue("signature could not be verified", signature
-                    .verify(signed));
-        } catch (SignatureException e) {
-            Assert.fail(e.getMessage());
-        }
-    }
-}
-
-
-class KeyAgreementHelper extends TestHelper<KeyPair> {
-
-    private final String algorithmName;
-
-    protected KeyAgreementHelper(String algorithmName) {
-        this.algorithmName = algorithmName;
-    }
-
-    @Override
-    void test(KeyPair keyPair) {
-        test(keyPair.getPrivate(), keyPair.getPublic());
-    }
-//    @Override
-    void test(PrivateKey encryptKey, PublicKey decryptKey) {
-
-        KeyAgreement keyAgreement = null;
-        try {
-            keyAgreement = KeyAgreement.getInstance(algorithmName);
-        } catch (NoSuchAlgorithmException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        try {
-            keyAgreement.init(encryptKey);
-        } catch (InvalidKeyException e) {
-            Assert.fail(e.getMessage());
-        }
-        try {
-            keyAgreement.doPhase(decryptKey, true);
-        } catch (InvalidKeyException e) {
-            Assert.fail(e.getMessage());
-        } catch (IllegalStateException e) {
-            Assert.fail(e.getMessage());
-        }
-        Assert.assertNotNull("generated secret is null", keyAgreement
-                .generateSecret());
-
-    }
-}
-
-class AlgorithmParameterAsymmetricHelper extends TestHelper<AlgorithmParameters> {
-
-    private static final String plainData = "some data to encrypt and decrypt";
-    private final String algorithmName;
-
-    protected AlgorithmParameterAsymmetricHelper(String algorithmName) {
-        this.algorithmName = algorithmName;
-    }
-
-    @Override
-    void test(AlgorithmParameters parameters) {
-
-        KeyPairGenerator generator = null;
-        try {
-            generator = KeyPairGenerator.getInstance(algorithmName);
-        } catch (NoSuchAlgorithmException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        generator.initialize(1024);
-
-        KeyPair keyPair = generator.generateKeyPair();
-
-
-        Cipher cipher = null;
-        try {
-            cipher = Cipher.getInstance(algorithmName);
-        } catch (NoSuchAlgorithmException e) {
-            Assert.fail(e.getMessage());
-        } catch (NoSuchPaddingException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        try {
-            cipher.init(Cipher.ENCRYPT_MODE, keyPair.getPublic(), parameters);
-        } catch (InvalidKeyException e) {
-            Assert.fail(e.getMessage());
-        } catch (InvalidAlgorithmParameterException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        byte[] bs = null;
-        try {
-            bs = cipher.doFinal(plainData.getBytes());
-        } catch (IllegalBlockSizeException e) {
-            Assert.fail(e.getMessage());
-        } catch (BadPaddingException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        try {
-            cipher.init(Cipher.DECRYPT_MODE, keyPair.getPrivate(), parameters);
-        } catch (InvalidKeyException e) {
-            Assert.fail(e.getMessage());
-        } catch (InvalidAlgorithmParameterException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        byte[] decrypted = null;
-        try {
-            decrypted = cipher.doFinal(bs);
-        } catch (IllegalBlockSizeException e) {
-            Assert.fail(e.getMessage());
-        } catch (BadPaddingException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        Assert.assertTrue(Arrays.equals(plainData.getBytes(), decrypted));
-    }
-}
-
-class AlgorithmParameterSymmetricHelper extends TestHelper<AlgorithmParameters> {
-
-    private static final String plainData = "some data to encrypt and decrypt";
-    private final String algorithmName;
-    private final int keySize;
-    private String blockmode;
-
-    protected AlgorithmParameterSymmetricHelper(String algorithmName, int keySize) {
-        this.algorithmName = algorithmName;
-        this.keySize = keySize;
-    }
-
-    protected AlgorithmParameterSymmetricHelper(String algorithmName, String blockmode, int keySize) {
-        this(algorithmName, keySize);
-        this.blockmode = blockmode;
-    }
-
-    @Override
-    void test(AlgorithmParameters parameters) {
-
-        KeyGenerator generator = null;
-        try {
-            generator = KeyGenerator.getInstance(algorithmName);
-        } catch (NoSuchAlgorithmException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        generator.init(keySize);
-
-        Key key = generator.generateKey();
-
-
-        Cipher cipher = null;
-        try {
-            String transformation = algorithmName;
-            if (blockmode != null)
-            {
-                transformation += "/" + blockmode;
-            }
-            cipher = Cipher.getInstance(transformation);
-        } catch (NoSuchAlgorithmException e) {
-            Assert.fail(e.getMessage());
-        } catch (NoSuchPaddingException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        try {
-            cipher.init(Cipher.ENCRYPT_MODE, key, parameters);
-        } catch (InvalidKeyException e) {
-            Assert.fail(e.getMessage());
-        } catch (InvalidAlgorithmParameterException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        byte[] bs = null;
-        try {
-            bs = cipher.doFinal(plainData.getBytes());
-        } catch (IllegalBlockSizeException e) {
-            Assert.fail(e.getMessage());
-        } catch (BadPaddingException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        try {
-            cipher.init(Cipher.DECRYPT_MODE, key, parameters);
-        } catch (InvalidKeyException e) {
-            Assert.fail(e.getMessage());
-        } catch (InvalidAlgorithmParameterException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        byte[] decrypted = null;
-        try {
-            decrypted = cipher.doFinal(bs);
-        } catch (IllegalBlockSizeException e) {
-            Assert.fail(e.getMessage());
-        } catch (BadPaddingException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        Assert.assertTrue(Arrays.equals(plainData.getBytes(), decrypted));
-    }
-}
-
-
-class AlgorithmParameterSignatureHelper<T extends AlgorithmParameterSpec> extends TestHelper<AlgorithmParameters> {
-
-    private final String algorithmName;
-    private final String plainData = "some data do sign and verify";
-    private final Class<T> parameterSpecClass;
-
-    protected AlgorithmParameterSignatureHelper(String algorithmName, Class<T> parameterSpecCla1ss) {
-        this.algorithmName = algorithmName;
-        this.parameterSpecClass = parameterSpecCla1ss;
-    }
-
-    @Override
-    void test(AlgorithmParameters parameters) {
-
-        Signature signature = null;
-        try {
-            signature = Signature.getInstance(algorithmName);
-        } catch (NoSuchAlgorithmException e) {
-            Assert.fail(e.getMessage());
-        }
-
-
-        T parameterSpec = null;
-        try {
-            parameterSpec = parameters.getParameterSpec(parameterSpecClass);
-        } catch (InvalidParameterSpecException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        KeyPairGenerator generator = null;
-        try {
-            generator = KeyPairGenerator.getInstance(algorithmName);
-        } catch (NoSuchAlgorithmException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        try {
-            generator.initialize(parameterSpec);
-        } catch (InvalidAlgorithmParameterException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        KeyPair keyPair = generator.genKeyPair();
-
-        try {
-            signature.initSign(keyPair.getPrivate());
-        } catch (InvalidKeyException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        try {
-            signature.update(plainData.getBytes());
-        } catch (SignatureException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        byte[] signed = null;
-        try {
-            signed = signature.sign();
-        } catch (SignatureException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        try {
-            signature.initVerify(keyPair.getPublic());
-        } catch (InvalidKeyException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        try {
-            signature.update(plainData.getBytes());
-        } catch (SignatureException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        try {
-            Assert.assertTrue("signature could not be verified", signature
-                    .verify(signed));
-        } catch (SignatureException e) {
-            Assert.fail(e.getMessage());
-        }
-    }
-}
-
-class AlgorithmParameterKeyAgreementHelper extends TestHelper<AlgorithmParameters> {
-
-    private final String algorithmName;
-
-    protected AlgorithmParameterKeyAgreementHelper(String algorithmName) {
-        this.algorithmName = algorithmName;
-    }
-
-    @Override
-    void test(AlgorithmParameters parameters) {
-
-        KeyPairGenerator generator = null;
-        try {
-            generator = KeyPairGenerator.getInstance(algorithmName);
-        } catch (NoSuchAlgorithmException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        generator.initialize(1024);
-
-        KeyPair keyPair = generator.generateKeyPair();
-
-        KeyAgreement keyAgreement = null;
-        try {
-            keyAgreement = KeyAgreement.getInstance(algorithmName);
-        } catch (NoSuchAlgorithmException e) {
-            Assert.fail(e.getMessage());
-        }
-
-        try {
-            keyAgreement.init(keyPair.getPrivate());
-        } catch (InvalidKeyException e) {
-            Assert.fail(e.getMessage());
-        }
-        try {
-            keyAgreement.doPhase(keyPair.getPublic(), true);
-        } catch (InvalidKeyException e) {
-            Assert.fail(e.getMessage());
-        } catch (IllegalStateException e) {
-            Assert.fail(e.getMessage());
-        }
-        Assert.assertNotNull("generated secret is null", keyAgreement
-                .generateSecret());
-    }
-}
\ No newline at end of file
diff --git a/luni/src/test/java/tests/targets/security/KeyStoreTest.java b/luni/src/test/java/tests/targets/security/KeyStoreTest.java
index 6a86966..41d0f9a 100644
--- a/luni/src/test/java/tests/targets/security/KeyStoreTest.java
+++ b/luni/src/test/java/tests/targets/security/KeyStoreTest.java
@@ -18,9 +18,6 @@
 import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetNew;
 import dalvik.annotation.TestTargets;
-
-import junit.framework.TestCase;
-
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -28,17 +25,18 @@
 import java.security.KeyPair;
 import java.security.KeyPairGenerator;
 import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.PrivateKey;
-import java.security.UnrecoverableEntryException;
 import java.security.KeyStore.Entry;
 import java.security.KeyStore.PasswordProtection;
 import java.security.KeyStore.PrivateKeyEntry;
 import java.security.KeyStore.ProtectionParameter;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.PrivateKey;
+import java.security.UnrecoverableEntryException;
 import java.security.cert.Certificate;
 import java.security.cert.CertificateException;
 import java.security.cert.CertificateFactory;
+import junit.framework.TestCase;
 
 public class KeyStoreTest extends TestCase {
 
diff --git a/luni/src/test/java/tests/targets/security/KeyStoreTestPKCS12.java b/luni/src/test/java/tests/targets/security/KeyStoreTestPKCS12.java
index 33778b2..3455487 100644
--- a/luni/src/test/java/tests/targets/security/KeyStoreTestPKCS12.java
+++ b/luni/src/test/java/tests/targets/security/KeyStoreTestPKCS12.java
@@ -15,8 +15,6 @@
  */
 package tests.targets.security;
 
-import dalvik.annotation.TestTargetClass;
-
 public class KeyStoreTestPKCS12 extends KeyStoreTest {
 
     public KeyStoreTestPKCS12() {
diff --git a/luni/src/test/java/tests/targets/security/MessageDigestTestMD2.java b/luni/src/test/java/tests/targets/security/MessageDigestTestMD2.java
index 6b6e705..ab24067 100644
--- a/luni/src/test/java/tests/targets/security/MessageDigestTestMD2.java
+++ b/luni/src/test/java/tests/targets/security/MessageDigestTestMD2.java
@@ -17,15 +17,12 @@
 
 import dalvik.annotation.AndroidOnly;
 import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
 import dalvik.annotation.TestTargetNew;
-
-import junit.framework.TestCase;
-
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.security.Provider;
 import java.security.Security;
+import junit.framework.TestCase;
 
 public class MessageDigestTestMD2 extends TestCase {
 
diff --git a/luni/src/test/java/tests/targets/security/MessageDigestTestMD5.java b/luni/src/test/java/tests/targets/security/MessageDigestTestMD5.java
index 190d24c..a997b1e 100644
--- a/luni/src/test/java/tests/targets/security/MessageDigestTestMD5.java
+++ b/luni/src/test/java/tests/targets/security/MessageDigestTestMD5.java
@@ -15,7 +15,7 @@
  */
 package tests.targets.security;
 
-import dalvik.annotation.TestTargetClass;
+import tests.security.MessageDigestTest;
 
 public class MessageDigestTestMD5 extends MessageDigestTest {
 
diff --git a/luni/src/test/java/tests/targets/security/MessageDigestTestSHA1.java b/luni/src/test/java/tests/targets/security/MessageDigestTestSHA1.java
index c772b24..a73da37 100644
--- a/luni/src/test/java/tests/targets/security/MessageDigestTestSHA1.java
+++ b/luni/src/test/java/tests/targets/security/MessageDigestTestSHA1.java
@@ -15,7 +15,7 @@
  */
 package tests.targets.security;
 
-import dalvik.annotation.TestTargetClass;
+import tests.security.MessageDigestTest;
 
 public class MessageDigestTestSHA1 extends MessageDigestTest {
 
diff --git a/luni/src/test/java/tests/targets/security/MessageDigestTestSHA224.java b/luni/src/test/java/tests/targets/security/MessageDigestTestSHA224.java
index c7e0d10..b66ed35 100644
--- a/luni/src/test/java/tests/targets/security/MessageDigestTestSHA224.java
+++ b/luni/src/test/java/tests/targets/security/MessageDigestTestSHA224.java
@@ -15,6 +15,8 @@
  */
 package tests.targets.security;
 
+import tests.security.MessageDigestTest;
+
 public class MessageDigestTestSHA224 extends MessageDigestTest {
 
     public MessageDigestTestSHA224() {
diff --git a/luni/src/test/java/tests/targets/security/MessageDigestTestSHA256.java b/luni/src/test/java/tests/targets/security/MessageDigestTestSHA256.java
index 5340775..4813396 100644
--- a/luni/src/test/java/tests/targets/security/MessageDigestTestSHA256.java
+++ b/luni/src/test/java/tests/targets/security/MessageDigestTestSHA256.java
@@ -15,7 +15,7 @@
  */
 package tests.targets.security;
 
-import dalvik.annotation.TestTargetClass;
+import tests.security.MessageDigestTest;
 
 public class MessageDigestTestSHA256 extends MessageDigestTest {
 
diff --git a/luni/src/test/java/tests/targets/security/MessageDigestTestSHA384.java b/luni/src/test/java/tests/targets/security/MessageDigestTestSHA384.java
index e7e87e3..29f9477 100644
--- a/luni/src/test/java/tests/targets/security/MessageDigestTestSHA384.java
+++ b/luni/src/test/java/tests/targets/security/MessageDigestTestSHA384.java
@@ -15,7 +15,7 @@
  */
 package tests.targets.security;
 
-import dalvik.annotation.TestTargetClass;
+import tests.security.MessageDigestTest;
 
 public class MessageDigestTestSHA384 extends MessageDigestTest {
 
diff --git a/luni/src/test/java/tests/targets/security/MessageDigestTestSHA512.java b/luni/src/test/java/tests/targets/security/MessageDigestTestSHA512.java
index 0cee6ff..b0f2c6b 100644
--- a/luni/src/test/java/tests/targets/security/MessageDigestTestSHA512.java
+++ b/luni/src/test/java/tests/targets/security/MessageDigestTestSHA512.java
@@ -15,7 +15,7 @@
  */
 package tests.targets.security;
 
-import dalvik.annotation.TestTargetClass;
+import tests.security.MessageDigestTest;
 
 public class MessageDigestTestSHA512 extends MessageDigestTest {
 
diff --git a/luni/src/test/java/tests/targets/security/SecureRandomTestSHA1PRNG.java b/luni/src/test/java/tests/targets/security/SecureRandomTestSHA1PRNG.java
index db0c3db..daf04fc 100644
--- a/luni/src/test/java/tests/targets/security/SecureRandomTestSHA1PRNG.java
+++ b/luni/src/test/java/tests/targets/security/SecureRandomTestSHA1PRNG.java
@@ -15,7 +15,7 @@
  */
 package tests.targets.security;
 
-import dalvik.annotation.TestTargetClass;
+import tests.security.SecureRandomTest;
 
 public class SecureRandomTestSHA1PRNG extends SecureRandomTest {
 
diff --git a/luni/src/test/java/tests/targets/security/SignatureTestMD2withRSA.java b/luni/src/test/java/tests/targets/security/SignatureTestMD2withRSA.java
index ab69528..2041d41 100644
--- a/luni/src/test/java/tests/targets/security/SignatureTestMD2withRSA.java
+++ b/luni/src/test/java/tests/targets/security/SignatureTestMD2withRSA.java
@@ -17,11 +17,7 @@
 
 import dalvik.annotation.AndroidOnly;
 import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
 import dalvik.annotation.TestTargetNew;
-
-import junit.framework.TestCase;
-
 import java.security.InvalidKeyException;
 import java.security.InvalidParameterException;
 import java.security.NoSuchAlgorithmException;
@@ -31,6 +27,7 @@
 import java.security.Security;
 import java.security.Signature;
 import java.security.SignatureException;
+import junit.framework.TestCase;
 
 public class SignatureTestMD2withRSA extends TestCase {
 
diff --git a/luni/src/test/java/tests/targets/security/SignatureTestMD5withRSA.java b/luni/src/test/java/tests/targets/security/SignatureTestMD5withRSA.java
index 41710e2..7996b32 100644
--- a/luni/src/test/java/tests/targets/security/SignatureTestMD5withRSA.java
+++ b/luni/src/test/java/tests/targets/security/SignatureTestMD5withRSA.java
@@ -15,7 +15,7 @@
  */
 package tests.targets.security;
 
-import dalvik.annotation.TestTargetClass;
+import tests.security.SignatureTest;
 
 public class SignatureTestMD5withRSA extends SignatureTest {
 
diff --git a/luni/src/test/java/tests/targets/security/SignatureTestNONEwithDSA.java b/luni/src/test/java/tests/targets/security/SignatureTestNONEwithDSA.java
index 1d8de6b..be19c3e 100644
--- a/luni/src/test/java/tests/targets/security/SignatureTestNONEwithDSA.java
+++ b/luni/src/test/java/tests/targets/security/SignatureTestNONEwithDSA.java
@@ -15,7 +15,7 @@
  */
 package tests.targets.security;
 
-import dalvik.annotation.TestTargetClass;
+import tests.security.SignatureTest;
 
 public class SignatureTestNONEwithDSA extends SignatureTest {
 
diff --git a/luni/src/test/java/tests/targets/security/SignatureTestSHA1withDSA.java b/luni/src/test/java/tests/targets/security/SignatureTestSHA1withDSA.java
index f2e62bd..117f8df 100644
--- a/luni/src/test/java/tests/targets/security/SignatureTestSHA1withDSA.java
+++ b/luni/src/test/java/tests/targets/security/SignatureTestSHA1withDSA.java
@@ -15,7 +15,7 @@
  */
 package tests.targets.security;
 
-import dalvik.annotation.TestTargetClass;
+import tests.security.SignatureTest;
 
 public class SignatureTestSHA1withDSA extends SignatureTest {
 
diff --git a/luni/src/test/java/tests/targets/security/SignatureTestSHA1withRSA.java b/luni/src/test/java/tests/targets/security/SignatureTestSHA1withRSA.java
index def4e54..7729fce 100644
--- a/luni/src/test/java/tests/targets/security/SignatureTestSHA1withRSA.java
+++ b/luni/src/test/java/tests/targets/security/SignatureTestSHA1withRSA.java
@@ -15,7 +15,7 @@
  */
 package tests.targets.security;
 
-import dalvik.annotation.TestTargetClass;
+import tests.security.SignatureTest;
 
 public class SignatureTestSHA1withRSA extends SignatureTest {
 
diff --git a/luni/src/test/java/tests/targets/security/SignatureTestSHA224withRSA.java b/luni/src/test/java/tests/targets/security/SignatureTestSHA224withRSA.java
index a6d357d..ad89a7b 100644
--- a/luni/src/test/java/tests/targets/security/SignatureTestSHA224withRSA.java
+++ b/luni/src/test/java/tests/targets/security/SignatureTestSHA224withRSA.java
@@ -15,7 +15,7 @@
  */
 package tests.targets.security;
 
-import dalvik.annotation.TestTargetClass;
+import tests.security.SignatureTest;
 
 public class SignatureTestSHA224withRSA extends SignatureTest {
 
diff --git a/luni/src/test/java/tests/targets/security/SignatureTestSHA256withRSA.java b/luni/src/test/java/tests/targets/security/SignatureTestSHA256withRSA.java
index 59632e5..c7ed4aa 100644
--- a/luni/src/test/java/tests/targets/security/SignatureTestSHA256withRSA.java
+++ b/luni/src/test/java/tests/targets/security/SignatureTestSHA256withRSA.java
@@ -15,7 +15,7 @@
  */
 package tests.targets.security;
 
-import dalvik.annotation.TestTargetClass;
+import tests.security.SignatureTest;
 
 public class SignatureTestSHA256withRSA extends SignatureTest {
 
diff --git a/luni/src/test/java/tests/targets/security/SignatureTestSHA384withRSA.java b/luni/src/test/java/tests/targets/security/SignatureTestSHA384withRSA.java
index b55e1cf..32ea0ad 100644
--- a/luni/src/test/java/tests/targets/security/SignatureTestSHA384withRSA.java
+++ b/luni/src/test/java/tests/targets/security/SignatureTestSHA384withRSA.java
@@ -15,7 +15,7 @@
  */
 package tests.targets.security;
 
-import dalvik.annotation.TestTargetClass;
+import tests.security.SignatureTest;
 
 public class SignatureTestSHA384withRSA extends SignatureTest {
 
diff --git a/luni/src/test/java/tests/targets/security/SignatureTestSHA512withRSA.java b/luni/src/test/java/tests/targets/security/SignatureTestSHA512withRSA.java
index 845e1da..530d751 100644
--- a/luni/src/test/java/tests/targets/security/SignatureTestSHA512withRSA.java
+++ b/luni/src/test/java/tests/targets/security/SignatureTestSHA512withRSA.java
@@ -15,7 +15,7 @@
  */
 package tests.targets.security;
 
-import dalvik.annotation.TestTargetClass;
+import tests.security.SignatureTest;
 
 public class SignatureTestSHA512withRSA extends SignatureTest {
 
diff --git a/luni/src/test/java/tests/targets/security/cert/CertPathBuilderTestPKIX.java b/luni/src/test/java/tests/targets/security/cert/CertPathBuilderTestPKIX.java
index f64239c..fc67261 100644
--- a/luni/src/test/java/tests/targets/security/cert/CertPathBuilderTestPKIX.java
+++ b/luni/src/test/java/tests/targets/security/cert/CertPathBuilderTestPKIX.java
@@ -15,8 +15,6 @@
  */
 package tests.targets.security.cert;
 
-import dalvik.annotation.TestTargetClass;
-
 import java.io.ByteArrayInputStream;
 import java.security.KeyStore;
 import java.security.cert.CertPath;
@@ -31,8 +29,8 @@
 import java.security.cert.X509Certificate;
 import java.util.ArrayList;
 import java.util.List;
-
 import javax.security.auth.x500.X500Principal;
+import tests.security.CertPathBuilderTest;
 
 public class CertPathBuilderTestPKIX extends CertPathBuilderTest {
 
@@ -41,7 +39,7 @@
     }
 
     @Override
-    CertPathParameters getCertPathParameters() throws Exception {
+    public CertPathParameters getCertPathParameters() throws Exception {
         KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
 
         keyStore.load(null, null);
@@ -75,7 +73,7 @@
     }
 
     @Override
-    void validateCertPath(CertPath path) {
+    public void validateCertPath(CertPath path) {
         List<? extends Certificate> certificates = path.getCertificates();
         Certificate certificate = certificates.get(0);
 
diff --git a/luni/src/test/java/tests/targets/security/cert/CertPathValidatorTestPKIX.java b/luni/src/test/java/tests/targets/security/cert/CertPathValidatorTestPKIX.java
index d7152f4..af4037f 100644
--- a/luni/src/test/java/tests/targets/security/cert/CertPathValidatorTestPKIX.java
+++ b/luni/src/test/java/tests/targets/security/cert/CertPathValidatorTestPKIX.java
@@ -15,8 +15,6 @@
  */
 package tests.targets.security.cert;
 
-import dalvik.annotation.TestTargetClass;
-
 import java.io.ByteArrayInputStream;
 import java.security.KeyStore;
 import java.security.cert.CertPath;
@@ -36,6 +34,7 @@
 import java.security.cert.X509Certificate;
 import java.util.ArrayList;
 import java.util.List;
+import tests.security.CertPathValidatorTest;
 
 public class CertPathValidatorTestPKIX extends CertPathValidatorTest {
 
@@ -47,7 +46,7 @@
     }
 
     @Override
-    CertPath getCertPath() {
+    public CertPath getCertPath() {
         return certPath;
     }
 
@@ -92,12 +91,12 @@
     }
 
     @Override
-    CertPathParameters getParams() {
+    public CertPathParameters getParams() {
         return params;
     }
 
     @Override
-    void validateResult(CertPathValidatorResult validatorResult) {
+    public void validateResult(CertPathValidatorResult validatorResult) {
         assertNotNull("validator result is null", validatorResult);
         assertTrue("validator result is not PKIX",
                 validatorResult instanceof PKIXCertPathValidatorResult);
diff --git a/luni/src/test/java/tests/targets/security/cert/CertificateFactoryTestX509.java b/luni/src/test/java/tests/targets/security/cert/CertificateFactoryTestX509.java
index 125027a..dcf4081 100644
--- a/luni/src/test/java/tests/targets/security/cert/CertificateFactoryTestX509.java
+++ b/luni/src/test/java/tests/targets/security/cert/CertificateFactoryTestX509.java
@@ -15,7 +15,7 @@
  */
 package tests.targets.security.cert;
 
-import dalvik.annotation.TestTargetClass;
+import tests.security.CertificateFactoryTest;
 
 public class CertificateFactoryTestX509 extends CertificateFactoryTest {
 
diff --git a/luni/src/test/java/tests/targets/security/cert/CertificateTest.java b/luni/src/test/java/tests/targets/security/cert/CertificateTest.java
index 114dcfe..78619a5 100644
--- a/luni/src/test/java/tests/targets/security/cert/CertificateTest.java
+++ b/luni/src/test/java/tests/targets/security/cert/CertificateTest.java
@@ -18,9 +18,6 @@
 import dalvik.annotation.AndroidOnly;
 import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetNew;
-
-import junit.framework.TestCase;
-
 import java.io.ByteArrayInputStream;
 import java.security.KeyStore;
 import java.security.NoSuchAlgorithmException;
@@ -37,6 +34,7 @@
 import java.security.cert.X509Certificate;
 import java.util.ArrayList;
 import java.util.List;
+import junit.framework.TestCase;
 
 public class CertificateTest extends TestCase {
 
diff --git a/luni/src/test/java/tests/xml/SimpleBuilderTest.java b/luni/src/test/java/tests/xml/SimpleBuilderTest.java
index 585050e..a6c6a1d 100644
--- a/luni/src/test/java/tests/xml/SimpleBuilderTest.java
+++ b/luni/src/test/java/tests/xml/SimpleBuilderTest.java
@@ -16,26 +16,20 @@
 
 package tests.xml;
 
-import dalvik.annotation.BrokenTest;
-import dalvik.annotation.TestTargets;
 import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
 import dalvik.annotation.TestTargetClass;
-
+import dalvik.annotation.TestTargetNew;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
 import junit.framework.TestCase;
-
 import org.w3c.dom.Comment;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.w3c.dom.ProcessingInstruction;
 import org.w3c.dom.Text;
 
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
 @TestTargetClass(DocumentBuilder.class)
 public class SimpleBuilderTest extends TestCase {
 
@@ -122,41 +116,17 @@
         assertEquals("The quick brown fox jumps over the lazy dog.", proinst);
         assertEquals(" Fragile!  Handle me with care! ", comment);
     }
+
     @TestTargetNew(
         level = TestLevel.ADDITIONAL,
         method = "!todo parse",
         args = {java.io.InputStream.class}
     )
-    @BrokenTest("Doesn't verify anything.")
     public void testGoodFile2() throws Exception {
         Document document = builder.parse(getClass().getResourceAsStream(
                 "/staffNS.xml"));
 
         Element root = document.getDocumentElement();
         assertNotNull(root);
-
-        // dump("", root);
-    }
-
-    private void dump(String prefix, Element element) {
-        System.out.print(prefix + "<" + element.getTagName());
-
-        NamedNodeMap attrs = element.getAttributes();
-        for (int i = 0; i < attrs.getLength(); i++) {
-            Node item = attrs.item(i);
-            System.out.print(" " + item.getNodeName() + "=" + item.getNodeValue());
-        }
-
-        System.out.println(">");
-
-        NodeList children = element.getChildNodes();
-        for (int i = 0; i < children.getLength(); i++) {
-            Node item = children.item(i);
-            if (item instanceof Element) {
-                dump(prefix + "  ", (Element)item);
-            }
-        }
-
-        System.out.println(prefix + "</" + element.getTagName() + ">");
     }
 }
diff --git a/support/src/test/java/javax/net/ssl/StandardNames.java b/support/src/test/java/java/security/StandardNames.java
similarity index 98%
rename from support/src/test/java/javax/net/ssl/StandardNames.java
rename to support/src/test/java/java/security/StandardNames.java
index 1a1dd67..316b46e 100644
--- a/support/src/test/java/javax/net/ssl/StandardNames.java
+++ b/support/src/test/java/java/security/StandardNames.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package javax.net.ssl;
+package java.security;
 
 import java.util.Arrays;
 import java.util.Collections;
@@ -47,6 +47,10 @@
  */
 public final class StandardNames extends Assert {
 
+    public static final boolean IS_RI
+            = !"Dalvik Core Library".equals(System.getProperty("java.specification.name"));
+    public static final String PROVIDER_NAME = (IS_RI) ? "SunJSSE" : "HarmonyJSSE";
+
     /**
      * A map from algorithm type (e.g. Cipher) to a set of algorithms (e.g. AES, DES, ...)
      */
@@ -195,7 +199,7 @@
         provide("SSLContext", "TLS");
 
         // Not documented as in RI 6 but that exist in RI 6
-        if (TestSSLContext.IS_RI) {
+        if (IS_RI) {
             provide("CertStore", "com.sun.security.IndexedCollection");
             provide("KeyGenerator", "SunTlsKeyMaterial");
             provide("KeyGenerator", "SunTlsMasterSecret");
@@ -212,7 +216,7 @@
         }
 
         // Fixups for dalvik
-        if (!TestSSLContext.IS_RI) {
+        if (!IS_RI) {
 
             // OpenSSL implementations with non-Standard algorithm names
             // TODO move our additions to a new provider and use standard names
@@ -363,7 +367,7 @@
         "SSLv3",
         "TLSv1"));
     static {
-        if (TestSSLContext.IS_RI) {
+        if (IS_RI) {
             /* Even though we use OpenSSL's SSLv23_method which
              * supports sending SSLv2 client hello messages, the
              * OpenSSL implementation in s23_client_hello disables
@@ -499,12 +503,12 @@
         addNeither("TLS_KRB5_EXPORT_WITH_RC2_CBC_40_SHA");
         addNeither("TLS_KRB5_EXPORT_WITH_RC2_CBC_40_MD5");
 
-        CIPHER_SUITES = (TestSSLContext.IS_RI) ? CIPHER_SUITES_RI : CIPHER_SUITES_OPENSSL;
+        CIPHER_SUITES = (IS_RI) ? CIPHER_SUITES_RI : CIPHER_SUITES_OPENSSL;
     }
 
     public static final Set<String> CIPHER_SUITES_SSLENGINE = new HashSet<String>(CIPHER_SUITES);
     static {
-        if (!TestSSLContext.IS_RI) {
+        if (!IS_RI) {
             // Android does not include Java versions of RC4 and IDEA
             // Java crypto implementations so these fail to work for
             // the SSLEngine implementation.
diff --git a/support/src/test/java/javax/net/ssl/TestSSLContext.java b/support/src/test/java/javax/net/ssl/TestSSLContext.java
index 3492a28..8d759ee 100644
--- a/support/src/test/java/javax/net/ssl/TestSSLContext.java
+++ b/support/src/test/java/javax/net/ssl/TestSSLContext.java
@@ -22,6 +22,7 @@
 import java.security.Principal;
 import java.security.SecureRandom;
 import java.security.Security;
+import java.security.StandardNames;
 import java.security.cert.Certificate;
 import java.security.cert.X509Certificate;
 import java.util.Collections;
@@ -35,15 +36,12 @@
  */
 public final class TestSSLContext extends Assert {
 
-    public static final boolean IS_RI
-            = !"Dalvik Core Library".equals(System.getProperty("java.specification.name"));
-    public static final String PROVIDER_NAME = (IS_RI) ? "SunJSSE" : "HarmonyJSSE";
-
     /*
      * The RI and Android have very different default SSLSession cache behaviors.
      * The RI keeps an unlimited number of SSLSesions around for 1 day.
      * Android keeps 10 SSLSessions forever.
      */
+    private static final boolean IS_RI = StandardNames.IS_RI;
     public static final int EXPECTED_DEFAULT_CLIENT_SSL_SESSION_CACHE_SIZE = (IS_RI) ? 0 : 10;
     public static final int EXPECTED_DEFAULT_SERVER_SSL_SESSION_CACHE_SIZE = (IS_RI) ? 0 : 100;
     public static final int EXPECTED_DEFAULT_SSL_SESSION_CACHE_TIMEOUT = (IS_RI) ? 86400 : 0;
diff --git a/support/src/test/java/tests/security/AlgorithmParameterAsymmetricHelper.java b/support/src/test/java/tests/security/AlgorithmParameterAsymmetricHelper.java
new file mode 100644
index 0000000..89809e1
--- /dev/null
+++ b/support/src/test/java/tests/security/AlgorithmParameterAsymmetricHelper.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.security;
+
+import java.security.AlgorithmParameters;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.NoSuchAlgorithmException;
+import java.util.Arrays;
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
+import junit.framework.Assert;
+
+public class AlgorithmParameterAsymmetricHelper extends TestHelper<AlgorithmParameters> {
+
+    private static final String plainData = "some data to encrypt and decrypt";
+    private final String algorithmName;
+
+    public AlgorithmParameterAsymmetricHelper(String algorithmName) {
+        this.algorithmName = algorithmName;
+    }
+
+    @Override
+    public void test(AlgorithmParameters parameters) {
+
+        KeyPairGenerator generator = null;
+        try {
+            generator = KeyPairGenerator.getInstance(algorithmName);
+        } catch (NoSuchAlgorithmException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        generator.initialize(1024);
+
+        KeyPair keyPair = generator.generateKeyPair();
+
+
+        Cipher cipher = null;
+        try {
+            cipher = Cipher.getInstance(algorithmName);
+        } catch (NoSuchAlgorithmException e) {
+            Assert.fail(e.getMessage());
+        } catch (NoSuchPaddingException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        try {
+            cipher.init(Cipher.ENCRYPT_MODE, keyPair.getPublic(), parameters);
+        } catch (InvalidKeyException e) {
+            Assert.fail(e.getMessage());
+        } catch (InvalidAlgorithmParameterException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        byte[] bs = null;
+        try {
+            bs = cipher.doFinal(plainData.getBytes());
+        } catch (IllegalBlockSizeException e) {
+            Assert.fail(e.getMessage());
+        } catch (BadPaddingException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        try {
+            cipher.init(Cipher.DECRYPT_MODE, keyPair.getPrivate(), parameters);
+        } catch (InvalidKeyException e) {
+            Assert.fail(e.getMessage());
+        } catch (InvalidAlgorithmParameterException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        byte[] decrypted = null;
+        try {
+            decrypted = cipher.doFinal(bs);
+        } catch (IllegalBlockSizeException e) {
+            Assert.fail(e.getMessage());
+        } catch (BadPaddingException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        Assert.assertTrue(Arrays.equals(plainData.getBytes(), decrypted));
+    }
+}
diff --git a/luni/src/test/java/tests/targets/security/AlgorithmParameterGeneratorTest.java b/support/src/test/java/tests/security/AlgorithmParameterGeneratorTest.java
similarity index 98%
rename from luni/src/test/java/tests/targets/security/AlgorithmParameterGeneratorTest.java
rename to support/src/test/java/tests/security/AlgorithmParameterGeneratorTest.java
index 108b433..80065f3 100644
--- a/luni/src/test/java/tests/targets/security/AlgorithmParameterGeneratorTest.java
+++ b/support/src/test/java/tests/security/AlgorithmParameterGeneratorTest.java
@@ -13,17 +13,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
+package tests.security;
 
 import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetNew;
 import dalvik.annotation.TestTargets;
-
-import junit.framework.TestCase;
-
 import java.security.AlgorithmParameterGenerator;
 import java.security.AlgorithmParameters;
 import java.security.NoSuchAlgorithmException;
+import junit.framework.TestCase;
 
 public abstract class AlgorithmParameterGeneratorTest extends TestCase {
 
@@ -68,4 +66,4 @@
 
         helper.test(parameters);
     }
-}
\ No newline at end of file
+}
diff --git a/support/src/test/java/tests/security/AlgorithmParameterKeyAgreementHelper.java b/support/src/test/java/tests/security/AlgorithmParameterKeyAgreementHelper.java
new file mode 100644
index 0000000..870abf9
--- /dev/null
+++ b/support/src/test/java/tests/security/AlgorithmParameterKeyAgreementHelper.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.security;
+
+import java.security.AlgorithmParameters;
+import java.security.InvalidKeyException;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.NoSuchAlgorithmException;
+import javax.crypto.KeyAgreement;
+import junit.framework.Assert;
+
+public class AlgorithmParameterKeyAgreementHelper extends TestHelper<AlgorithmParameters> {
+
+    private final String algorithmName;
+
+    public AlgorithmParameterKeyAgreementHelper(String algorithmName) {
+        this.algorithmName = algorithmName;
+    }
+
+    @Override
+    public void test(AlgorithmParameters parameters) {
+
+        KeyPairGenerator generator = null;
+        try {
+            generator = KeyPairGenerator.getInstance(algorithmName);
+        } catch (NoSuchAlgorithmException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        generator.initialize(1024);
+
+        KeyPair keyPair = generator.generateKeyPair();
+
+        KeyAgreement keyAgreement = null;
+        try {
+            keyAgreement = KeyAgreement.getInstance(algorithmName);
+        } catch (NoSuchAlgorithmException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        try {
+            keyAgreement.init(keyPair.getPrivate());
+        } catch (InvalidKeyException e) {
+            Assert.fail(e.getMessage());
+        }
+        try {
+            keyAgreement.doPhase(keyPair.getPublic(), true);
+        } catch (InvalidKeyException e) {
+            Assert.fail(e.getMessage());
+        } catch (IllegalStateException e) {
+            Assert.fail(e.getMessage());
+        }
+        Assert.assertNotNull("generated secret is null", keyAgreement
+                .generateSecret());
+    }
+}
diff --git a/support/src/test/java/tests/security/AlgorithmParameterSignatureHelper.java b/support/src/test/java/tests/security/AlgorithmParameterSignatureHelper.java
new file mode 100644
index 0000000..f132578
--- /dev/null
+++ b/support/src/test/java/tests/security/AlgorithmParameterSignatureHelper.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.security;
+
+import java.security.AlgorithmParameters;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.NoSuchAlgorithmException;
+import java.security.Signature;
+import java.security.SignatureException;
+import java.security.spec.AlgorithmParameterSpec;
+import java.security.spec.InvalidParameterSpecException;
+import junit.framework.Assert;
+
+public class AlgorithmParameterSignatureHelper<T extends AlgorithmParameterSpec>
+        extends TestHelper<AlgorithmParameters> {
+
+    private final String algorithmName;
+    private final String plainData = "some data do sign and verify";
+    private final Class<T> parameterSpecClass;
+
+    public AlgorithmParameterSignatureHelper(String algorithmName, Class<T> parameterSpecCla1ss) {
+        this.algorithmName = algorithmName;
+        this.parameterSpecClass = parameterSpecCla1ss;
+    }
+
+    @Override
+    public void test(AlgorithmParameters parameters) {
+
+        Signature signature = null;
+        try {
+            signature = Signature.getInstance(algorithmName);
+        } catch (NoSuchAlgorithmException e) {
+            Assert.fail(e.getMessage());
+        }
+
+
+        T parameterSpec = null;
+        try {
+            parameterSpec = parameters.getParameterSpec(parameterSpecClass);
+        } catch (InvalidParameterSpecException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        KeyPairGenerator generator = null;
+        try {
+            generator = KeyPairGenerator.getInstance(algorithmName);
+        } catch (NoSuchAlgorithmException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        try {
+            generator.initialize(parameterSpec);
+        } catch (InvalidAlgorithmParameterException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        KeyPair keyPair = generator.genKeyPair();
+
+        try {
+            signature.initSign(keyPair.getPrivate());
+        } catch (InvalidKeyException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        try {
+            signature.update(plainData.getBytes());
+        } catch (SignatureException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        byte[] signed = null;
+        try {
+            signed = signature.sign();
+        } catch (SignatureException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        try {
+            signature.initVerify(keyPair.getPublic());
+        } catch (InvalidKeyException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        try {
+            signature.update(plainData.getBytes());
+        } catch (SignatureException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        try {
+            Assert.assertTrue("signature could not be verified", signature
+                    .verify(signed));
+        } catch (SignatureException e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+}
diff --git a/support/src/test/java/tests/security/AlgorithmParameterSymmetricHelper.java b/support/src/test/java/tests/security/AlgorithmParameterSymmetricHelper.java
new file mode 100644
index 0000000..86d87ce
--- /dev/null
+++ b/support/src/test/java/tests/security/AlgorithmParameterSymmetricHelper.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.security;
+
+import java.security.AlgorithmParameters;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.NoSuchAlgorithmException;
+import java.util.Arrays;
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.KeyGenerator;
+import javax.crypto.NoSuchPaddingException;
+import junit.framework.Assert;
+
+public class AlgorithmParameterSymmetricHelper extends TestHelper<AlgorithmParameters> {
+
+    private static final String plainData = "some data to encrypt and decrypt";
+    private final String algorithmName;
+    private final int keySize;
+    private String blockmode;
+
+    public AlgorithmParameterSymmetricHelper(String algorithmName, int keySize) {
+        this.algorithmName = algorithmName;
+        this.keySize = keySize;
+    }
+
+    public AlgorithmParameterSymmetricHelper(String algorithmName, String blockmode, int keySize) {
+        this(algorithmName, keySize);
+        this.blockmode = blockmode;
+    }
+
+    @Override
+    public void test(AlgorithmParameters parameters) {
+
+        KeyGenerator generator = null;
+        try {
+            generator = KeyGenerator.getInstance(algorithmName);
+        } catch (NoSuchAlgorithmException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        generator.init(keySize);
+
+        Key key = generator.generateKey();
+
+
+        Cipher cipher = null;
+        try {
+            String transformation = algorithmName;
+            if (blockmode != null)
+            {
+                transformation += "/" + blockmode;
+            }
+            cipher = Cipher.getInstance(transformation);
+        } catch (NoSuchAlgorithmException e) {
+            Assert.fail(e.getMessage());
+        } catch (NoSuchPaddingException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        try {
+            cipher.init(Cipher.ENCRYPT_MODE, key, parameters);
+        } catch (InvalidKeyException e) {
+            Assert.fail(e.getMessage());
+        } catch (InvalidAlgorithmParameterException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        byte[] bs = null;
+        try {
+            bs = cipher.doFinal(plainData.getBytes());
+        } catch (IllegalBlockSizeException e) {
+            Assert.fail(e.getMessage());
+        } catch (BadPaddingException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        try {
+            cipher.init(Cipher.DECRYPT_MODE, key, parameters);
+        } catch (InvalidKeyException e) {
+            Assert.fail(e.getMessage());
+        } catch (InvalidAlgorithmParameterException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        byte[] decrypted = null;
+        try {
+            decrypted = cipher.doFinal(bs);
+        } catch (IllegalBlockSizeException e) {
+            Assert.fail(e.getMessage());
+        } catch (BadPaddingException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        Assert.assertTrue(Arrays.equals(plainData.getBytes(), decrypted));
+    }
+}
diff --git a/luni/src/test/java/tests/targets/security/AlgorithmParametersTest.java b/support/src/test/java/tests/security/AlgorithmParametersTest.java
similarity index 95%
rename from luni/src/test/java/tests/targets/security/AlgorithmParametersTest.java
rename to support/src/test/java/tests/security/AlgorithmParametersTest.java
index 02f2691..d5c1910 100644
--- a/luni/src/test/java/tests/targets/security/AlgorithmParametersTest.java
+++ b/support/src/test/java/tests/security/AlgorithmParametersTest.java
@@ -13,18 +13,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
+package tests.security;
 
 import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetNew;
 import dalvik.annotation.TestTargets;
-
-import junit.framework.TestCase;
-
 import java.security.AlgorithmParameters;
 import java.security.NoSuchAlgorithmException;
 import java.security.spec.AlgorithmParameterSpec;
 import java.security.spec.InvalidParameterSpecException;
+import junit.framework.TestCase;
 
 public class AlgorithmParametersTest extends TestCase {
 
@@ -39,10 +37,6 @@
         this.parameterData = parameterData;
     }
 
-    protected void setUp() throws Exception {
-        super.setUp();
-    }
-
     @TestTargets({
         @TestTargetNew(
                 level=TestLevel.ADDITIONAL,
diff --git a/support/src/test/java/tests/security/CipherAsymmetricCryptHelper.java b/support/src/test/java/tests/security/CipherAsymmetricCryptHelper.java
new file mode 100644
index 0000000..fe7c714
--- /dev/null
+++ b/support/src/test/java/tests/security/CipherAsymmetricCryptHelper.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.security;
+
+import java.security.KeyPair;
+import javax.crypto.Cipher;
+
+public class CipherAsymmetricCryptHelper extends CipherHelper<KeyPair> {
+
+    private static final String plainData = "some data to encrypt and decrypt test";
+
+    public CipherAsymmetricCryptHelper(String algorithmName) {
+        super(algorithmName, plainData, Cipher.ENCRYPT_MODE,
+                Cipher.DECRYPT_MODE);
+    }
+
+    public void test(KeyPair keyPair) {
+        test(keyPair.getPrivate(), keyPair.getPublic());
+    }
+}
diff --git a/support/src/test/java/tests/security/CipherHelper.java b/support/src/test/java/tests/security/CipherHelper.java
new file mode 100644
index 0000000..cb1ba88
--- /dev/null
+++ b/support/src/test/java/tests/security/CipherHelper.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.security;
+
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.NoSuchAlgorithmException;
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
+import junit.framework.Assert;
+
+public abstract class CipherHelper<T> extends TestHelper<T> {
+
+    private final String algorithmName;
+    private final String plainData;
+    private final int mode1;
+    private final int mode2;
+
+    public CipherHelper(String algorithmName, String plainData, int mode1, int mode2) {
+        this.algorithmName = algorithmName;
+        this.plainData = plainData;
+        this.mode1 = mode1;
+        this.mode2 = mode2;
+    }
+
+    public void test(Key encryptKey, Key decryptKey) {
+        Cipher cipher = null;
+        try {
+            cipher = Cipher.getInstance(algorithmName);
+        } catch (NoSuchAlgorithmException e) {
+            Assert.fail(e.getMessage());
+        } catch (NoSuchPaddingException e) {
+            Assert.fail(e.getMessage());
+        }
+        try {
+            cipher.init(mode1, encryptKey);
+        } catch (InvalidKeyException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        byte[] encrypted = crypt(cipher, plainData.getBytes());
+
+        try {
+            cipher.init(mode2, decryptKey);
+        } catch (InvalidKeyException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        byte[] decrypted = crypt(cipher, encrypted);
+
+        String decryptedString = new String(decrypted);
+
+        Assert.assertEquals("transformed data does not match", plainData,
+                decryptedString);
+    }
+
+    public byte[] crypt(Cipher cipher, byte[] input) {
+        try {
+            return cipher.doFinal(input);
+        } catch (IllegalBlockSizeException e) {
+            Assert.fail(e.getMessage());
+        } catch (BadPaddingException e) {
+            Assert.fail(e.getMessage());
+        }
+        return null;
+    }
+}
diff --git a/support/src/test/java/tests/security/CipherSymmetricCryptHelper.java b/support/src/test/java/tests/security/CipherSymmetricCryptHelper.java
new file mode 100644
index 0000000..8b93211
--- /dev/null
+++ b/support/src/test/java/tests/security/CipherSymmetricCryptHelper.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.security;
+
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+
+public class CipherSymmetricCryptHelper extends CipherHelper<SecretKey/*, U*/> {
+
+    private static final String plainData = "some data to encrypt and decrypt test";
+
+    public CipherSymmetricCryptHelper(String algorithmName) {
+        super(algorithmName, plainData, Cipher.ENCRYPT_MODE,
+                Cipher.DECRYPT_MODE);
+    }
+
+    public void test(SecretKey key) {
+        test(key, key);
+    }
+}
diff --git a/luni/src/test/java/tests/targets/security/DefaultKeys.java b/support/src/test/java/tests/security/DefaultKeys.java
similarity index 99%
rename from luni/src/test/java/tests/targets/security/DefaultKeys.java
rename to support/src/test/java/tests/security/DefaultKeys.java
index c8ae8d5..e83efc6 100644
--- a/luni/src/test/java/tests/targets/security/DefaultKeys.java
+++ b/support/src/test/java/tests/security/DefaultKeys.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
+package tests.security;
 
 import java.security.KeyFactory;
 import java.security.NoSuchAlgorithmException;
diff --git a/support/src/test/java/tests/security/KeyAgreementHelper.java b/support/src/test/java/tests/security/KeyAgreementHelper.java
new file mode 100644
index 0000000..57593c5
--- /dev/null
+++ b/support/src/test/java/tests/security/KeyAgreementHelper.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.security;
+
+import java.security.InvalidKeyException;
+import java.security.KeyPair;
+import java.security.NoSuchAlgorithmException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import javax.crypto.KeyAgreement;
+import junit.framework.Assert;
+
+public class KeyAgreementHelper extends TestHelper<KeyPair> {
+
+    private final String algorithmName;
+
+    public KeyAgreementHelper(String algorithmName) {
+        this.algorithmName = algorithmName;
+    }
+
+    @Override public void test(KeyPair keyPair) {
+        test(keyPair.getPrivate(), keyPair.getPublic());
+    }
+
+    void test(PrivateKey encryptKey, PublicKey decryptKey) {
+
+        KeyAgreement keyAgreement = null;
+        try {
+            keyAgreement = KeyAgreement.getInstance(algorithmName);
+        } catch (NoSuchAlgorithmException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        try {
+            keyAgreement.init(encryptKey);
+        } catch (InvalidKeyException e) {
+            Assert.fail(e.getMessage());
+        }
+        try {
+            keyAgreement.doPhase(decryptKey, true);
+        } catch (InvalidKeyException e) {
+            Assert.fail(e.getMessage());
+        } catch (IllegalStateException e) {
+            Assert.fail(e.getMessage());
+        }
+        Assert.assertNotNull("generated secret is null", keyAgreement
+                .generateSecret());
+
+    }
+}
diff --git a/luni/src/test/java/tests/targets/security/KeyFactoryTest.java b/support/src/test/java/tests/security/KeyFactoryTest.java
similarity index 92%
rename from luni/src/test/java/tests/targets/security/KeyFactoryTest.java
rename to support/src/test/java/tests/security/KeyFactoryTest.java
index 26cd8a3..179254a 100644
--- a/luni/src/test/java/tests/targets/security/KeyFactoryTest.java
+++ b/support/src/test/java/tests/security/KeyFactoryTest.java
@@ -13,14 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
+package tests.security;
 
 import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetNew;
 import dalvik.annotation.TestTargets;
-
-import junit.framework.TestCase;
-
 import java.security.Key;
 import java.security.KeyFactory;
 import java.security.KeyPair;
@@ -29,22 +26,20 @@
 import java.security.PublicKey;
 import java.security.spec.InvalidKeySpecException;
 import java.security.spec.KeySpec;
+import junit.framework.TestCase;
+
 public abstract class KeyFactoryTest<PublicKeySpec extends KeySpec, PrivateKeySpec extends KeySpec>
         extends TestCase {
 
     private final String algorithmName;
     private final Class<PublicKeySpec> publicKeySpecClass;
     private final Class<PrivateKeySpec> privateKeySpecClass;
-
     private KeyFactory factory;
-    private final TestHelper<KeyPair> helper;
 
-
-    public KeyFactoryTest(String algorithmName, TestHelper<KeyPair> helper,
+    public KeyFactoryTest(String algorithmName,
             Class<PublicKeySpec> publicKeySpecClass,
             Class<PrivateKeySpec> privateKeySpecClass) {
         this.algorithmName = algorithmName;
-        this.helper = helper;
         this.publicKeySpecClass = publicKeySpecClass;
         this.privateKeySpecClass = privateKeySpecClass;
     }
@@ -120,8 +115,8 @@
             fail(e.getMessage());
         }
 
-        KeyPair keyPair = new KeyPair(publicKey, privateKey);
-
-        helper.test(keyPair);
+        check(new KeyPair(publicKey, privateKey));
     }
+
+    protected void check(KeyPair keyPair) {}
 }
diff --git a/luni/src/test/java/tests/targets/security/KeyPairGeneratorTest.java b/support/src/test/java/tests/security/KeyPairGeneratorTest.java
similarity index 92%
rename from luni/src/test/java/tests/targets/security/KeyPairGeneratorTest.java
rename to support/src/test/java/tests/security/KeyPairGeneratorTest.java
index e7a8b35..adf8d4d 100644
--- a/luni/src/test/java/tests/targets/security/KeyPairGeneratorTest.java
+++ b/support/src/test/java/tests/security/KeyPairGeneratorTest.java
@@ -14,18 +14,15 @@
  * limitations under the License.
  */
 
-package tests.targets.security;
+package tests.security;
 
 import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
 import dalvik.annotation.TestTargetNew;
 import dalvik.annotation.TestTargets;
-
-import junit.framework.TestCase;
-
 import java.security.KeyPair;
 import java.security.KeyPairGenerator;
 import java.security.NoSuchAlgorithmException;
+import junit.framework.TestCase;
 
 public abstract class KeyPairGeneratorTest extends TestCase {
 
@@ -39,9 +36,6 @@
         this.helper = helper;
     }
 
-    /* (non-Javadoc)
-     * @see junit.framework.TestCase#setUp()
-     */
     protected void setUp() throws Exception {
         super.setUp();
         generator = getKeyPairGenerator();
@@ -73,7 +67,7 @@
                 args={}
             )
     })
-    public void testKeyPairGenerator() {
+    public void testKeyPairGenerator() throws NoSuchAlgorithmException {
         generator.initialize(1024);
 
         KeyPair keyPair = generator.generateKeyPair();
diff --git a/luni/src/test/java/tests/targets/security/MessageDigestTest.java b/support/src/test/java/tests/security/MessageDigestTest.java
similarity index 99%
rename from luni/src/test/java/tests/targets/security/MessageDigestTest.java
rename to support/src/test/java/tests/security/MessageDigestTest.java
index bbb6c1b..9ae4881 100644
--- a/luni/src/test/java/tests/targets/security/MessageDigestTest.java
+++ b/support/src/test/java/tests/security/MessageDigestTest.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
+package tests.security;
 
 import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetNew;
diff --git a/support/src/test/java/tests/security/SignatureHelper.java b/support/src/test/java/tests/security/SignatureHelper.java
new file mode 100644
index 0000000..c29efad
--- /dev/null
+++ b/support/src/test/java/tests/security/SignatureHelper.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.security;
+
+import java.security.InvalidKeyException;
+import java.security.KeyPair;
+import java.security.NoSuchAlgorithmException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.Signature;
+import java.security.SignatureException;
+import junit.framework.Assert;
+
+public class SignatureHelper extends TestHelper<KeyPair> {
+
+    private final String algorithmName;
+    private final String plainData = "some data do sign and verify";
+
+    public SignatureHelper(String algorithmName) {
+        this.algorithmName = algorithmName;
+    }
+
+    @Override
+    public void test(KeyPair keyPair) {
+        test(keyPair.getPrivate(), keyPair.getPublic());
+    }
+
+    public void test(PrivateKey encryptKey, PublicKey decryptKey) {
+
+        Signature signature = null;
+        try {
+            signature = Signature.getInstance(algorithmName);
+        } catch (NoSuchAlgorithmException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        try {
+            signature.initSign(encryptKey);
+        } catch (InvalidKeyException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        try {
+            signature.update(plainData.getBytes());
+        } catch (SignatureException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        byte[] signed = null;
+        try {
+            signed = signature.sign();
+        } catch (SignatureException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        try {
+            signature.initVerify(decryptKey);
+        } catch (InvalidKeyException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        try {
+            signature.update(plainData.getBytes());
+        } catch (SignatureException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        try {
+            Assert.assertTrue("signature could not be verified", signature
+                    .verify(signed));
+        } catch (SignatureException e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+}
diff --git a/luni/src/test/java/tests/targets/security/SignatureTest.java b/support/src/test/java/tests/security/SignatureTest.java
similarity index 98%
rename from luni/src/test/java/tests/targets/security/SignatureTest.java
rename to support/src/test/java/tests/security/SignatureTest.java
index 55748fb..c23d7ca 100644
--- a/luni/src/test/java/tests/targets/security/SignatureTest.java
+++ b/support/src/test/java/tests/security/SignatureTest.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
+package tests.security;
 
 import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetNew;
diff --git a/luni/src/test/java/tests/targets/security/KeyPairGeneratorTestDSA.java b/support/src/test/java/tests/security/TestHelper.java
similarity index 71%
copy from luni/src/test/java/tests/targets/security/KeyPairGeneratorTestDSA.java
copy to support/src/test/java/tests/security/TestHelper.java
index 0137106..aa5c9fd 100644
--- a/luni/src/test/java/tests/targets/security/KeyPairGeneratorTestDSA.java
+++ b/support/src/test/java/tests/security/TestHelper.java
@@ -13,14 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package tests.targets.security;
 
-import dalvik.annotation.TestTargetClass;
+package tests.security;
 
-public class KeyPairGeneratorTestDSA extends KeyPairGeneratorTest {
-
-    public KeyPairGeneratorTestDSA() {
-        super("DSA", new SignatureHelper("DSA"));
-    }
-
+public abstract class TestHelper<T> {
+    public abstract void test(T testObject);
 }
diff --git a/support/src/test/java/tests/support/resource/Support_Resources.java b/support/src/test/java/tests/support/resource/Support_Resources.java
index 0bd0ccf..9643347 100644
--- a/support/src/test/java/tests/support/resource/Support_Resources.java
+++ b/support/src/test/java/tests/support/resource/Support_Resources.java
@@ -36,8 +36,12 @@
     public static final String RESOURCE_PACKAGE_NAME = "tests.resources";
 
     public static InputStream getStream(String name) {
-        return Support_Resources.class.getResourceAsStream(RESOURCE_PACKAGE
-                + name);
+        String path = RESOURCE_PACKAGE + name;
+        InputStream result = Support_Resources.class.getResourceAsStream(path);
+        if (result == null) {
+            throw new IllegalArgumentException("No such resource: " + path);
+        }
+        return result;
     }
 
     public static String getURL(String name) {