changeset 13583:66a0979b0557

8031145: Re-examine closed i18n tests to see it they can be moved to the jdk repository. Reviewed-by: alanb, peytoia, naoto, phh
author andrew
date Fri, 28 Jun 2019 22:43:42 +0100
parents cb372d34618e
children 9b5707865a97
files test/TEST.groups test/java/awt/ComponentOrientation/BasicTest.java test/java/awt/ComponentOrientation/BorderTest.java test/java/awt/ComponentOrientation/FlowTest.java test/java/awt/ComponentOrientation/TestBundle.java test/java/awt/ComponentOrientation/TestBundle1.java test/java/awt/ComponentOrientation/TestBundle1_ar.java test/java/awt/ComponentOrientation/TestBundle_es.java test/java/awt/ComponentOrientation/TestBundle_iw.java test/java/awt/ComponentOrientation/WindowTest.java test/java/text/AttributedCharacterIterator/Attribute/ReadResolve.java test/java/text/AttributedString/AttributedStringTest.java test/java/text/AttributedString/TestAttributedStringCtor.java test/java/text/AttributedString/getRunStartLimitTest.java test/java/text/BreakIterator/BreakIteratorTest.java test/java/text/BreakIterator/Bug4533872.java test/java/text/BreakIterator/Bug4740757.java test/java/text/BreakIterator/Bug4912404.java test/java/text/BreakIterator/Bug4932583.java test/java/text/BreakIterator/Bug6513074.java test/java/text/BreakIterator/NewVSOld_th_TH.java test/java/text/BreakIterator/broken_th_TH.txt test/java/text/BreakIterator/test_th_TH.txt test/java/text/CharacterIterator/CharacterIteratorTest.java test/java/text/Collator/APITest.java test/java/text/Collator/Bug6271411.java test/java/text/Collator/CollationKeyTest.java test/java/text/Collator/CollationKeyTestImpl.java test/java/text/Collator/CollatorTest.java test/java/text/Collator/CurrencyCollate.java test/java/text/Collator/DanishTest.java test/java/text/Collator/DummyTest.java test/java/text/Collator/EnglishTest.java test/java/text/Collator/FinnishTest.java test/java/text/Collator/FrenchTest.java test/java/text/Collator/G7Test.java test/java/text/Collator/GermanTest.java test/java/text/Collator/IteratorTest.java test/java/text/Collator/JapaneseTest.java test/java/text/Collator/KoreanTest.java test/java/text/Collator/MonkeyTest.java test/java/text/Collator/Regression.java test/java/text/Collator/SpanishTest.java test/java/text/Collator/SurrogatesTest.java test/java/text/Collator/Test4401726.java test/java/text/Collator/ThaiTest.java test/java/text/Collator/TurkishTest.java test/java/text/Collator/VietnameseTest.java test/java/text/Format/ChoiceFormat/Bug4185732.ser.txt test/java/text/Format/ChoiceFormat/Bug4185732Test.java test/java/text/Format/ChoiceFormat/Bug4387255.java test/java/text/Format/DateFormat/Bug4322313.java test/java/text/Format/DateFormat/Bug4407042.java test/java/text/Format/DateFormat/Bug4736959.java test/java/text/Format/DateFormat/Bug4845901.java test/java/text/Format/DateFormat/Bug6251817.java test/java/text/Format/DateFormat/Bug6335238.java test/java/text/Format/DateFormat/Bug6530336.java test/java/text/Format/DateFormat/DateFormatRegression.java test/java/text/Format/DateFormat/DateFormatRoundTripTest.java test/java/text/Format/DateFormat/DateFormatSymbolsSerializationTest.java test/java/text/Format/DateFormat/DateFormatTest.java test/java/text/Format/DateFormat/IntlTestDateFormat.java test/java/text/Format/DateFormat/IntlTestDateFormatAPI.java test/java/text/Format/DateFormat/IntlTestDateFormatSymbols.java test/java/text/Format/DateFormat/IntlTestSimpleDateFormatAPI.java test/java/text/Format/DateFormat/NonGregorianFormatTest.java test/java/text/Format/DateFormat/SDFserialized.ser.txt test/java/text/Format/DateFormat/TimeZoneNameTest.java test/java/text/Format/DateFormat/bug4097450.java test/java/text/Format/DateFormat/bug4099975.java test/java/text/Format/DateFormat/bug4117335.java test/java/text/Format/DateFormat/bug4358730.java test/java/text/Format/DateFormat/bug6271375.java test/java/text/Format/DateFormat/bug6317072.java test/java/text/Format/DateFormat/bug6412896.java test/java/text/Format/MessageFormat/Bug4185816.ser.txt test/java/text/Format/MessageFormat/Bug4185816Corrupt.ser.txt test/java/text/Format/MessageFormat/Bug4185816Test.java test/java/text/Format/MessageFormat/Bug6481179.java test/java/text/Format/MessageFormat/LargeMessageFormat.java test/java/text/Format/MessageFormat/MessageFormatsByArgumentIndex.java test/java/text/Format/MessageFormat/MessageRegression.java test/java/text/Format/MessageFormat/MessageTest.java test/java/text/Format/MessageFormat/bug4492719.java test/java/text/Format/NumberFormat/BigDecimalCompatibilityTest.java test/java/text/Format/NumberFormat/BigDecimalFormat.java test/java/text/Format/NumberFormat/BigDecimalParse.java test/java/text/Format/NumberFormat/Bug4208135.java test/java/text/Format/NumberFormat/Bug4833877.java test/java/text/Format/NumberFormat/Bug4838107.java test/java/text/Format/NumberFormat/Bug4944439.java test/java/text/Format/NumberFormat/Bug4990596.java test/java/text/Format/NumberFormat/Bug6278616.java test/java/text/Format/NumberFormat/CurrencyFormat.java test/java/text/Format/NumberFormat/CurrencySymbols.properties test/java/text/Format/NumberFormat/DFSDeserialization142.java test/java/text/Format/NumberFormat/DFSExponential.java test/java/text/Format/NumberFormat/DFSSerialization.java test/java/text/Format/NumberFormat/DFSSerialization142.java test/java/text/Format/NumberFormat/DecimalFormat.114.txt test/java/text/Format/NumberFormat/DecimalFormatSymbols.114.txt test/java/text/Format/NumberFormat/DecimalFormatSymbols.142.txt test/java/text/Format/NumberFormat/IntlTestDecimalFormatAPI.java test/java/text/Format/NumberFormat/IntlTestDecimalFormatSymbols.java test/java/text/Format/NumberFormat/IntlTestNumberFormatAPI.java test/java/text/Format/NumberFormat/NumberFormat4185761a.ser.txt test/java/text/Format/NumberFormat/NumberFormat4185761b.ser.txt test/java/text/Format/NumberFormat/NumberFormatRounding.java test/java/text/Format/NumberFormat/NumberRegression.java test/java/text/Format/NumberFormat/NumberRoundTrip.java test/java/text/Format/NumberFormat/NumberTest.java test/java/text/Format/NumberFormat/PositionTest.java test/java/text/Format/NumberFormat/SerializationLoadTest.java test/java/text/Format/NumberFormat/SerializationSaveTest.java test/java/text/Format/NumberFormat/TestgetPatternSeparator_ja.java test/java/text/Format/common/Bug4769840.java test/java/text/Format/common/Bug6215962.java test/java/text/Format/common/ChoiceFormat.ser.txt test/java/text/Format/common/DateFormat.Field.ser.txt test/java/text/Format/common/FormatIteratorTest.java test/java/text/Format/common/MessageFormat.Field.ser.txt test/java/text/Format/common/NumberFormat.Field.ser.txt test/java/text/Format/common/PParser.java test/java/text/Format/common/dateFormat.props test/java/text/Format/common/decimalFormat.props test/java/text/Format/common/messageFormat.props test/java/text/testlib/HexDumpReader.java test/java/text/testlib/IntlTest.java test/java/util/Calendar/BuddhistCalendarTest.java test/java/util/Calendar/Bug4302966.java test/java/util/Calendar/Bug4766302.java test/java/util/Calendar/Bug4851640.java test/java/util/Calendar/Bug4958050.java test/java/util/Calendar/Bug5078053.java test/java/util/Calendar/Bug6178071.java test/java/util/Calendar/Bug6234795.java test/java/util/Calendar/Bug6448234.java test/java/util/Calendar/CalendarLimitTest.java test/java/util/Calendar/CalendarRegression.java test/java/util/Calendar/CalendarTest.java test/java/util/Calendar/FieldStateTest.java test/java/util/Calendar/GregorianCutoverTest.java test/java/util/Calendar/JulianTest.java test/java/util/Calendar/Koyomi.java test/java/util/Calendar/Limit.java test/java/util/Calendar/NonLenientTest.java test/java/util/Calendar/ResolutionTest.java test/java/util/Calendar/RollDayOfWeekTest.java test/java/util/Calendar/StampOverflow.java test/java/util/Calendar/ZoneOffsets.java test/java/util/Calendar/bug4028518.java test/java/util/Calendar/bug4100311.java test/java/util/Calendar/bug4243802.java test/java/util/Calendar/bug4316678.java test/java/util/Calendar/bug4372743.java test/java/util/Calendar/bug4401223.java test/java/util/Calendar/bug4409072.java test/java/util/Calendar/bug4514831.java test/java/util/Date/Bug4955000.java test/java/util/Date/DateGregorianCalendarTest.java test/java/util/Date/DateRegression.java test/java/util/Date/DateTest.java test/java/util/Date/TZ.java test/java/util/Date/TimestampTest.java test/java/util/TimeZone/Bug4322313.java test/java/util/TimeZone/Bug5097350.java test/java/util/TimeZone/DefaultTimeZoneTest.html test/java/util/TimeZone/DefaultTimeZoneTest.java test/java/util/TimeZone/HongKong.java test/java/util/TimeZone/IDTest.java test/java/util/TimeZone/TimeZoneBoundaryTest.java test/java/util/TimeZone/TimeZoneRegression.java test/java/util/TimeZone/TimeZoneTest.java test/java/util/TimeZone/TransitionTest.java test/java/util/TimeZone/UTCAliasTest.java test/java/util/TimeZone/bug4096952.java test/sun/text/IntHashtable/Bug4170614Test.java test/sun/text/IntHashtable/Bug4170614Test.sh test/sun/text/IntHashtable/Bug4705389.java
diffstat 180 files changed, 40054 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test/TEST.groups	Fri Jun 28 04:08:54 2019 +0100
+++ b/test/TEST.groups	Fri Jun 28 22:43:42 2019 +0100
@@ -379,12 +379,16 @@
   java/net/URLConnection/HandleContentTypeWithAttrs.java \
   java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh \
   java/security/Security/ClassLoaderDeadlock/Deadlock.sh \
+  java/text/AttributedCharacterIterator/Attribute/ReadResolve.java \
+  java/text/AttributedString/TestAttributedStringCtor.java \
+  java/text/AttributedString/getRunStartLimitTest.java \
   java/util/jar/Manifest/CreateManifest.java \
   java/util/logging/Listeners.java \
   java/util/logging/ListenersWithSM.java \
   java/util/logging/TestMainAppContext.java \
   java/util/logging/TestLoggingWithMainAppContext.java \
   java/util/ResourceBundle/Control/Bug6530694.java \
+  java/util/TimeZone/DefaultTimeZoneTest.java \
   java/text/Bidi/BidiConformance.java \
   java/text/Bidi/BidiEmbeddingTest.java \
   java/text/Bidi/Bug7042148.java \
@@ -590,6 +594,7 @@
   java/util/Collections/UnmodifiableMapEntrySet.java  \
   java/util/Comparator/BasicTest.java  \
   java/util/Comparator/TypeTest.java  \
+  java/util/Date/TimestampTest.java \
   java/util/Iterator/IteratorDefaults.java  \
   java/util/Iterator/PrimitiveIteratorDefaults.java  \
   java/util/List/ListDefaults.java  \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/ComponentOrientation/BasicTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     4108453 4778440 6304780 6396378
+ * @summary Basic tests for java.awt.ComponentOrientation
+ * @build TestBundle TestBundle_es TestBundle_iw
+ * @build TestBundle1 TestBundle1_ar
+ *
+ * @run main BasicTest
+ */
+/*
+ * (C) Copyright IBM Corp. 1998 - All Rights Reserved
+ *
+ * The original version of this source code and documentation is copyrighted
+ * and owned by IBM, Inc. These materials are provided under terms of a
+ * License Agreement between IBM and Sun. This technology is protected by
+ * multiple US and International patents. This notice and attribution to IBM
+ * may not be removed.
+ */
+
+import java.awt.ComponentOrientation;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+public class BasicTest {
+    public static void main(String args[]) {
+        System.out.println("BasicTest {");
+        TestInvariants();
+        TestLocale();
+        TestBundle();
+
+        System.out.println("} Pass");
+    }
+
+    // TestInvariants
+    //
+    // Various no-brainer tests to make sure the constants behave properly
+    // and so on.
+    //
+    static void TestInvariants() {
+        System.out.println("  TestInvariants {");
+
+        Assert(ComponentOrientation.LEFT_TO_RIGHT.isLeftToRight(),
+               "LEFT_TO_RIGHT.isLeftToRight()");
+
+        Assert(ComponentOrientation.UNKNOWN.isLeftToRight(),
+               "UNKNOWN.isLeftToRight()");
+
+        Assert(!ComponentOrientation.RIGHT_TO_LEFT.isLeftToRight(),
+               "!RIGHT_TO_LEFT.isLeftToRight()");
+
+        Assert(ComponentOrientation.LEFT_TO_RIGHT.isHorizontal(),
+               "LEFT_TO_RIGHT.isHorizontal()");
+
+        Assert(ComponentOrientation.UNKNOWN.isHorizontal(),
+               "UNKNOWN.isHorizontal()");
+
+        Assert(ComponentOrientation.RIGHT_TO_LEFT.isHorizontal(),
+               "RIGHT_TO_LEFT.isHorizontal()");
+
+        System.out.println("  } Pass");
+    }
+
+    // TestLocale
+    //
+    // Make sure that getOrientation(Locale) works, and that the appropriate
+    // system locales are RIGHT_TO_LEFT
+    //
+    static void TestLocale() {
+        System.out.println("  TestLocale {");
+
+        ComponentOrientation orient = ComponentOrientation.getOrientation(Locale.US);
+        Assert(orient == ComponentOrientation.LEFT_TO_RIGHT, "US == LEFT_TO_RIGHT");
+
+        orient = ComponentOrientation.getOrientation(new Locale("iw", ""));
+        Assert(orient == ComponentOrientation.RIGHT_TO_LEFT, "iw == RIGHT_TO_LEFT");
+
+        orient = ComponentOrientation.getOrientation(new Locale("ar", ""));
+        Assert(orient == ComponentOrientation.RIGHT_TO_LEFT, "ar == RIGHT_TO_LEFT");
+
+        System.out.println("  } Pass");
+    }
+
+    // TestBundle
+    //
+    // Make sure that getOrientation(ResourceBundle) works right, especially
+    // the fallback mechasm
+    //
+    static void TestBundle() {
+        System.out.println("  TestBundle {");
+
+        // This will fall back to the default locale's bundle or root bundle
+        ResourceBundle rb = ResourceBundle.getBundle("TestBundle",
+                                                        new Locale("et", ""));
+        if (rb.getLocale().getLanguage().equals(new Locale("iw").getLanguage())) {
+            assertEquals(rb, ComponentOrientation.RIGHT_TO_LEFT, "et == RIGHT_TO_LEFT" );
+        } else if (rb.getLocale().getLanguage() == "es") {
+            assertEquals(rb, ComponentOrientation.LEFT_TO_RIGHT, "et == LEFT_TO_RIGHT" );
+        } else {
+            assertEquals(rb, ComponentOrientation.UNKNOWN, "et == UNKNOWN" );
+        }
+
+        // We have actual bundles for "es" and "iw", so it should just fetch
+        // the orientation object out of them
+        rb = ResourceBundle.getBundle("TestBundle",new Locale("es", ""));
+        assertEquals(rb, ComponentOrientation.LEFT_TO_RIGHT, "es == LEFT_TO_RIGHT" );
+
+        rb = ResourceBundle.getBundle("TestBundle", new Locale("iw", "IL"));
+        assertEquals(rb, ComponentOrientation.RIGHT_TO_LEFT, "iw == RIGHT_TO_LEFT" );
+
+        // This bundle has no orientation setting at all, so we should get
+        // the system's default orientation for Arabic
+        rb = ResourceBundle.getBundle("TestBundle1", new Locale("ar", ""));
+        assertEquals(rb, ComponentOrientation.RIGHT_TO_LEFT, "ar == RIGHT_TO_LEFT" );
+
+        System.out.println("  } Pass");
+    }
+
+    static void assertEquals(ResourceBundle rb, ComponentOrientation o, String str) {
+        Assert(ComponentOrientation.getOrientation(rb) == o, str);
+    }
+
+    static void Assert(boolean condition, String str) {
+        if (!condition) {
+            System.err.println("    ASSERT FAILED: " + str);
+            throw new RuntimeException("Assert Failed: " + str);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/ComponentOrientation/BorderTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     4108453
+ * @summary Test ComponentOrientation (Bidi) support in BorderLayout
+ */
+/*
+ * (C) Copyright IBM Corp. 1998 - All Rights Reserved
+ *
+ * The original version of this source code and documentation is copyrighted
+ * and owned by IBM, Inc. These materials are provided under terms of a
+ * License Agreement between IBM and Sun. This technology is protected by
+ * multiple US and International patents. This notice and attribution to IBM
+ * may not be removed.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.Applet;
+
+public class BorderTest extends Applet {
+    Panel       panel1;
+    Panel       panel2;
+
+    public BorderTest() {
+        setLayout(new GridLayout(0,2));
+
+        // Create a panel with a BorderLayout and a bunch of buttons in it
+        panel1 = new Panel();
+        panel1.setLayout(new BorderLayout());
+        panel1.add("North", new Button("North"));
+        panel1.add("South", new Button("South"));
+        panel1.add("East", new Button("East"));
+        panel1.add("West", new Button("West"));
+        panel1.add("Center", new Button("Center"));
+        add(panel1);
+
+        // Create a panel with a BorderLayout and a bunch of buttons in it
+        panel2 = new Panel();
+        panel2.setLayout(new BorderLayout());
+        panel2.add(BorderLayout.BEFORE_FIRST_LINE, new Button("FirstLine"));
+        panel2.add(BorderLayout.AFTER_LAST_LINE, new Button("LastLine"));
+        panel2.add(BorderLayout.BEFORE_LINE_BEGINS, new Button("FirstItem"));
+        panel2.add(BorderLayout.AFTER_LINE_ENDS, new Button("LastItem"));
+        panel2.add("Center", new Button("Center"));
+        add(panel2);
+
+        // Create a popup menu for switching between orientations
+        {
+            Choice c = new Choice();
+            c.addItem("LEFT_TO_RIGHT");
+            c.addItem("RIGHT_TO_LEFT");
+            c.addItem("UNKNOWN");
+            c.addItemListener( new ItemListener() {
+                public void itemStateChanged(ItemEvent e) {
+                    String item = (String)(e.getItem());
+
+                    ComponentOrientation o = ComponentOrientation.UNKNOWN;
+                    if (item.equals("LEFT_TO_RIGHT")) {
+                        o = ComponentOrientation.LEFT_TO_RIGHT;
+                    } else if (item.equals("RIGHT_TO_LEFT")) {
+                        o = ComponentOrientation.RIGHT_TO_LEFT;
+                    }
+                    panel1.setComponentOrientation(o);
+                    panel2.setComponentOrientation(o);
+                    panel1.layout();
+                    panel2.layout();
+                    panel1.repaint();
+                    panel2.repaint();
+                }
+            } );
+            add(c);
+        }
+    }
+
+    public static void main(String args[]) {
+        Frame f = new Frame("BorderTest");
+
+        f.addWindowListener( new WindowAdapter() {
+            public void windowClosing(WindowEvent e) {
+                e.getWindow().hide();
+                e.getWindow().dispose();
+                System.exit(0);
+            };
+        } );
+
+        BorderTest BorderTest = new BorderTest();
+        BorderTest.init();
+        BorderTest.start();
+
+        f.add("Center", BorderTest);
+        f.setSize(450, 300);
+        f.show();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/ComponentOrientation/FlowTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     4108453
+ * @summary Test ComponentOrientation (Bidi) support in FlowLayout
+ */
+/*
+ * (C) Copyright IBM Corp. 1998 - All Rights Reserved
+ *
+ * The original version of this source code and documentation is copyrighted
+ * and owned by IBM, Inc. These materials are provided under terms of a
+ * License Agreement between IBM and Sun. This technology is protected by
+ * multiple US and International patents. This notice and attribution to IBM
+ * may not be removed.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.Applet;
+
+public class FlowTest extends Applet {
+    Panel       panel;
+
+    public FlowTest() {
+        setLayout(new BorderLayout());
+
+        // Create a panel with a FlowLayout and a bunch of buttons in it
+        panel = new Panel();
+        panel.setLayout(new FlowLayout(FlowLayout.LEFT));
+        panel.add(new Button("one"));
+        panel.add(new Button("two"));
+        panel.add(new Button("three"));
+        panel.add(new Button("four"));
+        panel.add(new Button("five"));
+        panel.add(new Button("six"));
+        panel.add(new Button("seven"));
+        panel.add(new Button("eight"));
+        panel.add(new Button("nine"));
+        panel.add(new Button("ten"));
+        panel.add(new Button("eleven"));
+
+        add("Center", panel);
+
+        Panel controls = new Panel();
+        controls.setLayout(new GridLayout(0, 2));
+
+        // Menu for setting the alignment of the main FlowLayout panel
+        {
+            Choice c = new Choice();
+            c.addItem("LEFT");
+            c.addItem("CENTER");
+            c.addItem("RIGHT");
+            c.addItem("LEADING");
+            c.addItem("TRAILING");
+            c.addItemListener( new ItemListener() {
+                public void itemStateChanged(ItemEvent e) {
+                    String item = (String)(e.getItem());
+                    FlowLayout layout = (FlowLayout) panel.getLayout();
+
+                    if (item.equals("LEFT")) {
+                        layout.setAlignment(FlowLayout.LEFT);
+                    } else if (item.equals("CENTER")) {
+                        layout.setAlignment(FlowLayout.CENTER);
+                    } else if (item.equals("RIGHT")) {
+                        layout.setAlignment(FlowLayout.RIGHT);
+                    } else if (item.equals("LEADING")) {
+                        layout.setAlignment(FlowLayout.LEADING);
+                    } else if (item.equals("TRAILING")) {
+                        layout.setAlignment(FlowLayout.TRAILING);
+                    }
+                    panel.layout();
+                    panel.repaint();
+                }
+            } );
+            controls.add(new Label("FlowLayout Alignment:"));
+            controls.add(c);
+        }
+
+        // Create a popup menu for switching the Panel between orientations
+        {
+            Choice c = new Choice();
+            c.addItem("LEFT_TO_RIGHT");
+            c.addItem("RIGHT_TO_LEFT");
+            c.addItem("UNKNOWN");
+            c.addItemListener( new ItemListener() {
+                public void itemStateChanged(ItemEvent e) {
+                    String item = (String)(e.getItem());
+
+                    if (item.equals("LEFT_TO_RIGHT")) {
+                        panel.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+                    } else if (item.equals("RIGHT_TO_LEFT")) {
+                        panel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+                    } else {
+                        panel.setComponentOrientation(ComponentOrientation.UNKNOWN);
+                    }
+                    panel.layout();
+                    panel.repaint();
+                }
+            } );
+
+            controls.add(new Label("ComponentOrientation:"));
+            controls.add(c);
+        }
+
+        add("South", controls);
+
+    }
+
+    public static void main(String args[]) {
+        Frame f = new Frame("FlowTest");
+
+        f.addWindowListener( new WindowAdapter() {
+            public void windowClosing(WindowEvent e) {
+                e.getWindow().hide();
+                e.getWindow().dispose();
+                System.exit(0);
+            };
+        } );
+
+        FlowTest flowTest = new FlowTest();
+        flowTest.init();
+        flowTest.start();
+
+        f.add("Center", flowTest);
+        f.setSize(300, 300);
+        f.show();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/ComponentOrientation/TestBundle.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * TestBundle.java -- used by BasicTest
+ *
+ * (C) Copyright IBM Corp. 1998 - All Rights Reserved
+ *
+ * The original version of this source code and documentation is copyrighted
+ * and owned by IBM, Inc. These materials are provided under terms of a
+ * License Agreement between IBM and Sun. This technology is protected by
+ * multiple US and International patents. This notice and attribution to IBM
+ * may not be removed.
+ */
+
+import java.util.ListResourceBundle;
+import java.awt.ComponentOrientation;
+
+public class TestBundle extends ListResourceBundle {
+
+    protected Object[][] getContents() {
+        return new Object[][] {
+            { "Orientation", ComponentOrientation.UNKNOWN },
+        };
+    }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/ComponentOrientation/TestBundle1.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * TestBundle1.java -- used by BasicTest
+ *
+ * @bug     4108453
+ * @summary Basic tests for java.awt.ComponentOrientation
+ *
+ * (C) Copyright IBM Corp. 1998 - All Rights Reserved
+ *
+ * The original version of this source code and documentation is copyrighted
+ * and owned by IBM, Inc. These materials are provided under terms of a
+ * License Agreement between IBM and Sun. This technology is protected by
+ * multiple US and International patents. This notice and attribution to IBM
+ * may not be removed.
+ */
+
+import java.util.ListResourceBundle;
+import java.awt.ComponentOrientation;
+
+public class TestBundle1 extends ListResourceBundle {
+
+    protected Object[][] getContents() {
+        return new Object[][] {
+            {  },
+        };
+    }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/ComponentOrientation/TestBundle1_ar.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * TestBundle1_ar.java -- used by BasicTest
+ *
+ * @bug     4108453
+ * @summary Basic tests for java.awt.ComponentOrientation
+ *
+ * (C) Copyright IBM Corp. 1998 - All Rights Reserved
+ *
+ * The original version of this source code and documentation is copyrighted
+ * and owned by IBM, Inc. These materials are provided under terms of a
+ * License Agreement between IBM and Sun. This technology is protected by
+ * multiple US and International patents. This notice and attribution to IBM
+ * may not be removed.
+ */
+
+import java.util.ListResourceBundle;
+import java.awt.ComponentOrientation;
+
+public class TestBundle1_ar extends ListResourceBundle {
+
+    protected Object[][] getContents() {
+        return new Object[][] {
+            {  },
+        };
+    }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/ComponentOrientation/TestBundle_es.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * TestBundle_es.java -- used by BasicTest
+ *
+ * (C) Copyright IBM Corp. 1998 - All Rights Reserved
+ *
+ * The original version of this source code and documentation is copyrighted
+ * and owned by IBM, Inc. These materials are provided under terms of a
+ * License Agreement between IBM and Sun. This technology is protected by
+ * multiple US and International patents. This notice and attribution to IBM
+ * may not be removed.
+ */
+
+import java.util.ListResourceBundle;
+import java.awt.ComponentOrientation;
+
+public class TestBundle_es extends ListResourceBundle {
+
+    protected Object[][] getContents() {
+        return new Object[][] {
+            { "Orientation", ComponentOrientation.LEFT_TO_RIGHT },
+        };
+    }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/ComponentOrientation/TestBundle_iw.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ *
+ *
+ * used by BasicTest
+ *
+ * (C) Copyright IBM Corp. 1998 - All Rights Reserved
+ *
+ * The original version of this source code and documentation is copyrighted
+ * and owned by IBM, Inc. These materials are provided under terms of a
+ * License Agreement between IBM and Sun. This technology is protected by
+ * multiple US and International patents. This notice and attribution to IBM
+ * may not be removed.
+ */
+
+import java.util.ListResourceBundle;
+import java.awt.ComponentOrientation;
+
+public class TestBundle_iw extends ListResourceBundle {
+
+    protected Object[][] getContents() {
+        return new Object[][] {
+            { "Orientation", ComponentOrientation.RIGHT_TO_LEFT },
+        };
+    }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/ComponentOrientation/WindowTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug     4108453 4778440 6304785
+ * @summary Test Window.applyResourceBundle orientation support
+ *
+ * @build TestBundle TestBundle_es TestBundle_iw
+ * @build TestBundle1 TestBundle1_ar
+ * @run main WindowTest
+ */
+
+import java.awt.*;
+import java.applet.*;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+public class WindowTest extends Applet {
+    static Exception failure=null;
+    static Thread mainThread=null;
+
+    public static void main(String args[]) throws Exception {
+        mainThread = Thread.currentThread();
+        WindowTest app = new WindowTest();
+        app.start();
+        try {
+            Thread.sleep(300000);
+        } catch (InterruptedException e) {
+            if (failure != null) {
+                throw failure;
+            }
+        }
+    }
+
+    public void start() {
+        try {
+            doTest();
+        } catch (Exception e) {
+            failure = e;
+        }
+        mainThread.interrupt();
+    }
+
+    public void doTest() {
+        System.out.println("WindowTest {");
+
+        ResourceBundle rb;
+        Frame myFrame;
+
+        // Create a window containing a hierarchy of components.
+        System.out.println("  Creating component hierarchy...");
+        myFrame = new Frame();
+        myFrame.setLayout(new FlowLayout());
+        Panel panel1 = new Panel();
+        panel1.setLayout(new BorderLayout());
+        panel1.add("North", new Button("North"));
+        panel1.add("South", new Button("South"));
+        panel1.add("East", new Button("East"));
+        panel1.add("West", new Button("West"));
+        panel1.add("Center", new Button("Center"));
+        myFrame.add(panel1);
+
+        Panel panel2 = new Panel();
+        panel2.setLayout(new BorderLayout());
+        panel2.add(BorderLayout.BEFORE_FIRST_LINE, new Button("FirstLine"));
+        panel2.add(BorderLayout.AFTER_LAST_LINE, new Button("LastLine"));
+        panel2.add(BorderLayout.BEFORE_LINE_BEGINS, new Button("FirstItem"));
+        panel2.add(BorderLayout.AFTER_LINE_ENDS, new Button("LastItem"));
+        panel2.add("Center", new Button("Center"));
+        myFrame.add(panel2);
+
+        // After construction, all of the components' orientations should be
+        // set to ComponentOrientation.UNKNOWN.
+        System.out.println("  Verifying orientation is UNKNOWN...");
+        verifyOrientation(myFrame, ComponentOrientation.UNKNOWN);
+
+        // This will load TestBundle1 using the default locale and apply
+        // it to the component hierarchy.  Since the bundle has no Orientation
+        // specified, this should fall back to the bundle-locale's orientation
+        System.out.println("  Applying TestBundle1 by name and verifying...");
+        myFrame.applyResourceBundle("TestBundle1");
+        verifyOrientation(myFrame,
+                    ComponentOrientation.getOrientation(
+                        ResourceBundle.getBundle("TestBundle1", Locale.getDefault())));
+
+        System.out.println("  Applying TestBundle_iw and verifying...");
+        rb = ResourceBundle.getBundle("TestBundle", new Locale("iw", ""));
+        myFrame.applyResourceBundle(rb);
+        verifyOrientation(myFrame, ComponentOrientation.RIGHT_TO_LEFT);
+
+        System.out.println("  Applying TestBundle_es and verifying...");
+        rb = ResourceBundle.getBundle("TestBundle", new Locale("es", ""));
+        myFrame.applyResourceBundle(rb);
+        verifyOrientation(myFrame, ComponentOrientation.LEFT_TO_RIGHT);
+
+
+        myFrame.setVisible(false);
+        myFrame.dispose();
+        System.out.println("}");
+    }
+
+    static void verifyOrientation(Component c, ComponentOrientation orient) {
+
+        ComponentOrientation o = c.getComponentOrientation();
+
+        if (o != orient) {
+            throw new RuntimeException("ERROR: expected " + oString(orient) +
+                                        ", got " + oString(o) +
+                                        " on component " + c);
+        }
+
+        if (c instanceof Container) {
+            Container cont = (Container) c;
+            int ncomponents = cont.getComponentCount();
+
+            for (int i = 0 ; i < ncomponents ; ++i) {
+                Component comp = cont.getComponent(i);
+                verifyOrientation(comp, orient);
+            }
+        }
+    }
+
+    static String oString(ComponentOrientation o) {
+        if (o == ComponentOrientation.LEFT_TO_RIGHT) {
+            return "LEFT_TO_RIGHT";
+        }
+        else if (o == ComponentOrientation.RIGHT_TO_LEFT) {
+            return "RIGHT_TO_LEFT";
+        }
+        else {
+            return "UNKNOWN";
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/AttributedCharacterIterator/Attribute/ReadResolve.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+   @bug 4136620 4144590
+   @summary Make sure that Attribute & subclasses are serialized and deserialized correctly
+   @modules java.desktop
+ */
+
+import java.text.AttributedCharacterIterator.Attribute;
+import java.awt.font.TextAttribute;
+import java.io.*;
+
+public class ReadResolve {
+
+    public static void main(String[] args) throws Exception {
+        testSerializationCycle(Attribute.LANGUAGE);
+        testSerializationCycle(TextAttribute.INPUT_METHOD_HIGHLIGHT);
+
+        boolean gotException = false;
+        Attribute result = null;
+        try {
+            result = doSerializationCycle(FakeAttribute.LANGUAGE);
+        } catch (Throwable e) {
+            gotException = true;
+        }
+        if (!gotException) {
+            throw new RuntimeException("Attribute should throw an exception when given a fake \"language\" attribute. Deserialized object: " + result);
+        }
+    }
+
+    static Attribute doSerializationCycle(Attribute attribute) throws Exception {
+
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        ObjectOutputStream  oos  =  new  ObjectOutputStream(baos);
+        oos.writeObject(attribute);
+        oos.flush();
+
+        byte[] data = baos.toByteArray();
+
+        ByteArrayInputStream bais = new ByteArrayInputStream(data);
+        ObjectInputStream ois = new ObjectInputStream(bais);
+        Attribute result = (Attribute) ois.readObject();
+
+        return result;
+    }
+
+    static void testSerializationCycle(Attribute attribute) throws Exception {
+        Attribute result = doSerializationCycle(attribute);
+        if (result != attribute) {
+            throw new RuntimeException("attribute changed identity during serialization/deserialization");
+        }
+    }
+
+    private static class FakeAttribute extends Attribute {
+
+        // This LANGUAGE attribute should never be confused with the
+        // Attribute.LANGUAGE attribute. However, we don't override
+        // readResolve here, so that deserialization goes
+        // to Attribute. Attribute has to catch this problem and reject
+        // the fake attribute.
+        static final FakeAttribute LANGUAGE = new FakeAttribute("language");
+
+        FakeAttribute(String name) {
+            super(name);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/AttributedString/AttributedStringTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,258 @@
+/*
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 4139771
+ * @summary test all aspects of AttributedString class
+ */
+
+import java.text.Annotation;
+import java.text.AttributedCharacterIterator;
+import java.text.AttributedCharacterIterator.Attribute;
+import java.text.AttributedString;
+import java.text.CharacterIterator;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+
+public class AttributedStringTest {
+
+    private static final String text = "Hello, world!";
+    private static final Annotation hi = new Annotation("hi");
+    private static final int[] array5_13 = {5, 13};
+    private static final int[] array3_9_13 = {3, 9, 13};
+    private static final int[] array5_9_13 = {5, 9, 13};
+    private static final int[] array3_5_9_13 = {3, 5, 9, 13};
+    private static final Attribute[] arrayLanguage = {Attribute.LANGUAGE};
+    private static final Attribute[] arrayLanguageReading = {Attribute.LANGUAGE, Attribute.READING};
+    private static final Set setLanguageReading = new HashSet();
+    static {
+        setLanguageReading.add(Attribute.LANGUAGE);
+        setLanguageReading.add(Attribute.READING);
+    }
+
+
+    public static final void main(String argv[]) throws Exception {
+
+
+        AttributedString string;
+        AttributedCharacterIterator iterator;
+
+        // create a string with text, but no attributes
+        string = new AttributedString(text);
+        iterator = string.getIterator();
+
+        // make sure the text is there and attributes aren't
+        checkIteratorText(iterator, text);
+        if (!iterator.getAllAttributeKeys().isEmpty()) {
+            throwException(iterator, "iterator provides attributes where none are defined");
+        }
+
+        // add an attribute to a subrange
+        string.addAttribute(Attribute.LANGUAGE, Locale.ENGLISH, 3, 9);
+        iterator = string.getIterator();
+
+        // make sure the attribute is defined, and it's on the correct subrange
+        checkIteratorAttributeKeys(iterator, arrayLanguage);
+        checkIteratorSubranges(iterator, array3_9_13);
+        checkIteratorAttribute(iterator, 0, Attribute.LANGUAGE, null);
+        checkIteratorAttribute(iterator, 3, Attribute.LANGUAGE, Locale.ENGLISH);
+        checkIteratorAttribute(iterator, 9, Attribute.LANGUAGE, null);
+
+        // add an attribute to a subrange
+        string.addAttribute(Attribute.READING, hi, 0, 5);
+        iterator = string.getIterator();
+
+        // make sure the attribute is defined, and it's on the correct subrange
+        checkIteratorAttributeKeys(iterator, arrayLanguageReading);
+        checkIteratorSubranges(iterator, array3_5_9_13);
+        checkIteratorAttribute(iterator, 0, Attribute.READING, hi);
+        checkIteratorAttribute(iterator, 3, Attribute.READING, hi);
+        checkIteratorAttribute(iterator, 5, Attribute.READING, null);
+        checkIteratorAttribute(iterator, 9, Attribute.READING, null);
+
+        // make sure the first attribute wasn't adversely affected
+        // in particular, we shouldn't see separate subranges (3,5) and (5,9).
+        checkIteratorSubranges(iterator, Attribute.LANGUAGE, array3_9_13);
+        checkIteratorAttribute(iterator, 0, Attribute.LANGUAGE, null);
+        checkIteratorAttribute(iterator, 3, Attribute.LANGUAGE, Locale.ENGLISH);
+        checkIteratorAttribute(iterator, 5, Attribute.LANGUAGE, Locale.ENGLISH);
+        checkIteratorAttribute(iterator, 9, Attribute.LANGUAGE, null);
+
+        // for the entire set of attributes, we expect four subranges
+        checkIteratorSubranges(iterator, setLanguageReading, array3_5_9_13);
+
+        // redefine the language attribute so that both language and reading are continuous from 0 to 5
+        string.addAttribute(Attribute.LANGUAGE, Locale.US, 0, 5);
+        iterator = string.getIterator();
+
+        // make sure attributes got changed and merged correctly
+        checkIteratorAttributeKeys(iterator, arrayLanguageReading);
+        checkIteratorSubranges(iterator, array3_5_9_13);
+        checkIteratorSubranges(iterator, Attribute.LANGUAGE, array5_9_13);
+        checkIteratorSubranges(iterator, Attribute.READING, array5_13);
+        checkIteratorSubranges(iterator, setLanguageReading, array5_9_13);
+        checkIteratorAttribute(iterator, 0, Attribute.LANGUAGE, Locale.US);
+        checkIteratorAttribute(iterator, 3, Attribute.LANGUAGE, Locale.US);
+        checkIteratorAttribute(iterator, 5, Attribute.LANGUAGE, Locale.ENGLISH);
+        checkIteratorAttribute(iterator, 9, Attribute.LANGUAGE, null);
+
+        // make sure an annotation is only returned if its range is contained in the iterator's range
+        iterator = string.getIterator(null, 3, 5);
+        checkIteratorAttribute(iterator, 3, Attribute.READING, null);
+        checkIteratorAttribute(iterator, 5, Attribute.READING, null);
+        iterator = string.getIterator(null, 0, 4);
+        checkIteratorAttribute(iterator, 0, Attribute.READING, null);
+        checkIteratorAttribute(iterator, 3, Attribute.READING, null);
+        iterator = string.getIterator(null, 0, 5);
+        checkIteratorAttribute(iterator, 0, Attribute.READING, hi);
+        checkIteratorAttribute(iterator, 4, Attribute.READING, hi);
+        checkIteratorAttribute(iterator, 5, Attribute.READING, null);
+
+    }
+
+    private static final void checkIteratorText(AttributedCharacterIterator iterator, String expectedText) throws Exception {
+        if (iterator.getEndIndex() - iterator.getBeginIndex() != expectedText.length()) {
+            throwException(iterator, "text length doesn't match between original text and iterator");
+        }
+
+        char c = iterator.first();
+        for (int i = 0; i < expectedText.length(); i++) {
+            if (c != expectedText.charAt(i)) {
+                throwException(iterator, "text content doesn't match between original text and iterator");
+            }
+            c = iterator.next();
+        }
+        if (c != CharacterIterator.DONE) {
+            throwException(iterator, "iterator text doesn't end with DONE");
+        }
+    }
+
+    private static final void checkIteratorAttributeKeys(AttributedCharacterIterator iterator, Attribute[] expectedKeys) throws Exception {
+         Set iteratorKeys = iterator.getAllAttributeKeys();
+         if (iteratorKeys.size() != expectedKeys.length) {
+             throwException(iterator, "number of keys returned by iterator doesn't match expectation");
+         }
+         for (int i = 0; i < expectedKeys.length; i++) {
+             if (!iteratorKeys.contains(expectedKeys[i])) {
+                 throwException(iterator, "expected key wasn't found in iterator's key set");
+             }
+         }
+    }
+
+    private static final void checkIteratorSubranges(AttributedCharacterIterator iterator, int[] expectedLimits) throws Exception {
+        int previous = 0;
+        char c = iterator.first();
+        for (int i = 0; i < expectedLimits.length; i++) {
+             if (iterator.getRunStart() != previous || iterator.getRunLimit() != expectedLimits[i]) {
+                 throwException(iterator, "run boundaries are not as expected: " + iterator.getRunStart() + ", " + iterator.getRunLimit());
+             }
+             previous = expectedLimits[i];
+             c = iterator.setIndex(previous);
+        }
+        if (c != CharacterIterator.DONE) {
+            throwException(iterator, "iterator's run sequence doesn't end with DONE");
+        }
+    }
+
+    private static final void checkIteratorSubranges(AttributedCharacterIterator iterator, Attribute key, int[] expectedLimits) throws Exception {
+        int previous = 0;
+        char c = iterator.first();
+        for (int i = 0; i < expectedLimits.length; i++) {
+             if (iterator.getRunStart(key) != previous || iterator.getRunLimit(key) != expectedLimits[i]) {
+                 throwException(iterator, "run boundaries are not as expected: " + iterator.getRunStart(key) + ", " + iterator.getRunLimit(key) + " for key " + key);
+             }
+             previous = expectedLimits[i];
+             c = iterator.setIndex(previous);
+        }
+        if (c != CharacterIterator.DONE) {
+            throwException(iterator, "iterator's run sequence doesn't end with DONE");
+        }
+    }
+
+    private static final void checkIteratorSubranges(AttributedCharacterIterator iterator, Set keys, int[] expectedLimits) throws Exception {
+        int previous = 0;
+        char c = iterator.first();
+        for (int i = 0; i < expectedLimits.length; i++) {
+             if (iterator.getRunStart(keys) != previous || iterator.getRunLimit(keys) != expectedLimits[i]) {
+                 throwException(iterator, "run boundaries are not as expected: " + iterator.getRunStart(keys) + ", " + iterator.getRunLimit(keys) + " for keys " + keys);
+             }
+             previous = expectedLimits[i];
+             c = iterator.setIndex(previous);
+        }
+        if (c != CharacterIterator.DONE) {
+            throwException(iterator, "iterator's run sequence doesn't end with DONE");
+        }
+    }
+
+    private static final void checkIteratorAttribute(AttributedCharacterIterator iterator, int index, Attribute key, Object expectedValue) throws Exception {
+        iterator.setIndex(index);
+        Object value = iterator.getAttribute(key);
+        if (!((expectedValue == null && value == null) || (expectedValue != null && expectedValue.equals(value)))) {
+            throwException(iterator, "iterator returns wrong attribute value - " + value + " instead of " + expectedValue);
+        }
+        value = iterator.getAttributes().get(key);
+        if (!((expectedValue == null && value == null) || (expectedValue != null && expectedValue.equals(value)))) {
+            throwException(iterator, "iterator's map returns wrong attribute value - " + value + " instead of " + expectedValue);
+        }
+    }
+
+    private static final void throwException(AttributedCharacterIterator iterator, String details) throws Exception {
+        dumpIterator(iterator);
+        throw new Exception(details);
+    }
+
+    private static final void dumpIterator(AttributedCharacterIterator iterator) {
+        Set attributeKeys = iterator.getAllAttributeKeys();
+        System.out.print("All attributes: ");
+        Iterator keyIterator = attributeKeys.iterator();
+        while (keyIterator.hasNext()) {
+            Attribute key = (Attribute) keyIterator.next();
+            System.out.print(key);
+        }
+        for(char c = iterator.first(); c != CharacterIterator.DONE; c = iterator.next()) {
+            if (iterator.getIndex() == iterator.getBeginIndex() ||
+                        iterator.getIndex() == iterator.getRunStart()) {
+                System.out.println();
+                Map attributes = iterator.getAttributes();
+                Set entries = attributes.entrySet();
+                Iterator attributeIterator = entries.iterator();
+                while (attributeIterator.hasNext()) {
+                    Map.Entry entry = (Map.Entry) attributeIterator.next();
+                    System.out.print("<" + entry.getKey() + ": "
+                                + entry.getValue() + ">");
+                }
+            }
+            System.out.print(" ");
+            System.out.print(c);
+        }
+        System.out.println();
+        System.out.println("done");
+        System.out.println();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/AttributedString/TestAttributedStringCtor.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 4146853
+ * @summary Make sure we can construct an AttributedString from
+ * an AttributedCharacterIterator covering only a subrange
+ * @modules java.desktop
+ */
+
+import java.awt.font.TextAttribute;
+import java.text.AttributedCharacterIterator;
+import java.text.AttributedString;
+import java.util.Hashtable;
+
+public class TestAttributedStringCtor {
+
+    public static void main(String[] args) {
+
+        // Create a new AttributedString with one attribute.
+        Hashtable attributes = new Hashtable();
+        attributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
+        AttributedString origString = new AttributedString("Hello world.", attributes);
+
+        // Create an iterator over part of the AttributedString.
+        AttributedCharacterIterator iter = origString.getIterator(null, 4, 6);
+
+        // Attempt to create a new AttributedString from the iterator.
+        // This will throw IllegalArgumentException.
+        AttributedString newString = new AttributedString(iter);
+
+        // Without the exception this would get executed.
+        System.out.println("DONE");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/AttributedString/getRunStartLimitTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4151160
+ * @summary Make sure to return correct run start and limit values
+ * when the iterator has been created with begin and end index values.
+ * @modules java.desktop
+ */
+
+import java.awt.font.TextAttribute;
+import java.text.AttributedCharacterIterator;
+import java.text.AttributedString;
+import java.text.Annotation;
+
+public class getRunStartLimitTest {
+
+    public static void main(String[] args) throws Exception {
+
+        String text = "Hello world";
+        AttributedString as = new AttributedString(text);
+
+        // add non-Annotation attributes
+        as.addAttribute(TextAttribute.WEIGHT,
+                        TextAttribute.WEIGHT_LIGHT,
+                        0,
+                        3);
+        as.addAttribute(TextAttribute.WEIGHT,
+                        TextAttribute.WEIGHT_BOLD,
+                        3,
+                        5);
+        as.addAttribute(TextAttribute.WEIGHT,
+                        TextAttribute.WEIGHT_EXTRABOLD,
+                        5,
+                        text.length());
+
+        // add Annotation attributes
+        as.addAttribute(TextAttribute.WIDTH,
+                        new Annotation(TextAttribute.WIDTH_EXTENDED),
+                        0,
+                        3);
+        as.addAttribute(TextAttribute.WIDTH,
+                        new Annotation(TextAttribute.WIDTH_CONDENSED),
+                        3,
+                        4);
+
+        AttributedCharacterIterator aci = as.getIterator(null, 2, 4);
+
+        aci.first();
+        int runStart = aci.getRunStart();
+        if (runStart != 2) {
+            throw new Exception("1st run start is wrong. ("+runStart+" should be 2.)");
+        }
+
+        int runLimit = aci.getRunLimit();
+        if (runLimit != 3) {
+            throw new Exception("1st run limit is wrong. ("+runLimit+" should be 3.)");
+        }
+
+        Object value = aci.getAttribute(TextAttribute.WEIGHT);
+        if (value != TextAttribute.WEIGHT_LIGHT) {
+            throw new Exception("1st run attribute is wrong. ("
+                                +value+" should be "+TextAttribute.WEIGHT_LIGHT+".)");
+        }
+
+        value = aci.getAttribute(TextAttribute.WIDTH);
+        if (value != null) {
+            throw new Exception("1st run annotation is wrong. ("
+                                +value+" should be null.)");
+        }
+
+        aci.setIndex(runLimit);
+        runStart = aci.getRunStart();
+        if (runStart != 3) {
+            throw new Exception("2nd run start is wrong. ("+runStart+" should be 3.)");
+        }
+
+        runLimit = aci.getRunLimit();
+        if (runLimit != 4) {
+            throw new Exception("2nd run limit is wrong. ("+runLimit+" should be 4.)");
+        }
+        value = aci.getAttribute(TextAttribute.WEIGHT);
+        if (value != TextAttribute.WEIGHT_BOLD) {
+            throw new Exception("2nd run attribute is wrong. ("
+                                +value+" should be "+TextAttribute.WEIGHT_BOLD+".)");
+        }
+
+        value = aci.getAttribute(TextAttribute.WIDTH);
+        if (!(value instanceof Annotation)
+            || (((Annotation)value).getValue() !=  TextAttribute.WIDTH_CONDENSED)) {
+            throw new Exception("2nd run annotation is wrong. (" + value + " should be "
+                                + new Annotation(TextAttribute.WIDTH_CONDENSED)+".)");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/BreakIterator/BreakIteratorTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,1438 @@
+/*
+ * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4035266 4052418 4068133 4068137 4068139 4086052 4095322 4097779
+ *      4097920 4098467 4111338 4113835 4117554 4143071 4146175 4152117
+ *      4152416 4153072 4158381 4214367 4217703 4638433
+ * @library /java/text/testlib
+ * @run main/timeout=2000 BreakIteratorTest
+ * @summary test BreakIterator
+ */
+
+/*
+ *
+ *
+ * (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
+ * (C) Copyright IBM Corp. 1996 - 1998 - All Rights Reserved
+ *
+ * Portions copyright (c) 2007 Sun Microsystems, Inc.
+ * All Rights Reserved.
+ *
+ * The original version of this source code and documentation
+ * is copyrighted and owned by Taligent, Inc., a wholly-owned
+ * subsidiary of IBM. These materials are provided under terms
+ * of a License Agreement between Taligent and Sun. This technology
+ * is protected by multiple US and International patents.
+ *
+ * This notice and attribution to Taligent may not be removed.
+ * Taligent is a registered trademark of Taligent, Inc.
+ *
+ * Permission to use, copy, modify, and distribute this software
+ * and its documentation for NON-COMMERCIAL purposes and without
+ * fee is hereby granted provided that this copyright notice
+ * appears in all copies. Please refer to the file "copyright.html"
+ * for further important copyright and licensing information.
+ *
+ * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
+ * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+ * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+ *
+ */
+
+import java.text.BreakIterator;
+import java.text.CharacterIterator;
+import java.text.StringCharacterIterator;
+import java.util.Locale;
+import java.util.Vector;
+import java.util.Enumeration;
+import java.io.*;
+
+public class BreakIteratorTest extends IntlTest
+{
+    private BreakIterator characterBreak;
+    private BreakIterator wordBreak;
+    private BreakIterator lineBreak;
+    private BreakIterator sentenceBreak;
+
+    public static void main(String[] args) throws Exception {
+        new BreakIteratorTest().run(args);
+    }
+
+    public BreakIteratorTest()
+    {
+        characterBreak = BreakIterator.getCharacterInstance();
+        wordBreak = BreakIterator.getWordInstance();
+        lineBreak = BreakIterator.getLineInstance();
+        sentenceBreak = BreakIterator.getSentenceInstance();
+    }
+
+    //=========================================================================
+    // general test subroutines
+    //=========================================================================
+
+    private void generalIteratorTest(BreakIterator bi, Vector expectedResult) {
+        StringBuffer buffer = new StringBuffer();
+        String text;
+        for (int i = 0; i < expectedResult.size(); i++) {
+            text = (String)expectedResult.elementAt(i);
+            buffer.append(text);
+        }
+        text = buffer.toString();
+
+        bi.setText(text);
+
+        Vector nextResults = testFirstAndNext(bi, text);
+        Vector previousResults = testLastAndPrevious(bi, text);
+
+        logln("comparing forward and backward...");
+        int errs = getErrorCount();
+        compareFragmentLists("forward iteration", "backward iteration", nextResults,
+                        previousResults);
+        if (getErrorCount() == errs) {
+            logln("comparing expected and actual...");
+            compareFragmentLists("expected result", "actual result", expectedResult,
+                            nextResults);
+        }
+
+        int[] boundaries = new int[expectedResult.size() + 3];
+        boundaries[0] = BreakIterator.DONE;
+        boundaries[1] = 0;
+        for (int i = 0; i < expectedResult.size(); i++)
+            boundaries[i + 2] = boundaries[i + 1] + ((String)expectedResult.elementAt(i)).
+                            length();
+        boundaries[boundaries.length - 1] = BreakIterator.DONE;
+
+        testFollowing(bi, text, boundaries);
+        testPreceding(bi, text, boundaries);
+        testIsBoundary(bi, text, boundaries);
+
+        doMultipleSelectionTest(bi, text);
+    }
+
+    private Vector testFirstAndNext(BreakIterator bi, String text) {
+        int p = bi.first();
+        int lastP = p;
+        Vector<String> result = new Vector<String>();
+
+        if (p != 0)
+            errln("first() returned " + p + " instead of 0");
+        while (p != BreakIterator.DONE) {
+            p = bi.next();
+            if (p != BreakIterator.DONE) {
+                if (p <= lastP)
+                    errln("next() failed to move forward: next() on position "
+                                    + lastP + " yielded " + p);
+
+                result.addElement(text.substring(lastP, p));
+            }
+            else {
+                if (lastP != text.length())
+                    errln("next() returned DONE prematurely: offset was "
+                                    + lastP + " instead of " + text.length());
+            }
+            lastP = p;
+        }
+        return result;
+    }
+
+    private Vector testLastAndPrevious(BreakIterator bi, String text) {
+        int p = bi.last();
+        int lastP = p;
+        Vector<String> result = new Vector<String>();
+
+        if (p != text.length())
+            errln("last() returned " + p + " instead of " + text.length());
+        while (p != BreakIterator.DONE) {
+            p = bi.previous();
+            if (p != BreakIterator.DONE) {
+                if (p >= lastP)
+                    errln("previous() failed to move backward: previous() on position "
+                                    + lastP + " yielded " + p);
+
+                result.insertElementAt(text.substring(p, lastP), 0);
+            }
+            else {
+                if (lastP != 0)
+                    errln("previous() returned DONE prematurely: offset was "
+                                    + lastP + " instead of 0");
+            }
+            lastP = p;
+        }
+        return result;
+    }
+
+    private void compareFragmentLists(String f1Name, String f2Name, Vector f1, Vector f2) {
+        int p1 = 0;
+        int p2 = 0;
+        String s1;
+        String s2;
+        int t1 = 0;
+        int t2 = 0;
+
+        while (p1 < f1.size() && p2 < f2.size()) {
+            s1 = (String)f1.elementAt(p1);
+            s2 = (String)f2.elementAt(p2);
+            t1 += s1.length();
+            t2 += s2.length();
+
+            if (s1.equals(s2)) {
+                debugLogln("   >" + s1 + "<");
+                ++p1;
+                ++p2;
+            }
+            else {
+                int tempT1 = t1;
+                int tempT2 = t2;
+                int tempP1 = p1;
+                int tempP2 = p2;
+
+                while (tempT1 != tempT2 && tempP1 < f1.size() && tempP2 < f2.size()) {
+                    while (tempT1 < tempT2 && tempP1 < f1.size()) {
+                        tempT1 += ((String)f1.elementAt(tempP1)).length();
+                        ++tempP1;
+                    }
+                    while (tempT2 < tempT1 && tempP2 < f2.size()) {
+                        tempT2 += ((String)f2.elementAt(tempP2)).length();
+                        ++tempP2;
+                    }
+                }
+                logln("*** " + f1Name + " has:");
+                while (p1 <= tempP1 && p1 < f1.size()) {
+                    s1 = (String)f1.elementAt(p1);
+                    t1 += s1.length();
+                    debugLogln(" *** >" + s1 + "<");
+                    ++p1;
+                }
+                logln("***** " + f2Name + " has:");
+                while (p2 <= tempP2 && p2 < f2.size()) {
+                    s2 = (String)f2.elementAt(p2);
+                    t2 += s2.length();
+                    debugLogln(" ***** >" + s2 + "<");
+                    ++p2;
+                }
+                errln("Discrepancy between " + f1Name + " and " + f2Name + "\n---\n" + f1 +"\n---\n" + f2);
+            }
+        }
+    }
+
+    private void testFollowing(BreakIterator bi, String text, int[] boundaries) {
+        logln("testFollowing():");
+        int p = 2;
+        int i = 0;
+        try {
+            for (i = 0; i <= text.length(); i++) {  // change to <= when new BI code goes in
+                if (i == boundaries[p])
+                    ++p;
+
+                int b = bi.following(i);
+                logln("bi.following(" + i + ") -> " + b);
+                if (b != boundaries[p])
+                    errln("Wrong result from following() for " + i + ": expected " + boundaries[p]
+                          + ", got " + b);
+            }
+        } catch (IllegalArgumentException illargExp) {
+            errln("IllegalArgumentException caught from following() for offset: " + i);
+        }
+    }
+
+    private void testPreceding(BreakIterator bi, String text, int[] boundaries) {
+        logln("testPreceding():");
+        int p = 0;
+        int i = 0;
+        try {
+            for (i = 0; i <= text.length(); i++) {  // change to <= when new BI code goes in
+                int b = bi.preceding(i);
+                logln("bi.preceding(" + i + ") -> " + b);
+                if (b != boundaries[p])
+                    errln("Wrong result from preceding() for " + i + ": expected " + boundaries[p]
+                          + ", got " + b);
+
+                if (i == boundaries[p + 1])
+                    ++p;
+            }
+        } catch (IllegalArgumentException illargExp) {
+            errln("IllegalArgumentException caught from preceding() for offset: " + i);
+        }
+    }
+
+    private void testIsBoundary(BreakIterator bi, String text, int[] boundaries) {
+        logln("testIsBoundary():");
+        int p = 1;
+        boolean isB;
+        for (int i = 0; i <= text.length(); i++) {  // change to <= when new BI code goes in
+            isB = bi.isBoundary(i);
+            logln("bi.isBoundary(" + i + ") -> " + isB);
+
+            if (i == boundaries[p]) {
+                if (!isB)
+                    errln("Wrong result from isBoundary() for " + i + ": expected true, got false");
+                ++p;
+            }
+            else {
+                if (isB)
+                    errln("Wrong result from isBoundary() for " + i + ": expected false, got true");
+            }
+        }
+    }
+
+    private void doMultipleSelectionTest(BreakIterator iterator, String testText)
+    {
+        logln("Multiple selection test...");
+        BreakIterator testIterator = (BreakIterator)iterator.clone();
+        int offset = iterator.first();
+        int testOffset;
+        int count = 0;
+
+        do {
+            testOffset = testIterator.first();
+            testOffset = testIterator.next(count);
+            logln("next(" + count + ") -> " + testOffset);
+            if (offset != testOffset)
+                errln("next(n) and next() not returning consistent results: for step " + count + ", next(n) returned " + testOffset + " and next() had " + offset);
+
+            if (offset != BreakIterator.DONE) {
+                count++;
+                offset = iterator.next();
+            }
+        } while (offset != BreakIterator.DONE);
+
+        // now do it backwards...
+        offset = iterator.last();
+        count = 0;
+
+        do {
+            testOffset = testIterator.last();
+            testOffset = testIterator.next(count);
+            logln("next(" + count + ") -> " + testOffset);
+            if (offset != testOffset)
+                errln("next(n) and next() not returning consistent results: for step " + count + ", next(n) returned " + testOffset + " and next() had " + offset);
+
+            if (offset != BreakIterator.DONE) {
+                count--;
+                offset = iterator.previous();
+            }
+        } while (offset != BreakIterator.DONE);
+    }
+
+    private void doBreakInvariantTest(BreakIterator tb, String testChars)
+    {
+        StringBuffer work = new StringBuffer("aaa");
+        int errorCount = 0;
+
+        // a break should always occur after CR (unless followed by LF), LF, PS, and LS
+        String breaks = /*"\r\n\u2029\u2028"*/"\n\u2029\u2028";
+                            // change this back when new BI code is added
+
+        for (int i = 0; i < breaks.length(); i++) {
+            work.setCharAt(1, breaks.charAt(i));
+            for (int j = 0; j < testChars.length(); j++) {
+                work.setCharAt(0, testChars.charAt(j));
+                for (int k = 0; k < testChars.length(); k++) {
+                    char c = testChars.charAt(k);
+
+                    // if a cr is followed by lf, don't do the check (they stay together)
+                    if (work.charAt(1) == '\r' && (c == '\n'))
+                        continue;
+
+                    // CONTROL (Cc) and FORMAT (Cf) Characters are to be ignored
+                    // for breaking purposes as per UTR14
+                    int type1 = Character.getType(work.charAt(1));
+                    int type2 = Character.getType(c);
+                    if (type1 == Character.CONTROL || type1 == Character.FORMAT ||
+                        type2 == Character.CONTROL || type2 == Character.FORMAT) {
+                        continue;
+                    }
+
+                    work.setCharAt(2, c);
+                    tb.setText(work.toString());
+                    boolean seen2 = false;
+                    for (int l = tb.first(); l != BreakIterator.DONE; l = tb.next()) {
+                        if (l == 2)
+                            seen2 = true;
+                    }
+                    if (!seen2) {
+                        errln("No break between U+" + Integer.toHexString((int)(work.charAt(1)))
+                                    + " and U+" + Integer.toHexString((int)(work.charAt(2))));
+                        errorCount++;
+                        if (errorCount >= 75)
+                            return;
+                    }
+                }
+            }
+        }
+    }
+
+    private void doOtherInvariantTest(BreakIterator tb, String testChars)
+    {
+        StringBuffer work = new StringBuffer("a\r\na");
+        int errorCount = 0;
+
+        // a break should never occur between CR and LF
+        for (int i = 0; i < testChars.length(); i++) {
+            work.setCharAt(0, testChars.charAt(i));
+            for (int j = 0; j < testChars.length(); j++) {
+                work.setCharAt(3, testChars.charAt(j));
+                tb.setText(work.toString());
+                for (int k = tb.first(); k != BreakIterator.DONE; k = tb.next())
+                    if (k == 2) {
+                        errln("Break between CR and LF in string U+" + Integer.toHexString(
+                                (int)(work.charAt(0))) + ", U+d U+a U+" + Integer.toHexString(
+                                (int)(work.charAt(3))));
+                        errorCount++;
+                        if (errorCount >= 75)
+                            return;
+                    }
+            }
+        }
+
+        // a break should never occur before a non-spacing mark, unless it's preceded
+        // by a line terminator
+        work.setLength(0);
+        work.append("aaaa");
+        for (int i = 0; i < testChars.length(); i++) {
+            char c = testChars.charAt(i);
+            if (c == '\n' || c == '\r' || c == '\u2029' || c == '\u2028' || c == '\u0003')
+                continue;
+            work.setCharAt(1, c);
+            for (int j = 0; j < testChars.length(); j++) {
+                c = testChars.charAt(j);
+                if (Character.getType(c) != Character.NON_SPACING_MARK && Character.getType(c)
+                        != Character.ENCLOSING_MARK)
+                    continue;
+                work.setCharAt(2, c);
+
+                // CONTROL (Cc) and FORMAT (Cf) Characters are to be ignored
+                // for breaking purposes as per UTR14
+                int type1 = Character.getType(work.charAt(1));
+                int type2 = Character.getType(work.charAt(2));
+                if (type1 == Character.CONTROL || type1 == Character.FORMAT ||
+                    type2 == Character.CONTROL || type2 == Character.FORMAT) {
+                    continue;
+                }
+
+                tb.setText(work.toString());
+                for (int k = tb.first(); k != BreakIterator.DONE; k = tb.next())
+                    if (k == 2) {
+                        errln("Break between U+" + Integer.toHexString((int)(work.charAt(1)))
+                                + " and U+" + Integer.toHexString((int)(work.charAt(2))));
+                        errorCount++;
+                        if (errorCount >= 75)
+                            return;
+                    }
+            }
+        }
+    }
+
+    public void debugLogln(String s) {
+        final String zeros = "0000";
+        String temp;
+        StringBuffer out = new StringBuffer();
+        for (int i = 0; i < s.length(); i++) {
+            char c = s.charAt(i);
+            if (c >= ' ' && c < '\u007f')
+                out.append(c);
+            else {
+                out.append("\\u");
+                temp = Integer.toHexString((int)c);
+                out.append(zeros.substring(0, 4 - temp.length()));
+                out.append(temp);
+            }
+        }
+        logln(out.toString());
+    }
+
+    //=========================================================================
+    // tests
+    //=========================================================================
+
+    public void TestWordBreak() {
+
+        Vector<String> wordSelectionData = new Vector<String>();
+
+        wordSelectionData.addElement("12,34");
+
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("\u00A2"); //cent sign
+        wordSelectionData.addElement("\u00A3"); //pound sign
+        wordSelectionData.addElement("\u00A4"); //currency sign
+        wordSelectionData.addElement("\u00A5"); //yen sign
+        wordSelectionData.addElement("alpha-beta-gamma");
+        wordSelectionData.addElement(".");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("Badges");
+        wordSelectionData.addElement("?");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("BADGES");
+        wordSelectionData.addElement("!");
+        wordSelectionData.addElement("?");
+        wordSelectionData.addElement("!");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("We");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("don't");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("need");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("no");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("STINKING");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("BADGES");
+        wordSelectionData.addElement("!");
+        wordSelectionData.addElement("!");
+        wordSelectionData.addElement("!");
+
+        wordSelectionData.addElement("012.566,5");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("123.3434,900");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("1000,233,456.000");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("1,23.322%");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("123.1222");
+
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("\u0024123,000.20");
+
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("179.01\u0025");
+
+        wordSelectionData.addElement("Hello");
+        wordSelectionData.addElement(",");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("how");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("are");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("you");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("X");
+        wordSelectionData.addElement(" ");
+
+        wordSelectionData.addElement("Now");
+        wordSelectionData.addElement("\r");
+        wordSelectionData.addElement("is");
+        wordSelectionData.addElement("\n");
+        wordSelectionData.addElement("the");
+        wordSelectionData.addElement("\r\n");
+        wordSelectionData.addElement("time");
+        wordSelectionData.addElement("\n");
+        wordSelectionData.addElement("\r");
+        wordSelectionData.addElement("for");
+        wordSelectionData.addElement("\r");
+        wordSelectionData.addElement("\r");
+        wordSelectionData.addElement("all");
+        wordSelectionData.addElement(" ");
+
+        generalIteratorTest(wordBreak, wordSelectionData);
+    }
+
+    public void TestBug4097779() {
+        Vector<String> wordSelectionData = new Vector<String>();
+
+        wordSelectionData.addElement("aa\u0300a");
+        wordSelectionData.addElement(" ");
+
+        generalIteratorTest(wordBreak, wordSelectionData);
+    }
+
+    public void TestBug4098467Words() {
+        Vector<String> wordSelectionData = new Vector<String>();
+
+        // What follows is a string of Korean characters (I found it in the Yellow Pages
+        // ad for the Korean Presbyterian Church of San Francisco, and I hope I transcribed
+        // it correctly), first as precomposed syllables, and then as conjoining jamo.
+        // Both sequences should be semantically identical and break the same way.
+        // precomposed syllables...
+        wordSelectionData.addElement("\uc0c1\ud56d");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("\ud55c\uc778");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("\uc5f0\ud569");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("\uc7a5\ub85c\uad50\ud68c");
+        wordSelectionData.addElement(" ");
+        // conjoining jamo...
+        wordSelectionData.addElement("\u1109\u1161\u11bc\u1112\u1161\u11bc");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("\u1112\u1161\u11ab\u110b\u1175\u11ab");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("\u110b\u1167\u11ab\u1112\u1161\u11b8");
+        wordSelectionData.addElement(" ");
+        wordSelectionData.addElement("\u110c\u1161\u11bc\u1105\u1169\u1100\u116d\u1112\u116c");
+        wordSelectionData.addElement(" ");
+
+        generalIteratorTest(wordBreak, wordSelectionData);
+    }
+
+    public void TestBug4117554Words() {
+        Vector<String> wordSelectionData = new Vector<String>();
+
+        // this is a test for bug #4117554: the ideographic iteration mark (U+3005) should
+        // count as a Kanji character for the purposes of word breaking
+        wordSelectionData.addElement("abc");
+        wordSelectionData.addElement("\u4e01\u4e02\u3005\u4e03\u4e03");
+        wordSelectionData.addElement("abc");
+
+        generalIteratorTest(wordBreak, wordSelectionData);
+    }
+
+    public void TestSentenceBreak() {
+        Vector<String> sentenceSelectionData = new Vector<String>();
+
+        sentenceSelectionData.addElement("This is a simple sample sentence. ");
+        sentenceSelectionData.addElement("(This is it.) ");
+        sentenceSelectionData.addElement("This is a simple sample sentence. ");
+        sentenceSelectionData.addElement("\"This isn\'t it.\" ");
+        sentenceSelectionData.addElement("Hi! ");
+        sentenceSelectionData.addElement("This is a simple sample sentence. ");
+        sentenceSelectionData.addElement("It does not have to make any sense as you can see. ");
+        sentenceSelectionData.addElement("Nel mezzo del cammin di nostra vita, mi ritrovai in una selva oscura. ");
+        sentenceSelectionData.addElement("Che la dritta via aveo smarrita. ");
+        sentenceSelectionData.addElement("He said, that I said, that you said!! ");
+
+        sentenceSelectionData.addElement("Don't rock the boat.\u2029");
+
+        sentenceSelectionData.addElement("Because I am the daddy, that is why. ");
+        sentenceSelectionData.addElement("Not on my time (el timo.)! ");
+
+        sentenceSelectionData.addElement("So what!!\u2029");
+
+        sentenceSelectionData.addElement("\"But now,\" he said, \"I know!\" ");
+        sentenceSelectionData.addElement("Harris thumbed down several, including \"Away We Go\" (which became the huge success Oklahoma!). ");
+        sentenceSelectionData.addElement("One species, B. anthracis, is highly virulent.\n");
+        sentenceSelectionData.addElement("Wolf said about Sounder:\"Beautifully thought-out and directed.\" ");
+        sentenceSelectionData.addElement("Have you ever said, \"This is where \tI shall live\"? ");
+        sentenceSelectionData.addElement("He answered, \"You may not!\" ");
+        sentenceSelectionData.addElement("Another popular saying is: \"How do you do?\". ");
+        sentenceSelectionData.addElement("Yet another popular saying is: \'I\'m fine thanks.\' ");
+        sentenceSelectionData.addElement("What is the proper use of the abbreviation pp.? ");
+        sentenceSelectionData.addElement("Yes, I am definatelly 12\" tall!!");
+
+        generalIteratorTest(sentenceBreak, sentenceSelectionData);
+    }
+
+    public void TestBug4113835() {
+        Vector<String> sentenceSelectionData = new Vector<String>();
+
+        // test for bug #4113835: \n and \r count as spaces, not as paragraph breaks
+        sentenceSelectionData.addElement("Now\ris\nthe\r\ntime\n\rfor\r\rall\u2029");
+
+        generalIteratorTest(sentenceBreak, sentenceSelectionData);
+    }
+
+    public void TestBug4111338() {
+        Vector<String> sentenceSelectionData = new Vector<String>();
+
+        // test for bug #4111338: Don't break sentences at the boundary between CJK
+        // and other letters
+        sentenceSelectionData.addElement("\u5487\u67ff\ue591\u5017\u61b3\u60a1\u9510\u8165:\"JAVA\u821c"
+                + "\u8165\u7fc8\u51ce\u306d,\u2494\u56d8\u4ec0\u60b1\u8560\u51ba"
+                + "\u611d\u57b6\u2510\u5d46\".\u2029");
+        sentenceSelectionData.addElement("\u5487\u67ff\ue591\u5017\u61b3\u60a1\u9510\u8165\u9de8"
+                + "\u97e4JAVA\u821c\u8165\u7fc8\u51ce\u306d\ue30b\u2494\u56d8\u4ec0"
+                + "\u60b1\u8560\u51ba\u611d\u57b6\u2510\u5d46\u97e5\u7751\u2029");
+        sentenceSelectionData.addElement("\u5487\u67ff\ue591\u5017\u61b3\u60a1\u9510\u8165\u9de8\u97e4"
+                + "\u6470\u8790JAVA\u821c\u8165\u7fc8\u51ce\u306d\ue30b\u2494\u56d8"
+                + "\u4ec0\u60b1\u8560\u51ba\u611d\u57b6\u2510\u5d46\u97e5\u7751\u2029");
+        sentenceSelectionData.addElement("He said, \"I can go there.\"\u2029");
+
+        generalIteratorTest(sentenceBreak, sentenceSelectionData);
+    }
+
+    public void TestBug4117554Sentences() {
+        Vector<String> sentenceSelectionData = new Vector<String>();
+
+        // Treat fullwidth variants of .!? the same as their
+        // normal counterparts
+        sentenceSelectionData.addElement("I know I'm right\uff0e ");
+        sentenceSelectionData.addElement("Right\uff1f ");
+        sentenceSelectionData.addElement("Right\uff01 ");
+
+        // Don't break sentences at boundary between CJK and digits
+        sentenceSelectionData.addElement("\u5487\u67ff\ue591\u5017\u61b3\u60a1\u9510\u8165\u9de8"
+                + "\u97e48888\u821c\u8165\u7fc8\u51ce\u306d\ue30b\u2494\u56d8\u4ec0"
+                + "\u60b1\u8560\u51ba\u611d\u57b6\u2510\u5d46\u97e5\u7751\u2029");
+
+        // Break sentence between a sentence terminator and
+        // opening punctuation
+        sentenceSelectionData.addElement("no?");
+        sentenceSelectionData.addElement("(yes)");
+
+        generalIteratorTest(sentenceBreak, sentenceSelectionData);
+    }
+
+    public void TestBug4158381() {
+        Vector<String> sentenceSelectionData = new Vector<String>();
+
+        // Don't break sentence after period if it isn't followed by a space
+        sentenceSelectionData.addElement("Test <code>Flags.Flag</code> class.  ");
+        sentenceSelectionData.addElement("Another test.\u2029");
+
+        // No breaks when there are no terminators around
+        sentenceSelectionData.addElement("<P>Provides a set of "
+                + "&quot;lightweight&quot; (all-java<FONT SIZE=\"-2\"><SUP>TM"
+                + "</SUP></FONT> language) components that, "
+                + "to the maximum degree possible, work the same on all platforms.  ");
+        sentenceSelectionData.addElement("Another test.\u2029");
+
+        generalIteratorTest(sentenceBreak, sentenceSelectionData);
+    }
+
+    public void TestBug4143071() {
+        Vector<String> sentenceSelectionData = new Vector<String>();
+
+        // Make sure sentences that end with digits work right
+        sentenceSelectionData.addElement("Today is the 27th of May, 1998.  ");
+        sentenceSelectionData.addElement("Tomorrow with be 28 May 1998.  ");
+        sentenceSelectionData.addElement("The day after will be the 30th.\u2029");
+
+        generalIteratorTest(sentenceBreak, sentenceSelectionData);
+    }
+
+    public void TestBug4152416() {
+        Vector<String> sentenceSelectionData = new Vector<String>();
+
+        // Make sure sentences ending with a capital letter are treated correctly
+        sentenceSelectionData.addElement("The type of all primitive "
+                + "<code>boolean</code> values accessed in the target VM.  ");
+        sentenceSelectionData.addElement("Calls to xxx will return an "
+                + "implementor of this interface.\u2029");
+
+        generalIteratorTest(sentenceBreak, sentenceSelectionData);
+    }
+
+    public void TestBug4152117() {
+        Vector<String> sentenceSelectionData = new Vector<String>();
+
+        // Make sure sentence breaking is handling punctuation correctly
+        // [COULD NOT REPRODUCE THIS BUG, BUT TEST IS HERE TO MAKE SURE
+        // IT DOESN'T CROP UP]
+        sentenceSelectionData.addElement("Constructs a randomly generated "
+                + "BigInteger, uniformly distributed over the range <tt>0</tt> "
+                + "to <tt>(2<sup>numBits</sup> - 1)</tt>, inclusive.  ");
+        sentenceSelectionData.addElement("The uniformity of the distribution "
+                + "assumes that a fair source of random bits is provided in "
+                + "<tt>rnd</tt>.  ");
+        sentenceSelectionData.addElement("Note that this constructor always "
+                + "constructs a non-negative BigInteger.\u2029");
+
+        generalIteratorTest(sentenceBreak, sentenceSelectionData);
+    }
+
+    public void TestLineBreak() {
+        Vector<String> lineSelectionData = new Vector<String>();
+
+        lineSelectionData.addElement("Multi-");
+        lineSelectionData.addElement("Level ");
+        lineSelectionData.addElement("example ");
+        lineSelectionData.addElement("of ");
+        lineSelectionData.addElement("a ");
+        lineSelectionData.addElement("semi-");
+        lineSelectionData.addElement("idiotic ");
+        lineSelectionData.addElement("non-");
+        lineSelectionData.addElement("sensical ");
+        lineSelectionData.addElement("(non-");
+        lineSelectionData.addElement("important) ");
+        lineSelectionData.addElement("sentence. ");
+
+        lineSelectionData.addElement("Hi  ");
+        lineSelectionData.addElement("Hello ");
+        lineSelectionData.addElement("How\n");
+        lineSelectionData.addElement("are\r");
+        lineSelectionData.addElement("you\u2028");
+        lineSelectionData.addElement("fine.\t");
+        lineSelectionData.addElement("good.  ");
+
+        lineSelectionData.addElement("Now\r");
+        lineSelectionData.addElement("is\n");
+        lineSelectionData.addElement("the\r\n");
+        lineSelectionData.addElement("time\n");
+        lineSelectionData.addElement("\r");
+        lineSelectionData.addElement("for\r");
+        lineSelectionData.addElement("\r");
+        lineSelectionData.addElement("all");
+
+        generalIteratorTest(lineBreak, lineSelectionData);
+    }
+
+    public void TestBug4068133() {
+        Vector<String> lineSelectionData = new Vector<String>();
+
+        lineSelectionData.addElement("\u96f6");
+        lineSelectionData.addElement("\u4e00\u3002");
+        lineSelectionData.addElement("\u4e8c\u3001");
+        lineSelectionData.addElement("\u4e09\u3002\u3001");
+        lineSelectionData.addElement("\u56db\u3001\u3002\u3001");
+        lineSelectionData.addElement("\u4e94,");
+        lineSelectionData.addElement("\u516d.");
+        lineSelectionData.addElement("\u4e03.\u3001,\u3002");
+        lineSelectionData.addElement("\u516b");
+
+        generalIteratorTest(lineBreak, lineSelectionData);
+    }
+
+    public void TestBug4086052() {
+        Vector<String> lineSelectionData = new Vector<String>();
+
+        lineSelectionData.addElement("foo\u00a0bar ");
+//        lineSelectionData.addElement("foo\ufeffbar");
+
+        generalIteratorTest(lineBreak, lineSelectionData);
+    }
+
+    public void TestBug4097920() {
+        Vector<String> lineSelectionData = new Vector<String>();
+
+        lineSelectionData.addElement("dog,");
+        lineSelectionData.addElement("cat,");
+        lineSelectionData.addElement("mouse ");
+        lineSelectionData.addElement("(one)");
+        lineSelectionData.addElement("(two)\n");
+
+        generalIteratorTest(lineBreak, lineSelectionData);
+    }
+    /*
+    public void TestBug4035266() {
+        Vector<String> lineSelectionData = new Vector<String>();
+
+        lineSelectionData.addElement("The ");
+        lineSelectionData.addElement("balance ");
+        lineSelectionData.addElement("is ");
+        lineSelectionData.addElement("$-23,456.78, ");
+        lineSelectionData.addElement("not ");
+        lineSelectionData.addElement("-$32,456.78!\n");
+
+        generalIteratorTest(lineBreak, lineSelectionData);
+    }
+    */
+    public void TestBug4098467Lines() {
+        Vector<String> lineSelectionData = new Vector<String>();
+
+        // What follows is a string of Korean characters (I found it in the Yellow Pages
+        // ad for the Korean Presbyterian Church of San Francisco, and I hope I transcribed
+        // it correctly), first as precomposed syllables, and then as conjoining jamo.
+        // Both sequences should be semantically identical and break the same way.
+        // precomposed syllables...
+        lineSelectionData.addElement("\uc0c1");
+        lineSelectionData.addElement("\ud56d ");
+        lineSelectionData.addElement("\ud55c");
+        lineSelectionData.addElement("\uc778 ");
+        lineSelectionData.addElement("\uc5f0");
+        lineSelectionData.addElement("\ud569 ");
+        lineSelectionData.addElement("\uc7a5");
+        lineSelectionData.addElement("\ub85c");
+        lineSelectionData.addElement("\uad50");
+        lineSelectionData.addElement("\ud68c ");
+        // conjoining jamo...
+        lineSelectionData.addElement("\u1109\u1161\u11bc\u1112\u1161\u11bc ");
+        lineSelectionData.addElement("\u1112\u1161\u11ab\u110b\u1175\u11ab ");
+        lineSelectionData.addElement("\u110b\u1167\u11ab\u1112\u1161\u11b8 ");
+        lineSelectionData.addElement("\u110c\u1161\u11bc\u1105\u1169\u1100\u116d\u1112\u116c");
+
+        if (Locale.getDefault().getLanguage().equals("th")) {
+            logln("This test is skipped in th locale.");
+            return;
+        }
+
+        generalIteratorTest(lineBreak, lineSelectionData);
+    }
+
+    public void TestBug4117554Lines() {
+        Vector<String> lineSelectionData = new Vector<String>();
+
+        // Fullwidth .!? should be treated as postJwrd
+        lineSelectionData.addElement("\u4e01\uff0e");
+        lineSelectionData.addElement("\u4e02\uff01");
+        lineSelectionData.addElement("\u4e03\uff1f");
+
+        generalIteratorTest(lineBreak, lineSelectionData);
+    }
+
+    public void TestBug4217703() {
+        if (Locale.getDefault().getLanguage().equals("th")) {
+            logln("This test is skipped in th locale.");
+            return;
+        }
+
+        Vector<String> lineSelectionData = new Vector<String>();
+
+        // There shouldn't be a line break between sentence-ending punctuation
+        // and a closing quote
+        lineSelectionData.addElement("He ");
+        lineSelectionData.addElement("said ");
+        lineSelectionData.addElement("\"Go!\"  ");
+        lineSelectionData.addElement("I ");
+        lineSelectionData.addElement("went.  ");
+
+        lineSelectionData.addElement("Hashtable$Enumeration ");
+        lineSelectionData.addElement("getText().");
+        lineSelectionData.addElement("getIndex()");
+
+        generalIteratorTest(lineBreak, lineSelectionData);
+    }
+
+    private static final String graveS = "S\u0300";
+    private static final String acuteBelowI = "i\u0317";
+    private static final String acuteE = "e\u0301";
+    private static final String circumflexA = "a\u0302";
+    private static final String tildeE = "e\u0303";
+
+    public void TestCharacterBreak() {
+        Vector<String> characterSelectionData = new Vector<String>();
+
+        characterSelectionData.addElement(graveS);
+        characterSelectionData.addElement(acuteBelowI);
+        characterSelectionData.addElement("m");
+        characterSelectionData.addElement("p");
+        characterSelectionData.addElement("l");
+        characterSelectionData.addElement(acuteE);
+        characterSelectionData.addElement(" ");
+        characterSelectionData.addElement("s");
+        characterSelectionData.addElement(circumflexA);
+        characterSelectionData.addElement("m");
+        characterSelectionData.addElement("p");
+        characterSelectionData.addElement("l");
+        characterSelectionData.addElement(tildeE);
+        characterSelectionData.addElement(".");
+        characterSelectionData.addElement("w");
+        characterSelectionData.addElement(circumflexA);
+        characterSelectionData.addElement("w");
+        characterSelectionData.addElement("a");
+        characterSelectionData.addElement("f");
+        characterSelectionData.addElement("q");
+        characterSelectionData.addElement("\n");
+        characterSelectionData.addElement("\r");
+        characterSelectionData.addElement("\r\n");
+        characterSelectionData.addElement("\n");
+
+        generalIteratorTest(characterBreak, characterSelectionData);
+    }
+
+    public void TestBug4098467Characters() {
+        Vector<String> characterSelectionData = new Vector<String>();
+
+        // What follows is a string of Korean characters (I found it in the Yellow Pages
+        // ad for the Korean Presbyterian Church of San Francisco, and I hope I transcribed
+        // it correctly), first as precomposed syllables, and then as conjoining jamo.
+        // Both sequences should be semantically identical and break the same way.
+        // precomposed syllables...
+        characterSelectionData.addElement("\uc0c1");
+        characterSelectionData.addElement("\ud56d");
+        characterSelectionData.addElement(" ");
+        characterSelectionData.addElement("\ud55c");
+        characterSelectionData.addElement("\uc778");
+        characterSelectionData.addElement(" ");
+        characterSelectionData.addElement("\uc5f0");
+        characterSelectionData.addElement("\ud569");
+        characterSelectionData.addElement(" ");
+        characterSelectionData.addElement("\uc7a5");
+        characterSelectionData.addElement("\ub85c");
+        characterSelectionData.addElement("\uad50");
+        characterSelectionData.addElement("\ud68c");
+        characterSelectionData.addElement(" ");
+        // conjoining jamo...
+        characterSelectionData.addElement("\u1109\u1161\u11bc");
+        characterSelectionData.addElement("\u1112\u1161\u11bc");
+        characterSelectionData.addElement(" ");
+        characterSelectionData.addElement("\u1112\u1161\u11ab");
+        characterSelectionData.addElement("\u110b\u1175\u11ab");
+        characterSelectionData.addElement(" ");
+        characterSelectionData.addElement("\u110b\u1167\u11ab");
+        characterSelectionData.addElement("\u1112\u1161\u11b8");
+        characterSelectionData.addElement(" ");
+        characterSelectionData.addElement("\u110c\u1161\u11bc");
+        characterSelectionData.addElement("\u1105\u1169");
+        characterSelectionData.addElement("\u1100\u116d");
+        characterSelectionData.addElement("\u1112\u116c");
+
+        generalIteratorTest(characterBreak, characterSelectionData);
+    }
+
+    public void TestBug4153072() {
+        BreakIterator iter = BreakIterator.getWordInstance();
+        String str = "...Hello, World!...";
+        int begin = 3;
+        int end = str.length() - 3;
+        boolean gotException = false;
+        boolean dummy;
+
+        iter.setText(new StringCharacterIterator(str, begin, end, begin));
+        for (int index = -1; index < begin + 1; ++index) {
+            try {
+                dummy = iter.isBoundary(index);
+                if (index < begin)
+                    errln("Didn't get exception with offset = " + index +
+                                    " and begin index = " + begin);
+            }
+            catch (IllegalArgumentException e) {
+                if (index >= begin)
+                    errln("Got exception with offset = " + index +
+                                    " and begin index = " + begin);
+            }
+        }
+    }
+
+    public void TestBug4146175Sentences() {
+        Vector<String> sentenceSelectionData = new Vector<String>();
+
+        // break between periods and opening punctuation even when there's no
+        // intervening space
+        sentenceSelectionData.addElement("end.");
+        sentenceSelectionData.addElement("(This is\u2029");
+
+        // treat the fullwidth period as an unambiguous sentence terminator
+        sentenceSelectionData.addElement("\u7d42\u308f\u308a\uff0e");
+        sentenceSelectionData.addElement("\u300c\u3053\u308c\u306f");
+
+        generalIteratorTest(sentenceBreak, sentenceSelectionData);
+    }
+
+    public void TestBug4146175Lines() {
+        if (Locale.getDefault().getLanguage().equals("th")) {
+            logln("This test is skipped in th locale.");
+            return;
+        }
+
+        Vector<String> lineSelectionData = new Vector<String>();
+
+        // the fullwidth comma should stick to the preceding Japanese character
+        lineSelectionData.addElement("\u7d42\uff0c");
+        lineSelectionData.addElement("\u308f");
+
+        generalIteratorTest(lineBreak, lineSelectionData);
+    }
+
+    public void TestBug4214367() {
+        if (Locale.getDefault().getLanguage().equals("th")) {
+            logln("This test is skipped in th locale.");
+            return;
+        }
+
+        Vector<String> wordSelectionData = new Vector<String>();
+
+        // the hiragana and katakana iteration marks and the long vowel mark
+        // are not being treated correctly by the word-break iterator
+        wordSelectionData.addElement("\u3042\u3044\u309d\u3042\u309e\u3042\u30fc\u3042");
+        wordSelectionData.addElement("\u30a2\u30a4\u30fd\u30a2\u30fe\u30a2\u30fc\u30a2");
+
+        generalIteratorTest(wordBreak, wordSelectionData);
+    }
+
+    private static final String cannedTestChars // characters fo the class Cc are ignorable for breaking
+        = /*"\u0000\u0001\u0002\u0003\u0004*/" !\"#$%&()+-01234<=>ABCDE[]^_`abcde{}|\u00a0\u00a2"
+        + "\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00ab\u00ad\u00ae\u00af\u00b0\u00b2\u00b3"
+        + "\u00b4\u00b9\u00bb\u00bc\u00bd\u02b0\u02b1\u02b2\u02b3\u02b4\u0300\u0301\u0302\u0303"
+        + "\u0304\u05d0\u05d1\u05d2\u05d3\u05d4\u0903\u093e\u093f\u0940\u0949\u0f3a\u0f3b\u2000"
+        + "\u2001\u2002\u200c\u200d\u200e\u200f\u2010\u2011\u2012\u2028\u2029\u202a\u203e\u203f"
+        + "\u2040\u20dd\u20de\u20df\u20e0\u2160\u2161\u2162\u2163\u2164";
+
+    public void TestSentenceInvariants()
+    {
+        BreakIterator e = BreakIterator.getSentenceInstance();
+        doOtherInvariantTest(e, cannedTestChars + ".,\u3001\u3002\u3041\u3042\u3043\ufeff");
+    }
+
+    public void TestWordInvariants()
+    {
+        if (Locale.getDefault().getLanguage().equals("th")) {
+            logln("This test is skipped in th locale.");
+            return;
+        }
+
+        BreakIterator e = BreakIterator.getWordInstance();
+        doBreakInvariantTest(e, cannedTestChars + "\',.\u3041\u3042\u3043\u309b\u309c\u30a1\u30a2"
+            + "\u30a3\u4e00\u4e01\u4e02");
+        doOtherInvariantTest(e, cannedTestChars + "\',.\u3041\u3042\u3043\u309b\u309c\u30a1\u30a2"
+            + "\u30a3\u4e00\u4e01\u4e02");
+    }
+
+    public void TestLineInvariants()
+    {
+        if (Locale.getDefault().getLanguage().equals("th")) {
+            logln("This test is skipped in th locale.");
+            return;
+        }
+
+        BreakIterator e = BreakIterator.getLineInstance();
+        String testChars = cannedTestChars + ".,;:\u3001\u3002\u3041\u3042\u3043\u3044\u3045"
+            + "\u30a3\u4e00\u4e01\u4e02";
+        doBreakInvariantTest(e, testChars);
+        doOtherInvariantTest(e, testChars);
+
+        int errorCount = 0;
+
+        // in addition to the other invariants, a line-break iterator should make sure that:
+        // it doesn't break around the non-breaking characters
+        String noBreak = "\u00a0\u2007\u2011\ufeff";
+        StringBuffer work = new StringBuffer("aaa");
+        for (int i = 0; i < testChars.length(); i++) {
+            char c = testChars.charAt(i);
+            if (c == '\r' || c == '\n' || c == '\u2029' || c == '\u2028' || c == '\u0003')
+                continue;
+            work.setCharAt(0, c);
+            for (int j = 0; j < noBreak.length(); j++) {
+                work.setCharAt(1, noBreak.charAt(j));
+                for (int k = 0; k < testChars.length(); k++) {
+                    work.setCharAt(2, testChars.charAt(k));
+                    // CONTROL (Cc) and FORMAT (Cf) Characters are to be ignored
+                    // for breaking purposes as per UTR14
+                    int type1 = Character.getType(work.charAt(1));
+                    int type2 = Character.getType(work.charAt(2));
+                    if (type1 == Character.CONTROL || type1 == Character.FORMAT ||
+                        type2 == Character.CONTROL || type2 == Character.FORMAT) {
+                        continue;
+                    }
+                    e.setText(work.toString());
+                    for (int l = e.first(); l != BreakIterator.DONE; l = e.next()) {
+                        if (l == 1 || l == 2) {
+                            //errln("Got break between U+" + Integer.toHexString((int)
+                            //        (work.charAt(l - 1))) + " and U+" + Integer.toHexString(
+                            //        (int)(work.charAt(l))) + "\ntype1 = " + type1 + "\ntype2 = " + type2);
+                            // as per UTR14 spaces followed by a GLUE character should allow
+                            // line breaking
+                            if (work.charAt(l-1) == '\u0020' && (work.charAt(l) == '\u00a0' ||
+                                                                 work.charAt(l) == '\u0f0c' ||
+                                                                 work.charAt(l) == '\u2007' ||
+                                                                 work.charAt(l) == '\u2011' ||
+                                                                 work.charAt(l) == '\u202f' ||
+                                                                 work.charAt(l) == '\ufeff')) {
+                                continue;
+                            }
+                            errln("Got break between U+" + Integer.toHexString((int)
+                                    (work.charAt(l - 1))) + " and U+" + Integer.toHexString(
+                                    (int)(work.charAt(l))));
+                            errorCount++;
+                            if (errorCount >= 75)
+                                return;
+                        }
+                    }
+                }
+            }
+        }
+
+        // The following test has so many exceptions that it would be better to write a new set of data
+        // that tested exactly what should be tested
+        // Until that point it will be commented out
+        /*
+
+        // it does break after dashes (unless they're followed by a digit, a non-spacing mark,
+        // a currency symbol, a space, a format-control character, a regular control character,
+        // a line or paragraph separator, or another dash)
+        String dashes = "-\u00ad\u2010\u2012\u2013\u2014";
+        for (int i = 0; i < testChars.length(); i++) {
+            work.setCharAt(0, testChars.charAt(i));
+            for (int j = 0; j < dashes.length(); j++) {
+                work.setCharAt(1, dashes.charAt(j));
+                for (int k = 0; k < testChars.length(); k++) {
+                    char c = testChars.charAt(k);
+                    if (Character.getType(c) == Character.DECIMAL_DIGIT_NUMBER ||
+                        Character.getType(c) == Character.OTHER_NUMBER ||
+                        Character.getType(c) == Character.NON_SPACING_MARK ||
+                        Character.getType(c) == Character.ENCLOSING_MARK ||
+                        Character.getType(c) == Character.CURRENCY_SYMBOL ||
+                        Character.getType(c) == Character.DASH_PUNCTUATION ||
+                        Character.getType(c) == Character.SPACE_SEPARATOR ||
+                        Character.getType(c) == Character.FORMAT ||
+                        Character.getType(c) == Character.CONTROL ||
+                        Character.getType(c) == Character.END_PUNCTUATION ||
+                        Character.getType(c) == Character.FINAL_QUOTE_PUNCTUATION ||
+                        Character.getType(c) == Character.OTHER_PUNCTUATION ||
+                        c == '\'' || c == '\"' ||
+                        // category EX as per UTR14
+                        c == '!' || c == '?' || c == '\ufe56' || c == '\ufe57' || c == '\uff01' || c == '\uff1f' ||
+                        c == '\n' || c == '\r' || c == '\u2028' || c == '\u2029' ||
+                        c == '\u0003' || c == '\u2007' || c == '\u2011' ||
+                        c == '\ufeff')
+                        continue;
+                    work.setCharAt(2, c);
+                    e.setText(work.toString());
+                    boolean saw2 = false;
+                    for (int l = e.first(); l != BreakIterator.DONE; l = e.next())
+                        if (l == 2)
+                            saw2 = true;
+                    if (!saw2) {
+                        errln("Didn't get break between U+" + Integer.toHexString((int)
+                                    (work.charAt(1))) + " and U+" + Integer.toHexString(
+                                    (int)(work.charAt(2))));
+                        errorCount++;
+                        if (errorCount >= 75)
+                            return;
+                    }
+                }
+            }
+        }
+        */
+    }
+
+    public void TestCharacterInvariants()
+    {
+        BreakIterator e = BreakIterator.getCharacterInstance();
+        doBreakInvariantTest(e, cannedTestChars + "\u1100\u1101\u1102\u1160\u1161\u1162\u11a8"
+            + "\u11a9\u11aa");
+        doOtherInvariantTest(e, cannedTestChars + "\u1100\u1101\u1102\u1160\u1161\u1162\u11a8"
+            + "\u11a9\u11aa");
+    }
+
+    public void TestEmptyString()
+    {
+        String text = "";
+        Vector<String> x = new Vector<String>();
+        x.addElement(text);
+
+        generalIteratorTest(lineBreak, x);
+    }
+
+    public void TestGetAvailableLocales()
+    {
+        Locale[] locList = BreakIterator.getAvailableLocales();
+
+        if (locList.length == 0)
+            errln("getAvailableLocales() returned an empty list!");
+        // I have no idea how to test this function...
+    }
+
+
+    /**
+     * Bug 4095322
+     */
+    public void TestJapaneseLineBreak()
+    {
+        StringBuffer testString = new StringBuffer("\u4e00x\u4e8c");
+        // Breaking on <Kanji>$<Kanji> is inconsistent
+
+        /* Characters in precedingChars and followingChars have been updated
+         * from Unicode 2.0.14-based to 3.0.0-based when 4638433 was fixed.
+         * In concrete terms,
+         *   0x301F : Its category was changed from Ps to Pe since Unicode 2.1.
+         *   0x169B & 0x169C : added since Unicode 3.0.0.
+         */
+        String precedingChars =
+            /* Puctuation, Open */
+          "([{\u201a\u201e\u2045\u207d\u208d\u2329\u3008\u300a\u300c\u300e\u3010\u3014\u3016\u3018\u301a\u301d\ufe35\ufe37\ufe39\ufe3b\ufe3d\ufe3f\ufe41\ufe43\ufe59\ufe5b\ufe5d\uff08\uff3b\uff5b\uff62\u169b"
+            /* Punctuation, Initial quote */
+          + "\u00ab\u2018\u201b\u201c\u201f\u2039"
+            /* Symbol, Currency */
+          + "\u00a5\u00a3\u00a4\u20a0";
+
+        String followingChars =
+            /* Puctuation, Close */
+          ")]}\u2046\u207e\u208e\u232a\u3009\u300b\u300d\u300f\u3011\u3015\u3017\u3019\u301b\u301e\u301f\ufd3e\ufe36\ufe38\ufe3a\ufe3c\ufe3e\ufe40\ufe42\ufe44\ufe5a\ufe5c\ufe5e\uff09\uff3d\uff5d\uff63\u169c"
+            /* Punctuation, Final quote */
+          + "\u00bb\u2019\u201d\u203a"
+            /* Punctuation, Other */
+          + "!%,.:;\u3001\u3002\u2030\u2031\u2032\u2033\u2034"
+            /* Punctuation, Dash */
+          + "\u2103\u2109"
+            /* Symbol, Currency */
+          + "\u00a2"
+            /* Letter, Modifier */
+          + "\u3005\u309d\u309e"
+            /* Letter, Other */
+          + "\u3063\u3083\u3085\u3087\u30c3\u30e3\u30e5\u30e7\u30fc\u30fd\u30fe"
+           /* Mark, Non-Spacing */
+          + "\u0300\u0301\u0302"
+            /* Symbol, Modifier */
+          + "\u309b\u309c"
+            /* Symbol, Other */
+          + "\u00b0";
+
+        BreakIterator iter = BreakIterator.getLineInstance(Locale.JAPAN);
+
+        for (int i = 0; i < precedingChars.length(); i++) {
+            testString.setCharAt(1, precedingChars.charAt(i));
+            iter.setText(testString.toString());
+            int j = iter.first();
+            if (j != 0) {
+                errln("ja line break failure: failed to start at 0 and bounced at " + j);
+            }
+            j = iter.next();
+            if (j != 1) {
+                errln("ja line break failure: failed to stop before '"
+                        + precedingChars.charAt(i) + "' (\\u"
+                        + Integer.toString(precedingChars.charAt(i), 16)
+                        + ") at 1 and bounded at " + j);
+            }
+            j = iter.next();
+            if (j != 3) {
+                errln("ja line break failure: failed to skip position after '"
+                        + precedingChars.charAt(i) + "' (\\u"
+                        + Integer.toString(precedingChars.charAt(i), 16)
+                        + ") at 3 and bounded at " + j);
+            }
+        }
+
+        for (int i = 0; i < followingChars.length(); i++) {
+            testString.setCharAt(1, followingChars.charAt(i));
+            iter.setText(testString.toString());
+            int j = iter.first();
+            if (j != 0) {
+                errln("ja line break failure: failed to start at 0 and bounded at " + j);
+            }
+            j = iter.next();
+            if (j != 2) {
+                errln("ja line break failure: failed to skip position before '"
+                        + followingChars.charAt(i) + "' (\\u"
+                        + Integer.toString(followingChars.charAt(i), 16)
+                        + ") at 2 and bounded at " + j);
+            }
+            j = iter.next();
+            if (j != 3) {
+                errln("ja line break failure: failed to stop after '"
+                        + followingChars.charAt(i) + "' (\\u"
+                        + Integer.toString(followingChars.charAt(i), 16)
+                        + ") at 3 and bounded at " + j);
+            }
+        }
+    }
+
+    /**
+     * Bug 4638433
+     */
+    public void TestLineBreakBasedOnUnicode3_0_0()
+    {
+        BreakIterator iter;
+        int i;
+
+        /* Latin Extend-B characters
+         * 0x0218-0x0233 which have been added since Unicode 3.0.0.
+         */
+        iter = BreakIterator.getWordInstance(Locale.US);
+        iter.setText("\u0216\u0217\u0218\u0219\u021A");
+        i = iter.first();
+        i = iter.next();
+        if (i != 5) {
+            errln("Word break failure: failed to stop at 5 and bounded at " + i);
+        }
+
+
+        iter = BreakIterator.getLineInstance(Locale.US);
+
+        /* <Three(Nd)><Two(Nd)><Low Double Prime Quotation Mark(Pe)><One(Nd)>
+         * \u301f has changed its category from Ps to Pe since Unicode 2.1.
+         */
+        iter.setText("32\u301f1");
+        i = iter.first();
+        i = iter.next();
+        if (i != 3) {
+            errln("Line break failure: failed to skip before \\u301F(Pe) at 3 and bounded at " + i);
+        }
+
+        /* Mongolian <Letter A(Lo)><Todo Soft Hyphen(Pd)><Letter E(Lo)>
+         * which have been added since Unicode 3.0.0.
+         */
+        iter.setText("\u1820\u1806\u1821");
+        i = iter.first();
+        i = iter.next();
+        if (i != 2) {
+            errln("Mongolian line break failure: failed to skip position before \\u1806(Pd) at 2 and bounded at " + i);
+        }
+
+        /* Khmer <ZERO(Nd)><Currency Symbol(Sc)><ONE(Nd)> which have
+         * been added since Unicode 3.0.0.
+         */
+        iter.setText("\u17E0\u17DB\u17E1");
+        i = iter.first();
+        i = iter.next();
+        if (i != 1) {
+            errln("Khmer line break failure: failed to stop before \\u17DB(Sc) at 1 and bounded at " + i);
+        }
+        i = iter.next();
+        if (i != 3) {
+            errln("Khmer line break failure: failed to skip position after \\u17DB(Sc) at 3 and bounded at " + i);
+        }
+
+        /* Ogham <Letter UR(Lo)><Space Mark(Zs)><Letter OR(Lo)> which have
+         * been added since Unicode 3.0.0.
+         */
+        iter.setText("\u1692\u1680\u1696");
+        i = iter.first();
+        i = iter.next();
+        if (i != 2) {
+            errln("Ogham line break failure: failed to skip postion before \\u1680(Zs) at 2 and bounded at " + i);
+        }
+
+
+        // Confirm changes in BreakIteratorRules_th.java have been reflected.
+        iter = BreakIterator.getLineInstance(new Locale("th", ""));
+
+        /* Thai <Seven(Nd)>
+         *      <Left Double Quotation Mark(Pi)>
+         *      <Five(Nd)>
+         *      <Right Double Quotation Mark(Pf)>
+         *      <Three(Nd)>
+         */
+        iter.setText("\u0E57\u201C\u0E55\u201D\u0E53");
+        i = iter.first();
+        i = iter.next();
+        if (i != 1) {
+            errln("Thai line break failure: failed to stop before \\u201C(Pi) at 1 and bounded at " + i);
+        }
+        i = iter.next();
+        if (i != 4) {
+            errln("Thai line break failure: failed to stop after \\u201D(Pf) at 4 and bounded at " + i);
+        }
+    }
+
+    /**
+     * Bug 4068137
+     */
+    public void TestEndBehavior()
+    {
+        String testString = "boo.";
+        BreakIterator wb = BreakIterator.getWordInstance();
+        wb.setText(testString);
+
+        if (wb.first() != 0)
+            errln("Didn't get break at beginning of string.");
+        if (wb.next() != 3)
+            errln("Didn't get break before period in \"boo.\"");
+        if (wb.current() != 4 && wb.next() != 4)
+            errln("Didn't get break at end of string.");
+    }
+
+    // [serialization test has been removed pursuant to bug #4152965]
+
+    /**
+     * Bug 4450804
+     */
+    public void TestLineBreakContractions() {
+        Vector<String> expected = new Vector<String>();
+
+        expected.add("These ");
+        expected.add("are ");
+        expected.add("'foobles'. ");
+        expected.add("Don't ");
+        expected.add("you ");
+        expected.add("like ");
+        expected.add("them?");
+        generalIteratorTest(lineBreak, expected);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/BreakIterator/Bug4533872.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,261 @@
+/*
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 4533872 4640853
+ * @library /java/text/testlib
+ * @summary Unit tests for supplementary character support (JSR-204) and Unicode 4.0 support
+ */
+
+import java.text.BreakIterator;
+import java.util.Locale;
+
+public class Bug4533872 extends IntlTest {
+
+    public static void main(String[] args) throws Exception {
+        new Bug4533872().run(args);
+    }
+
+    static final String[] given = {
+      /* Lu Nd    Lu     Ll    */
+        "XYZ12345 ABCDE  abcde",
+      /* Nd Lo          Nd  Lu Po    Lu   Ll    */
+        "123\uD800\uDC00345 ABC\uFF61XYZ  abc",
+      /* Nd Lo          Nd  Lu Po          Lu   Ll    */
+        "123\uD800\uDC00345 ABC\uD800\uDD00XYZ  abc",
+      /* Lu Ll Cs    Ll Cs    Lu Lo          Lu  */
+        "ABCabc\uDC00xyz\uD800ABC\uD800\uDC00XYZ",
+    };
+
+    // Golden data for TestNext(), TestBoundar() and TestPrintEach*ward()
+    static final String[][] expected = {
+        {"XYZ12345", " ", "ABCDE", "  ", "abcde"},
+        {"123\uD800\uDC00345", " ", "ABC", "\uFF61", "XYZ", "  ", "abc"},
+        {"123\uD800\uDC00345", " ", "ABC", "\uD800\uDD00", "XYZ", "  ", "abc"},
+        {"ABCabc", "\uDC00", "xyz", "\uD800", "ABC\uD800\uDC00XYZ"},
+    };
+
+    BreakIterator iter;
+    int start, end, current;
+
+    /*
+     * Test for next(int n)
+     */
+    void TestNext() {
+        iter = BreakIterator.getWordInstance(Locale.US);
+
+        for (int i = 0; i < given.length; i++) {
+            iter.setText(given[i]);
+            start = iter.first();
+            int j = expected[i].length - 1;
+            start = iter.next(j);
+            end = iter.next();
+
+            if (!expected[i][j].equals(given[i].substring(start, end))) {
+                errln("Word break failure: printEachForward() expected:<" +
+                      expected[i][j] + ">, got:<" +
+                      given[i].substring(start, end) +
+                      "> start=" + start + "  end=" + end);
+            }
+        }
+    }
+
+    /*
+     * Test for isBoundary(int n)
+     */
+    void TestIsBoundary() {
+        iter = BreakIterator.getWordInstance(Locale.US);
+
+        for (int i = 0; i < given.length; i++) {
+            iter.setText(given[i]);
+
+            start = iter.first();
+            end = iter.next();
+
+            while (end < given[i].length()) {
+                if (!iter.isBoundary(end)) {
+                    errln("Word break failure: isBoundary() This should be a boundary. Index=" +
+                          end + " for " + given[i]);
+                }
+                end = iter.next();
+            }
+        }
+    }
+
+
+    /*
+     * The followig test cases were made based on examples in BreakIterator's
+     * API Doc.
+     */
+
+    /*
+     * Test mainly for next() and current()
+     */
+    void TestPrintEachForward() {
+        iter = BreakIterator.getWordInstance(Locale.US);
+
+        for (int i = 0; i < given.length; i++) {
+            iter.setText(given[i]);
+            start = iter.first();
+
+            // Check current()'s return value - should be same as first()'s.
+            current = iter.current();
+            if (start != current) {
+                errln("Word break failure: printEachForward() Unexpected current value: current()=" +
+                      current + ", expected(=first())=" + start);
+            }
+
+            int j = 0;
+            for (end = iter.next();
+                 end != BreakIterator.DONE;
+                 start = end, end = iter.next(), j++) {
+
+                // Check current()'s return value - should be same as next()'s.
+                current = iter.current();
+                if (end != current) {
+                    errln("Word break failure: printEachForward() Unexpected current value: current()=" +
+                          current + ", expected(=next())=" + end);
+                }
+
+                if (!expected[i][j].equals(given[i].substring(start, end))) {
+                    errln("Word break failure: printEachForward() expected:<" +
+                          expected[i][j] + ">, got:<" +
+                          given[i].substring(start, end) +
+                          "> start=" + start + "  end=" + end);
+                }
+            }
+        }
+    }
+
+    /*
+     * Test mainly for previous() and current()
+     */
+    void TestPrintEachBackward() {
+        iter = BreakIterator.getWordInstance(Locale.US);
+
+        for (int i = 0; i < given.length; i++) {
+            iter.setText(given[i]);
+            end = iter.last();
+
+            // Check current()'s return value - should be same as last()'s.
+            current = iter.current();
+            if (end != current) {
+                errln("Word break failure: printEachBackward() Unexpected current value: current()=" +
+                      current + ", expected(=last())=" + end);
+            }
+
+            int j;
+            for (start = iter.previous(), j = expected[i].length-1;
+                 start != BreakIterator.DONE;
+                 end = start, start = iter.previous(), j--) {
+
+                // Check current()'s return value - should be same as previous()'s.
+                current = iter.current();
+                if (start != current) {
+                    errln("Word break failure: printEachBackward() Unexpected current value: current()=" +
+                          current + ", expected(=previous())=" + start);
+                }
+
+                if (!expected[i][j].equals(given[i].substring(start, end))) {
+                    errln("Word break failure: printEachBackward() expected:<" +
+                          expected[i][j] + ">, got:<" +
+                          given[i].substring(start, end) +
+                          "> start=" + start + "  end=" + end);
+                }
+            }
+        }
+    }
+
+    /*
+     * Test mainly for following() and previous()
+     */
+    void TestPrintAt_1() {
+        iter = BreakIterator.getWordInstance(Locale.US);
+
+        int[][] index = {
+            {2, 8, 10, 15, 17},
+            {1, 8, 10, 12, 15, 17, 20},
+            {3, 8, 10, 13, 16, 18, 20},
+            {4, 6,  9, 10, 16},
+        };
+
+        for (int i = 0; i < given.length; i++) {
+            iter.setText(given[i]);
+            for (int j = index[i].length-1; j >= 0; j--) {
+                end = iter.following(index[i][j]);
+                start = iter.previous();
+
+                if (!expected[i][j].equals(given[i].substring(start, end))) {
+                    errln("Word break failure: printAt_1() expected:<" +
+                          expected[i][j] + ">, got:<" +
+                          given[i].substring(start, end) +
+                          "> start=" + start + "  end=" + end);
+                }
+            }
+        }
+    }
+
+    /*
+     * Test mainly for preceding() and next()
+     */
+    void TestPrintAt_2() {
+        iter = BreakIterator.getWordInstance(Locale.US);
+
+        int[][] index = {
+            {2, 9, 10, 15, 17},
+            {1, 9, 10, 13, 16, 18, 20},
+            {4, 9, 10, 13, 16, 18, 20},
+            {6, 7, 10, 11, 15},
+        };
+
+        for (int i = 0; i < given.length; i++) {
+            iter.setText(given[i]);
+
+            // Check preceding(0)'s return value - should equals BreakIterator.DONE.
+            if (iter.preceding(0) != BreakIterator.DONE) {
+                 errln("Word break failure: printAt_2() expected:-1(BreakIterator.DONE), got:" +
+                       iter.preceding(0));
+            }
+
+            for (int j = 0; j < index[i].length; j++) {
+                start = iter.preceding(index[i][j]);
+                end = iter.next();
+
+                if (!expected[i][j].equals(given[i].substring(start, end))) {
+                    errln("Word break failure: printAt_2() expected:<" +
+                          expected[i][j] + ">, got:<" +
+                          given[i].substring(start, end) +
+                          "> start=" + start + "  end=" + end);
+                }
+            }
+
+            // Check next()'s return value - should equals BreakIterator.DONE.
+            end = iter.last();
+            start = iter.next();
+            if (start != BreakIterator.DONE) {
+                 errln("Word break failure: printAt_2() expected:-1(BreakIterator.DONE), got:" + start);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/BreakIterator/Bug4740757.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4740757
+ * @summary Confirm line-breaking behavior of Hangul
+ */
+
+import java.text.*;
+import java.util.*;
+
+public class Bug4740757 {
+
+    private static boolean err = false;
+
+    public static void main(String[] args) {
+        Locale defaultLocale = Locale.getDefault();
+        if (defaultLocale.getLanguage().equals("th")) {
+            Locale.setDefault(Locale.KOREA);
+            test4740757();
+            Locale.setDefault(defaultLocale);
+        } else {
+            test4740757();
+        }
+
+        if (err) {
+            throw new RuntimeException("Incorrect Line-breaking");
+        }
+    }
+
+    private static void test4740757() {
+        String source = "\uc548\ub155\ud558\uc138\uc694? \uc88b\uc740 \uc544\uce68, \uc5ec\ubcf4\uc138\uc694! \uc548\ub155. End.";
+        String expected = "\uc548/\ub155/\ud558/\uc138/\uc694? /\uc88b/\uc740 /\uc544/\uce68, /\uc5ec/\ubcf4/\uc138/\uc694! /\uc548/\ub155. /End./";
+
+        BreakIterator bi = BreakIterator.getLineInstance(Locale.KOREAN);
+        bi.setText(source);
+        int start = bi.first();
+        int end = bi.next();
+        StringBuilder sb =  new StringBuilder();
+
+        for (; end != BreakIterator.DONE; start = end, end = bi.next()) {
+            sb.append(source.substring(start,end));
+            sb.append('/');
+        }
+
+        if (!expected.equals(sb.toString())) {
+            System.err.println("Failed: Hangul line-breaking failed." +
+                "\n\tExpected: " + expected +
+                "\n\tGot:      " + sb +
+                "\nin " + Locale.getDefault() + " locale.");
+            err = true;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/BreakIterator/Bug4912404.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 4912404
+ * @summary Confirm that BreakIterator.equals(null) return false.
+ */
+
+import java.text.BreakIterator;
+
+public class Bug4912404 {
+
+    public static void main(String[] args) {
+        BreakIterator b = BreakIterator.getWordInstance();
+        b.setText("abc");
+        if (b.equals(null)) {
+            throw new RuntimeException("BreakIterator.equals(null) should return false.");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/BreakIterator/Bug4932583.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @run main/timeout=60 Bug4932583
+ * @bug 4932583
+ * @summary Confirm that BreakIterator doesn't get caught in an infinite loop.
+ */
+
+import java.text.*;
+import java.util.*;
+import java.io.*;
+
+public class Bug4932583 {
+    public static void main(String[] args) {
+        BreakIterator iterator = BreakIterator.getCharacterInstance();
+        iterator.setText("\uDB40\uDFFF");
+        int boundary = iterator.next();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/BreakIterator/Bug6513074.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6513074
+ * @summary Confirm that JIS X 0213 characters are processed in line-breaking properly.
+ */
+
+import java.text.*;
+import java.util.*;
+
+public class Bug6513074 {
+
+    private static final String[][] source = {
+        {"\ufa30\ufa31 \ufa69\ufa6a",
+         "JIS X 0213 compatibility additions (\\uFA30-\\uFA6A)"},
+    };
+
+    private static final String[] expected_line = {
+        "\ufa30/\ufa31 /\ufa69/\ufa6a/",
+    };
+
+    private static final String[] expected_word = {
+        "\ufa30\ufa31/ /\ufa69\ufa6a/",
+    };
+
+    private static final String[] expected_char = {
+        "\ufa30/\ufa31/ /\ufa69/\ufa6a/",
+    };
+
+
+    private static boolean err = false;
+
+    public static void main(String[] args) {
+        Locale defaultLocale = Locale.getDefault();
+        if (defaultLocale.getLanguage().equals("th")) {
+            Locale.setDefault(Locale.JAPAN);
+            test6513074();
+            Locale.setDefault(defaultLocale);
+        } else {
+            test6513074();
+        }
+
+        if (err) {
+            throw new RuntimeException("Failed: Incorrect Text-breaking.");
+        }
+    }
+
+
+    private static void test6513074() {
+        BreakIterator bi = BreakIterator.getLineInstance(Locale.JAPAN);
+        for (int i = 0; i < source.length; i++) {
+            testBreakIterator(bi, "Line", source[i][0], expected_line[i], source[i][1]);
+        }
+
+        bi = BreakIterator.getWordInstance(Locale.JAPAN);
+        for (int i = 0; i < source.length; i++) {
+            testBreakIterator(bi, "Word", source[i][0], expected_word[i], source[i][1]);
+        }
+
+        bi = BreakIterator.getCharacterInstance(Locale.JAPAN);
+        for (int i = 0; i < source.length; i++) {
+            testBreakIterator(bi, "Character", source[i][0], expected_char[i], source[i][1]);
+        }
+    }
+
+    private static void testBreakIterator(BreakIterator bi,
+                                          String type,
+                                          String source,
+                                          String expected,
+                                          String description) {
+        bi.setText(source);
+        int start = bi.first();
+        int end = bi.next();
+        StringBuilder sb =  new StringBuilder();
+
+        for (; end != BreakIterator.DONE; start = end, end = bi.next()) {
+            sb.append(source.substring(start,end));
+            sb.append('/');
+        }
+
+        if (!expected.equals(sb.toString())) {
+            System.err.println("Failed: Incorrect " + type + "-breaking for " +
+                description +
+                "\n\tExpected: " + toString(expected) +
+                "\n\tGot:      " + toString(sb.toString()));
+            err = true;
+        }
+    }
+
+    private static String toString(String s) {
+        StringBuilder sb = new StringBuilder();
+
+        for (int i = 0; i < s.length(); i++) {
+            sb.append("  0x" + Integer.toHexString(s.charAt(i)));
+        }
+
+        return sb.toString();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/BreakIterator/NewVSOld_th_TH.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+    @test
+    @summary test Comparison of New Collators against Old Collators in the en_US locale
+*/
+
+import java.io.*;
+import java.util.Enumeration;
+import java.util.Vector;
+import java.util.Locale;
+import java.text.BreakIterator;
+import java.lang.Math;
+
+public class NewVSOld_th_TH {
+    public static void main(String args[]) throws FileNotFoundException,
+                                                  UnsupportedEncodingException,
+                                                  IOException {
+        final String ENCODING = "UTF-8";
+        final Locale THAI_LOCALE = new Locale("th", "TH");
+
+        String rawFileName = "test_th_TH.txt";
+        String oldFileName = "broken_th_TH.txt";
+        StringBuilder rawText = new StringBuilder();
+        StringBuilder oldText = new StringBuilder();
+        StringBuilder cookedText = new StringBuilder();
+
+        File f;
+        f = new File(System.getProperty("test.src", "."), rawFileName);
+
+        try (InputStreamReader rawReader =
+                 new InputStreamReader(new FileInputStream(f), ENCODING)) {
+            int c;
+            while ((c = rawReader.read()) != -1) {
+                rawText.append((char) c);
+            }
+        }
+
+        f = new File(System.getProperty("test.src", "."), oldFileName);
+        try (InputStreamReader oldReader =
+                 new InputStreamReader(new FileInputStream(f), ENCODING)) {
+            int c;
+            while ((c = oldReader.read()) != -1) {
+                oldText.append((char) c);
+            }
+        }
+
+        BreakIterator breakIterator = BreakIterator.getWordInstance(THAI_LOCALE);
+        breakIterator.setText(rawText.toString());
+
+        int start = breakIterator.first();
+        for (int end = breakIterator.next();
+             end != BreakIterator.DONE;
+             start = end, end = breakIterator.next()) {
+             cookedText.append(rawText.substring(start, end));
+             cookedText.append("\n");
+        }
+
+        String cooked = cookedText.toString();
+        String old = oldText.toString();
+        if (cooked.compareTo(old) != 0) {
+            throw new RuntimeException("Text not broken the same as with the old BreakIterators");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/BreakIterator/broken_th_TH.txt	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,13 @@
+การ
+เก็บ
+ภาษีประเทศ
+ไทยและ
+ประเทศ
+เดนมาร์ค
+อนุสัญญา
+ระหว่าง
+รัฐบาล
+แห่ง
+ประเทศ
+ไทย
+กับ
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/BreakIterator/test_th_TH.txt	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,1 @@
+การเก็บภาษีประเทศไทยและประเทศเดนมาร์คอนุสัญญาระหว่างรัฐบาลแห่งประเทศไทยกับ
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/CharacterIterator/CharacterIteratorTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,286 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @library /java/text/testlib
+ * @summary test for Character Iterator
+ */
+
+/*
+ *
+ *
+ * (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
+ * (C) Copyright IBM Corp. 1996 - 1998 - All Rights Reserved
+ *
+ * Portions copyright (c) 2007 Sun Microsystems, Inc.
+ * All Rights Reserved.
+ *
+ * The original version of this source code and documentation
+ * is copyrighted and owned by Taligent, Inc., a wholly-owned
+ * subsidiary of IBM. These materials are provided under terms
+ * of a License Agreement between Taligent and Sun. This technology
+ * is protected by multiple US and International patents.
+ *
+ * This notice and attribution to Taligent may not be removed.
+ * Taligent is a registered trademark of Taligent, Inc.
+ *
+ * Permission to use, copy, modify, and distribute this software
+ * and its documentation for NON-COMMERCIAL purposes and without
+ * fee is hereby granted provided that this copyright notice
+ * appears in all copies. Please refer to the file "copyright.html"
+ * for further important copyright and licensing information.
+ *
+ * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
+ * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+ * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+ *
+ */
+
+import java.text.*;
+
+public class CharacterIteratorTest extends IntlTest {
+    public static void main(String[] args) throws Exception {
+        new CharacterIteratorTest().run(args);
+    }
+
+    public CharacterIteratorTest() {
+    }
+
+    public void TestConstructionAndEquality() {
+        String  testText = "Now is the time for all good men to come to the aid of their country.";
+        String  testText2 = "Don't bother using this string.";
+
+        CharacterIterator test1 = new StringCharacterIterator(testText);
+        CharacterIterator test2 = new StringCharacterIterator(testText, 5);
+        CharacterIterator test3 = new StringCharacterIterator(testText, 2, 20, 5);
+        CharacterIterator test4 = new StringCharacterIterator(testText2);
+        CharacterIterator test5 = (CharacterIterator)test1.clone();
+
+        if (test1.equals(test2) || test1.equals(test3) || test1.equals(test4))
+            errln("Construation or equals() failed: Two unequal iterators tested equal");
+
+        if (!test1.equals(test5))
+            errln("clone() or equals() failed: Two clones tested unequal");
+
+        if (test1.hashCode() == test2.hashCode() || test1.hashCode() == test3.hashCode()
+                        || test1.hashCode() == test4.hashCode())
+            errln("hash() failed:  different objects have same hash code");
+
+        if (test1.hashCode() != test5.hashCode())
+            errln("hash() failed:  identical objects have different hash codes");
+
+        test1.setIndex(5);
+        if (!test1.equals(test2) || test1.equals(test5))
+            errln("setIndex() failed");
+    }
+
+    public void TestIteration() {
+        String text = "Now is the time for all good men to come to the aid of their country.";
+
+        CharacterIterator   iter = new StringCharacterIterator(text, 5);
+
+        if (iter.current() != text.charAt(5))
+            errln("Iterator didn't start out in the right place.");
+
+        char c = iter.first();
+        int     i = 0;
+
+        if (iter.getBeginIndex() != 0 || iter.getEndIndex() != text.length())
+            errln("getBeginIndex() or getEndIndex() failed");
+
+        logln("Testing forward iteration...");
+        do {
+            if (c == CharacterIterator.DONE && i != text.length())
+                errln("Iterator reached end prematurely");
+            else if (c != text.charAt(i))
+                errln("Character mismatch at position " + i + ", iterator has " + c +
+                                    ", string has " + text.charAt(c));
+
+            if (iter.current() != c)
+                errln("current() isn't working right");
+            if (iter.getIndex() != i)
+                errln("getIndex() isn't working right");
+
+            if (c != CharacterIterator.DONE) {
+                c = iter.next();
+                i++;
+            }
+        } while (c != CharacterIterator.DONE);
+
+        c = iter.last();
+        i = text.length() - 1;
+
+        logln("Testing backward iteration...");
+        do {
+            if (c == CharacterIterator.DONE && i >= 0)
+                errln("Iterator reached end prematurely");
+            else if (c != text.charAt(i))
+                errln("Character mismatch at position " + i + ", iterator has " + c +
+                                    ", string has " + text.charAt(c));
+
+            if (iter.current() != c)
+                errln("current() isn't working right");
+            if (iter.getIndex() != i)
+                errln("getIndex() isn't working right");
+
+            if (c != CharacterIterator.DONE) {
+                c = iter.previous();
+                i--;
+            }
+        } while (c != CharacterIterator.DONE);
+
+        iter = new StringCharacterIterator(text, 5, 15, 10);
+        if (iter.getBeginIndex() != 5 || iter.getEndIndex() != 15)
+            errln("creation of a restricted-range iterator failed");
+
+        if (iter.getIndex() != 10 || iter.current() != text.charAt(10))
+            errln("starting the iterator in the middle didn't work");
+
+        c = iter.first();
+        i = 5;
+
+        logln("Testing forward iteration over a range...");
+        do {
+            if (c == CharacterIterator.DONE && i != 15)
+                errln("Iterator reached end prematurely");
+            else if (c != text.charAt(i))
+                errln("Character mismatch at position " + i + ", iterator has " + c +
+                                    ", string has " + text.charAt(c));
+
+            if (iter.current() != c)
+                errln("current() isn't working right");
+            if (iter.getIndex() != i)
+                errln("getIndex() isn't working right");
+
+            if (c != CharacterIterator.DONE) {
+                c = iter.next();
+                i++;
+            }
+        } while (c != CharacterIterator.DONE);
+
+        c = iter.last();
+        i = 14;
+
+        logln("Testing backward iteration over a range...");
+        do {
+            if (c == CharacterIterator.DONE && i >= 5)
+                errln("Iterator reached end prematurely");
+            else if (c != text.charAt(i))
+                errln("Character mismatch at position " + i + ", iterator has " + c +
+                                    ", string has " + text.charAt(c));
+
+            if (iter.current() != c)
+                errln("current() isn't working right");
+            if (iter.getIndex() != i)
+                errln("getIndex() isn't working right");
+
+            if (c != CharacterIterator.DONE) {
+                c = iter.previous();
+                i--;
+            }
+        } while (c != CharacterIterator.DONE);
+    }
+
+    /**
+     * @bug 4082050 4078261 4078255
+     */
+    public void TestPathologicalCases() {
+        String text = "This is only a test.";
+
+/*
+This test is commented out until API-change approval for bug #4082050 goes through.
+        // test for bug #4082050 (don't get an error if begin == end, even though all
+        // operations on the iterator will cause exceptions)
+        // [I actually fixed this so that you CAN create an iterator with begin == end,
+        // but all operations on it return DONE.]
+        CharacterIterator iter = new StringCharacterIterator(text, 5, 5, 5);
+        if (iter.first() != CharacterIterator.DONE
+            || iter.next() != CharacterIterator.DONE
+            || iter.last() != CharacterIterator.DONE
+            || iter.previous() != CharacterIterator.DONE
+            || iter.current() != CharacterIterator.DONE
+            || iter.getIndex() != 5)
+            errln("Got something other than DONE when performing operations on an empty StringCharacterIterator");
+*/
+CharacterIterator iter = null;
+
+        // if we try to construct a StringCharacterIterator with an endIndex that's off
+        // the end of the String under iterator, we're supposed to get an
+        // IllegalArgumentException
+        boolean gotException = false;
+        try {
+            iter = new StringCharacterIterator(text, 5, 100, 5);
+        }
+        catch (IllegalArgumentException e) {
+            gotException = true;
+        }
+        if (!gotException)
+            errln("StringCharacterIterator didn't throw an exception when given an invalid substring range.");
+
+        // test for bug #4078255 (getting wrong value from next() when we're at the end
+        // of the string)
+        iter = new StringCharacterIterator(text);
+        int expectedIndex = iter.getEndIndex();
+        int actualIndex;
+
+        iter.last();
+        actualIndex = iter.getIndex();
+        if (actualIndex != expectedIndex - 1)
+            errln("last() failed: expected " + (expectedIndex - 1) + ", got " + actualIndex);
+
+        iter.next();
+        actualIndex = iter.getIndex();
+        if (actualIndex != expectedIndex)
+            errln("next() after last() failed: expected " + expectedIndex + ", got " + actualIndex);
+
+        iter.next();
+        actualIndex = iter.getIndex();
+        if (actualIndex != expectedIndex)
+            errln("second next() after last() failed: expected " + expectedIndex + ", got " + actualIndex);
+    }
+
+    /*
+     * @bug 4123771 4051073
+     * #4123771 is actually a duplicate of bug #4051073, which was fixed some time ago, but
+     * no one ever added a regression test for it.
+     */
+    public void TestBug4123771() {
+        String text = "Some string for testing";
+        StringCharacterIterator iter = new StringCharacterIterator(text);
+        int index = iter.getEndIndex();
+        try {
+            char c = iter.setIndex(index);
+        }
+        catch (Exception e) {
+            System.out.println("method setIndex(int position) throws unexpected exception " + e);
+            System.out.println(" position: " + index);
+            System.out.println(" getEndIndex(): " + iter.getEndIndex());
+            System.out.println(" text.length(): " + text.length());
+            errln(""); // re-throw the exception through our test framework
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/APITest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,318 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @library /java/text/testlib
+ * @summary test Collation API
+ */
+/*
+(C) Copyright Taligent, Inc. 1996 - All Rights Reserved
+(C) Copyright IBM Corp. 1996 - All Rights Reserved
+
+  The original version of this source code and documentation is copyrighted and
+owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These materials are
+provided under terms of a License Agreement between Taligent and Sun. This
+technology is protected by multiple US and International patents. This notice and
+attribution to Taligent may not be removed.
+  Taligent is a registered trademark of Taligent, Inc.
+*/
+
+import java.util.Locale;
+import java.text.Collator;
+import java.text.RuleBasedCollator;
+import java.text.CollationKey;
+import java.text.CollationElementIterator;
+
+public class APITest extends CollatorTest {
+
+    public static void main(String[] args) throws Exception {
+        new APITest().run(args);
+    }
+
+    final void doAssert(boolean condition, String message)
+    {
+        if (!condition) {
+            err("ERROR: ");
+            errln(message);
+        }
+    }
+
+    public final void TestProperty( )
+    {
+        Collator col = null;
+        try {
+            col = Collator.getInstance(Locale.ROOT);
+            logln("The property tests begin : ");
+            logln("Test ctors : ");
+            doAssert(col.compare("ab", "abc") < 0, "ab < abc comparison failed");
+            doAssert(col.compare("ab", "AB") < 0, "ab < AB comparison failed");
+            doAssert(col.compare("black-bird", "blackbird") > 0, "black-bird > blackbird comparison failed");
+            doAssert(col.compare("black bird", "black-bird") < 0, "black bird < black-bird comparison failed");
+            doAssert(col.compare("Hello", "hello") > 0, "Hello > hello comparison failed");
+
+            logln("Test ctors ends.");
+            logln("testing Collator.getStrength() method ...");
+            doAssert(col.getStrength() == Collator.TERTIARY, "collation object has the wrong strength");
+            doAssert(col.getStrength() != Collator.PRIMARY, "collation object's strength is primary difference");
+
+            logln("testing Collator.setStrength() method ...");
+            col.setStrength(Collator.SECONDARY);
+            doAssert(col.getStrength() != Collator.TERTIARY, "collation object's strength is secondary difference");
+            doAssert(col.getStrength() != Collator.PRIMARY, "collation object's strength is primary difference");
+            doAssert(col.getStrength() == Collator.SECONDARY, "collation object has the wrong strength");
+
+            logln("testing Collator.setDecomposition() method ...");
+            col.setDecomposition(Collator.NO_DECOMPOSITION);
+            doAssert(col.getDecomposition() != Collator.FULL_DECOMPOSITION, "collation object's strength is secondary difference");
+            doAssert(col.getDecomposition() != Collator.CANONICAL_DECOMPOSITION, "collation object's strength is primary difference");
+            doAssert(col.getDecomposition() == Collator.NO_DECOMPOSITION, "collation object has the wrong strength");
+        } catch (Exception foo) {
+            errln("Error : " + foo.getMessage());
+            errln("Default Collator creation failed.");
+        }
+        logln("Default collation property test ended.");
+        logln("Collator.getRules() testing ...");
+        doAssert(((RuleBasedCollator)col).getRules().length() != 0, "getRules() result incorrect" );
+        logln("getRules tests end.");
+        try {
+            col = Collator.getInstance(Locale.FRENCH);
+            col.setStrength(Collator.PRIMARY);
+            logln("testing Collator.getStrength() method again ...");
+            doAssert(col.getStrength() != Collator.TERTIARY, "collation object has the wrong strength");
+            doAssert(col.getStrength() == Collator.PRIMARY, "collation object's strength is not primary difference");
+
+            logln("testing French Collator.setStrength() method ...");
+            col.setStrength(Collator.TERTIARY);
+            doAssert(col.getStrength() == Collator.TERTIARY, "collation object's strength is not tertiary difference");
+            doAssert(col.getStrength() != Collator.PRIMARY, "collation object's strength is primary difference");
+            doAssert(col.getStrength() != Collator.SECONDARY, "collation object's strength is secondary difference");
+
+        } catch (Exception bar) {
+            errln("Error :  " + bar.getMessage());
+            errln("Creating French collation failed.");
+        }
+
+        logln("Create junk collation: ");
+        Locale abcd = new Locale("ab", "CD", "");
+        Collator junk = null;
+        try {
+            junk = Collator.getInstance(abcd);
+        } catch (Exception err) {
+            errln("Error : " + err.getMessage());
+            errln("Junk collation creation failed, should at least return the collator for the base bundle.");
+        }
+        try {
+            col = Collator.getInstance(Locale.ROOT);
+            doAssert(col.equals(junk), "The base bundle's collation should be returned.");
+        } catch (Exception exc) {
+            errln("Error : " + exc.getMessage());
+            errln("Default collation comparison, caching not working.");
+        }
+
+        logln("Collator property test ended.");
+    }
+
+    public final void TestHashCode( )
+    {
+        logln("hashCode tests begin.");
+        Collator col1 = null;
+        try {
+            col1 = Collator.getInstance(Locale.ROOT);
+        } catch (Exception foo) {
+            errln("Error : " + foo.getMessage());
+            errln("Default collation creation failed.");
+        }
+        Collator col2 = null;
+        Locale dk = new Locale("da", "DK", "");
+        try {
+            col2 = Collator.getInstance(dk);
+        } catch (Exception bar) {
+            errln("Error : " + bar.getMessage());
+            errln("Danish collation creation failed.");
+            return;
+        }
+        Collator col3 = null;
+        try {
+            col3 = Collator.getInstance(Locale.ROOT);
+        } catch (Exception err) {
+            errln("Error : " + err.getMessage());
+            errln("2nd default collation creation failed.");
+        }
+        logln("Collator.hashCode() testing ...");
+
+        if (col1 != null) {
+            doAssert(col1.hashCode() != col2.hashCode(), "Hash test1 result incorrect");
+            if (col3 != null) {
+                doAssert(col1.hashCode() == col3.hashCode(), "Hash result not equal");
+            }
+        }
+
+        logln("hashCode tests end.");
+    }
+
+    //----------------------------------------------------------------------------
+    // ctor -- Tests the constructor methods
+    //
+    public final void TestCollationKey( )
+    {
+        logln("testing CollationKey begins...");
+        Collator col = null;
+        try {
+            col = Collator.getInstance(Locale.ROOT);
+        } catch (Exception foo) {
+            errln("Error : " + foo.getMessage());
+            errln("Default collation creation failed.");
+        }
+        if (col == null) {
+            return;
+        }
+
+        String test1 = "Abcda", test2 = "abcda";
+        logln("Use tertiary comparison level testing ....");
+        CollationKey sortk1 = col.getCollationKey(test1);
+        CollationKey sortk2 = col.getCollationKey(test2);
+        doAssert(sortk1.compareTo(sortk2) > 0,
+                    "Result should be \"Abcda\" >>> \"abcda\"");
+        CollationKey sortk3 = sortk2;
+        CollationKey sortkNew = sortk1;
+        doAssert(sortk1 != sortk2, "The sort keys should be different");
+        doAssert(sortk1.hashCode() != sortk2.hashCode(), "sort key hashCode() failed");
+        doAssert(sortk2.compareTo(sortk3) == 0, "The sort keys should be the same");
+        doAssert(sortk1 == sortkNew, "The sort keys assignment failed");
+        doAssert(sortk1.hashCode() == sortkNew.hashCode(), "sort key hashCode() failed");
+        doAssert(sortkNew != sortk3, "The sort keys should be different");
+        doAssert(sortk1.compareTo(sortk3) > 0, "Result should be \"Abcda\" >>> \"abcda\"");
+        doAssert(sortk2.compareTo(sortk3) == 0, "Result should be \"abcda\" == \"abcda\"");
+        long    cnt1, cnt2;
+        byte byteArray1[] = sortk1.toByteArray();
+        byte byteArray2[] = sortk2.toByteArray();
+        doAssert(byteArray1 != null && byteArray2 != null, "CollationKey.toByteArray failed.");
+        logln("testing sortkey ends...");
+    }
+    //----------------------------------------------------------------------------
+    // ctor -- Tests the constructor methods
+    //
+    public final void TestElemIter( )
+    {
+        logln("testing sortkey begins...");
+        Collator col = null;
+        try {
+            col = Collator.getInstance();
+        } catch (Exception foo) {
+            errln("Error : " + foo.getMessage());
+            errln("Default collation creation failed.");
+        }
+        RuleBasedCollator rbCol;
+        if (col instanceof RuleBasedCollator) {
+            rbCol = (RuleBasedCollator) col;
+        } else {
+            return;
+        }
+        String testString1 = "XFILE What subset of all possible test cases has the highest probability of detecting the most errors?";
+        String testString2 = "Xf ile What subset of all possible test cases has the lowest probability of detecting the least errors?";
+        logln("Constructors and comparison testing....");
+        CollationElementIterator iterator1 = rbCol.getCollationElementIterator(testString1);
+        CollationElementIterator iterator2 = rbCol.getCollationElementIterator(testString1);
+        CollationElementIterator iterator3 = rbCol.getCollationElementIterator(testString2);
+        int order1, order2, order3;
+        order1 = iterator1.next();
+        order2 = iterator2.next();
+        doAssert(order1 == order2, "The order result should be the same");
+
+        order3 = iterator3.next();
+        doAssert(CollationElementIterator.primaryOrder(order1)
+                     == CollationElementIterator.primaryOrder(order3),
+                 "The primary orders should be the same");
+        doAssert(CollationElementIterator.secondaryOrder(order1)
+                     == CollationElementIterator.secondaryOrder(order3),
+                 "The secondary orders should be the same");
+        doAssert(CollationElementIterator.tertiaryOrder(order1)
+                     == CollationElementIterator.tertiaryOrder(order3),
+                 "The tertiary orders should be the same");
+
+        order1 = iterator1.next();
+        order3 = iterator3.next();
+        doAssert(CollationElementIterator.primaryOrder(order1)
+                     == CollationElementIterator.primaryOrder(order3),
+                 "The primary orders should be identical");
+        doAssert(CollationElementIterator.tertiaryOrder(order1)
+                     != CollationElementIterator.tertiaryOrder(order3),
+                 "The tertiary orders should be different");
+
+        order1 = iterator1.next();
+        order3 = iterator3.next();
+        doAssert(CollationElementIterator.secondaryOrder(order1)
+                     != CollationElementIterator.secondaryOrder(order3),
+                 "The secondary orders should be different");
+        doAssert(order1 != CollationElementIterator.NULLORDER,
+                 "Unexpected end of iterator reached");
+
+        iterator1.reset();
+        iterator2.reset();
+        iterator3.reset();
+        order1 = iterator1.next();
+        order2 = iterator2.next();
+        doAssert(order1 == order2, "The order result should be the same");
+
+        order3 = iterator3.next();
+        doAssert(CollationElementIterator.primaryOrder(order1)
+                     == CollationElementIterator.primaryOrder(order3),
+                 "The orders should be the same");
+        doAssert(CollationElementIterator.secondaryOrder(order1)
+                     == CollationElementIterator.secondaryOrder(order3),
+                 "The orders should be the same");
+        doAssert(CollationElementIterator.tertiaryOrder(order1)
+                     == CollationElementIterator.tertiaryOrder(order3),
+                 "The orders should be the same");
+
+        order1 = iterator1.next();
+        order2 = iterator2.next();
+        order3 = iterator3.next();
+        doAssert(CollationElementIterator.primaryOrder(order1)
+                     == CollationElementIterator.primaryOrder(order3),
+                 "The primary orders should be identical");
+        doAssert(CollationElementIterator.tertiaryOrder(order1)
+                     != CollationElementIterator.tertiaryOrder(order3),
+                 "The tertiary orders should be different");
+
+        order1 = iterator1.next();
+        order3 = iterator3.next();
+        doAssert(CollationElementIterator.secondaryOrder(order1)
+                     != CollationElementIterator.secondaryOrder(order3),
+                 "The secondary orders should be different");
+        doAssert(order1 != CollationElementIterator.NULLORDER, "Unexpected end of iterator reached");
+        logln("testing CollationElementIterator ends...");
+    }
+
+    public final void TestGetAll()
+    {
+        Locale[] list = Collator.getAvailableLocales();
+        for (int i = 0; i < list.length; ++i) {
+            log("Locale name: ");
+            log(list[i].toString());
+            log(" , the display name is : ");
+            logln(list[i].getDisplayName());
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/Bug6271411.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6271411
+ * @library /java/text/testlib
+ * @summary Confirm that three JCK testcases for CollationElementIterator pass.
+ */
+
+import java.text.*;
+
+/*
+ * Based on JCK-runtime-15/tests/api/java_text/CollationElementIterator/ColltnElmtIterTests.java.
+ */
+public class Bug6271411 extends IntlTest {
+
+    public static void main(String argv[]) throws Exception {
+        Bug6271411 test = new Bug6271411();
+        test.run(argv);
+    }
+
+    /*
+     * Rule for RuleBasedCollator
+     */
+    static final String rule = "< c, C < d; D";
+
+    /*
+     * Textdata
+     */
+    static final String[] values = {
+        "", "c", "cH522Yd", "Hi, high school", "abcchCHidD"
+    };
+
+
+    /*
+     * Confirm that setOffset() throws IllegalArgumentException
+     * (not IndexOutOfBoundsException) if the given offset is invalid.
+     * Use CollationElementIterator.setText(String).
+     */
+    public void Test_CollationElementIterator0007() throws Exception {
+        int[] offsets = {
+            Integer.MIN_VALUE, Integer.MIN_VALUE + 1, -10000, -2, -1,
+            100, 101, // These two are customized for every test data later.
+            12345, Integer.MAX_VALUE - 1, Integer.MAX_VALUE
+        };
+        boolean err = false;
+
+        RuleBasedCollator rbc = new RuleBasedCollator(rule);
+        CollationElementIterator iterator = rbc.getCollationElementIterator("");
+
+        for (int i = 0; i < values.length; i++) {
+            String source = values[i];
+            iterator.setText(source);
+
+            int len = source.length();
+            offsets[5] = len + 1;
+            offsets[6] = len + 2;
+
+            for (int j = 0; j < offsets.length; j++) {
+                try {
+                    iterator.setOffset(offsets[j]);
+                    System.out.println("IllegalArgumentException should be thrown for setOffset(" +
+                                       offsets[j] + ") for <" + source + ">.");
+                    err = true;
+                }
+                catch (IllegalArgumentException e) {
+                }
+            }
+        }
+
+        if (err) {
+            errln("CollationElementIterator.setOffset() didn't throw an expected IllegalArguemntException.");
+        }
+    }
+
+    /*
+     * Confirm that setText() doesn't throw an exception and setOffset() throws
+     * IllegalArgumentException if the given offset is invalid.
+     * Use CollationElementIterator.setText(CharacterIterator).
+     */
+    public void Test_CollationElementIterator0010() throws Exception {
+        String prefix = "xyz abc";
+        String suffix = "1234567890";
+        int begin = prefix.length();
+        int[] offsets = {
+            Integer.MIN_VALUE, Integer.MIN_VALUE + 1, -10000,
+            -2, -1, 0, 1, begin - 2, begin - 1, 9, 10, 11, 12, 13, 14,
+            15, 12345, Integer.MAX_VALUE - 1, Integer.MAX_VALUE
+        };
+        boolean err = false;
+
+        RuleBasedCollator rbc = new RuleBasedCollator(rule);
+        CollationElementIterator iterator = rbc.getCollationElementIterator("");
+
+        for (int i = 0; i < values.length; i++) {
+            String str = prefix + values[i] + suffix;
+            int len = str.length();
+            int end = len - suffix.length();
+
+            CharacterIterator source =
+                new StringCharacterIterator(str, begin, end, begin);
+            iterator.setText(source);
+
+            offsets[9] = end + 1;
+            offsets[10] = end + 2;
+            offsets[11] = (end + len) / 2;
+            offsets[12] = len - 1;
+            offsets[13] = len;
+            offsets[14] = len + 1;
+            offsets[15] = len + 2;
+
+            for (int j = 0; j < offsets.length; j++) {
+                try {
+                    iterator.setOffset(offsets[j]);
+
+                    System.out.println("IllegalArgumentException should be thrown for setOffset(" +
+                                       offsets[j] + ") for <" + str + ">.");
+                    err = true;
+                }
+                catch (IllegalArgumentException e) {
+                }
+            }
+        }
+
+        if (err) {
+            errln("CollationElementIterator.setOffset() didn't throw an expected IllegalArguemntException.");
+        }
+    }
+
+    /*
+     * Confirm that setText() doesn't throw an exception and setOffset() sets
+     * an offset as expected.
+     * Use CollationElementIterator.setText(CharacterIterator).
+     */
+    public void Test_CollationElementIterator0011() throws Exception {
+        String prefix = "xyz abc";
+        String suffix = "1234567890";
+        int begin = prefix.length();
+        int[] offsets = { begin, begin + 1, 2, 3, 4 };
+
+        RuleBasedCollator rbc = new RuleBasedCollator(rule);
+        CollationElementIterator iterator = rbc.getCollationElementIterator("");
+
+        for (int i = 0; i < values.length; i++) {
+            String str = prefix + values[i] + suffix;
+            int len = str.length();
+            int end = len - suffix.length();
+            CharacterIterator source =
+                new StringCharacterIterator(str, begin, end, begin);
+            iterator.setText(source);
+
+            offsets[2] = (end + len) / 2;
+            offsets[3] = len - 1;
+            offsets[4] = len;
+
+            for (int j = 0; j < offsets.length; j++) {
+                int offset = offsets[j];
+
+                if (offset < begin || offset > end) {
+                    break;
+                }
+
+                iterator.setOffset(offset);
+                int newOffset = iterator.getOffset();
+
+                if (newOffset != offset) {
+                    throw new RuntimeException("setOffset() didn't set a correct offset. Got: " +
+                    newOffset + " Expected: " + offset + " for <" + str + ">.");
+                }
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/CollationKeyTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4106263
+ * @summary Tests on the bug 4106263 - CollationKey became non-final extendable class.
+ *          The implementation of CollationKey is moved to the new private class,
+ *          RuleBasedCollationKey. This test basically tests on the two features:
+ *          1. Existing code using CollationKey works (backward compatiblility)
+ *          2. CollationKey can be extended by its subclass.
+ */
+
+
+public class CollationKeyTest {
+
+    public static void main(String[] args) {
+        CollationKeyTestImpl ck = new CollationKeyTestImpl("Testing the CollationKey");
+        ck.run();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/CollationKeyTestImpl.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,243 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ *
+ * A part of tests on the bug 4106263. CollationKey became non-final extendable class.
+ *          The implementation of CollationKey is moved to the new private class,
+ *          RuleBasedCollationKey. This test basically tests on the two features:
+ *          1. Existing code using CollationKey works (backward compatiblility)
+ *          2. CollationKey can be extended by its subclass.
+ */
+
+import java.util.Locale;
+import java.text.Collator;
+import java.text.CollationKey;
+import java.io.*;
+
+import java.text.*;
+
+
+public class CollationKeyTestImpl extends CollationKey {
+
+    private static String[] sourceData_ja = {
+        "\u3042\u3044\u3046\u3048\u3048",
+        "\u3041\u3043\u3045\u3047\u3049",
+        "\u3052\u3054\u3056\u3058\u3058",
+        "\u3051\u3053\u3055\u3057\u3059",
+        "\u3062\u3064\u3066\u3068\u3068",
+        "\u3061\u3063\u3065\u3067\u3069",
+        "\u3072\u3074\u3075\u3078\u3078",
+        "\u3071\u3073\u3075\u3077\u3079",
+        "\u3082\u3084\u3085\u3088\u3088",
+        "\u3081\u3083\u3085\u3087\u3089",
+        "\u30a2\u30a4\u30a6\u30a8\u30aa",
+        "\u30a1\u30a3\u30a5\u30a7\u30a9",
+        "\u30c2\u30c4\u30c6\u30c8\u30ca",
+        "\u30c1\u30c3\u30c5\u30c7\u30c9",
+        "\u30b2\u30b4\u30b6\u30b8\u30ba",
+        "\u30b1\u30b3\u30b5\u30b7\u30b9",
+        "\u30d2\u30d4\u30d6\u30d8\u30da",
+        "\u30d1\u30d3\u30d5\u30d7\u30d9",
+        "\u30e2\u30e4\u30e6\u30e8\u30ea",
+        "\u30e1\u30e3\u30e5\u30e7\u30e9"
+        };
+    private static final String[] targetData_ja = {
+        "\u3042\u3044\u3046\u3048\u3048",
+        "\u3041\u3043\u3045\u3047\u3049",
+        "\u30a2\u30a4\u30a6\u30a8\u30aa",
+        "\u30a1\u30a3\u30a5\u30a7\u30a9",
+        "\u3052\u3054\u3056\u3058\u3058",
+        "\u3051\u3053\u3055\u3057\u3059",
+        "\u30b1\u30b3\u30b5\u30b7\u30b9",
+        "\u30b2\u30b4\u30b6\u30b8\u30ba",
+        "\u3061\u3063\u3065\u3067\u3069",
+        "\u30c1\u30c3\u30c5\u30c7\u30c9",
+        "\u3062\u3064\u3066\u3068\u3068",
+        "\u30c2\u30c4\u30c6\u30c8\u30ca",
+        "\u3071\u3073\u3075\u3077\u3079",
+        "\u30d1\u30d3\u30d5\u30d7\u30d9",
+        "\u3072\u3074\u3075\u3078\u3078",
+        "\u30d2\u30d4\u30d6\u30d8\u30da",
+        "\u3081\u3083\u3085\u3087\u3089",
+        "\u30e1\u30e3\u30e5\u30e7\u30e9",
+        "\u3082\u3084\u3085\u3088\u3088",
+        "\u30e2\u30e4\u30e6\u30e8\u30ea"
+        };
+
+    public void run() {
+        /** debug: printout the test data
+        for (int i=0; i<sourceData_ja.length; i++){
+                System.out.println(i+": "+sourceData_ja[i]);
+        }
+        **/
+       /*
+        * 1. Test the backward compatibility
+        *    note: targetData_ja.length is equal to sourceData_ja.length
+        */
+        Collator myCollator = Collator.getInstance(Locale.JAPAN);
+        CollationKey[] keys = new CollationKey[sourceData_ja.length];
+        CollationKey[] target_keys = new CollationKey[targetData_ja.length];
+        for (int i=0; i<sourceData_ja.length; i++){
+                keys[i] = myCollator.getCollationKey(sourceData_ja[i]);
+                target_keys[i] = myCollator.getCollationKey(targetData_ja[i]); //used later
+        }
+        /* Sort the string using CollationKey */
+        InsertionSort(keys);
+        /** debug: printout the result after sort
+        System.out.println("--- After Sorting ---");
+        for (int i=0; i<sourceData_ja.length; i++){
+                System.out.println(i+" :"+keys[i].getSourceString());
+        }
+        **/
+       /*
+        * Compare the result using equals method and getSourceString method.
+        */
+        boolean pass = true;
+        for (int i=0; i<sourceData_ja.length; i++){
+                /* Comparing using String.equals: in order to use getStringSource() */
+                if (! targetData_ja[i].equals(keys[i].getSourceString())){
+                        throw new RuntimeException("FAILED: CollationKeyTest backward compatibility "
+                                  +"while comparing" +targetData_ja[i]+" vs "
+                                  +keys[i].getSourceString());
+                }
+                /* Comparing using CollaionKey.equals: in order to use equals() */
+                if (! target_keys[i].equals(keys[i])){
+                        throw new RuntimeException("FAILED: CollationKeyTest backward compatibility."
+                                  +" Using CollationKey.equals " +targetData_ja[i]
+                                  +" vs " +keys[i].getSourceString());
+                }
+                /* Comparing using CollaionKey.hashCode(): in order to use hashCode() */
+                if (target_keys[i].hashCode() != keys[i].hashCode()){
+                        throw new RuntimeException("FAILED: CollationKeyTest backward compatibility."
+                                  +" Using CollationKey.hashCode " +targetData_ja[i]
+                                  +" vs " +keys[i].getSourceString());
+                }
+                /* Comparing using CollaionKey.toByteArray(): in order to use toByteArray() */
+                byte[] target_bytes = target_keys[i].toByteArray();
+                byte[] source_bytes = keys[i].toByteArray();
+                for (int j=0; j<target_bytes.length; j++){
+                        Byte targetByte = new Byte(target_bytes[j]);
+                        Byte sourceByte = new Byte(source_bytes[j]);
+                        if (targetByte.compareTo(sourceByte)!=0){
+                            throw new RuntimeException("FAILED: CollationKeyTest backward "
+                                  +"compatibility. Using Byte.compareTo from CollationKey.toByteArray "
+                                  +targetData_ja[i]
+                                  +" vs " +keys[i].getSourceString());
+                        }
+                }
+        }
+        testSubclassMethods();
+        testConstructor();
+    }
+
+   /*
+    * Sort the array of CollationKey using compareTo method in insertion sort.
+    */
+    private  void  InsertionSort(CollationKey[] keys){
+        int f, i;
+        CollationKey tmp;
+
+        for (f=1; f < keys.length; f++){
+            if(keys[f].compareTo( keys[f-1]) > 0){
+                continue;
+            }
+            tmp = keys[f];
+            i = f-1;
+            while ( (i>=0) && (keys[i].compareTo(tmp) > 0) ) {
+                keys[i+1] = keys[i];
+                i--;
+            }
+            keys[i+1]=tmp;
+        }
+    }
+
+
+  /*
+   * From here is the bogus methods to test the subclass of
+   * the CollationKey class.
+   */
+    public CollationKeyTestImpl(String str){
+        super (str);
+        // debug: System.out.println("CollationKeyTest extends CollationKey class: "+str);
+    }
+    /* abstract method: needs to be implemented */
+    public byte[] toByteArray(){
+        String foo= "Hello";
+        return foo.getBytes();
+    }
+   /* abstract method: needs to be implemented */
+   public int compareTo(CollationKey target){
+        return 0;
+   }
+   public boolean equals(Object target){
+        return true;
+   }
+   public String getSourceString(){
+        return "CollationKeyTestImpl";
+   }
+  /*
+   * This method tests the collection of bugus methods from the extended
+   * subclass of CollationKey class.
+   */
+   private void testSubclassMethods() {
+        CollationKeyTestImpl clt1  = new CollationKeyTestImpl("testSubclassMethods-1");
+        CollationKeyTestImpl clt2  = new CollationKeyTestImpl("testSubclassMethods-2");
+        // extended method, equals always returns true
+        if (!clt1.equals(clt2)){
+            throw new RuntimeException("Failed: equals(CollationKeySubClass)");
+        }
+        // extended method, compareTo always returns 0
+        if (clt1.compareTo(clt2)!=0){
+            throw new RuntimeException("Failed: compareTo(CollationKeySubClass)");
+        }
+        // overriding extended method, getSourceString always returns "CollationKeyTestImpl"
+        if (! clt1.getSourceString().equals("CollationKeyTestImpl")){
+            throw new RuntimeException("Failed: CollationKey subclass overriding getSourceString()");
+        }
+        // extended method, toByteArray always returns bytes from "Hello"
+        String str2 = new String( clt2.toByteArray());
+        if (! clt2.equals("Hello")){
+            throw new RuntimeException("Failed: CollationKey subclass toByteArray()");
+        }
+    }
+
+  /*
+   * This method tests CollationKey constructor with null source string.
+   * It should throw NPE.
+   */
+   private void testConstructor() {
+       boolean npe=false;
+       try{
+            CollationKeyTestImpl cltNull  = new CollationKeyTestImpl(null);
+        } catch (NullPointerException npException){
+            npe=true;
+            // debug: System.out.println("--- NPE is thrown with NULL arguement: PASS ---");
+        }
+        if(!npe){
+           throw new RuntimeException("Failed: CollationKey Constructor with null source"+
+                                   " didn't throw NPE!");
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/CollatorTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.reflect.*;
+import java.util.Hashtable;
+import java.util.Enumeration;
+import java.util.Vector;
+import java.io.*;
+import java.text.*;
+
+/**
+ * CollatorTest is a base class for tests that can be run conveniently from
+ * the command line as well as under the Java test harness.
+ * <p>
+ * Sub-classes implement a set of methods named Test<something>. Each
+ * of these methods performs some test. Test methods should indicate
+ * errors by calling either err or errln.  This will increment the
+ * errorCount field and may optionally print a message to the log.
+ * Debugging information may also be added to the log via the log
+ * and logln methods.  These methods will add their arguments to the
+ * log only if the test is being run in verbose mode.
+ */
+public abstract class CollatorTest extends IntlTest {
+
+    //------------------------------------------------------------------------
+    // These methods are utilities specific to the Collation tests..
+    //------------------------------------------------------------------------
+
+    protected void assertEqual(CollationElementIterator i1, CollationElementIterator i2) {
+        int c1, c2, count = 0;
+        do {
+            c1 = i1.next();
+            c2 = i2.next();
+            if (c1 != c2) {
+                errln("    " + count + ": " + c1 + " != " + c2);
+                break;
+            }
+            count++;
+        } while (c1 != CollationElementIterator.NULLORDER);
+    }
+
+    // Replace nonprintable characters with unicode escapes
+    static protected String prettify(String str) {
+        StringBuffer result = new StringBuffer();
+
+        String zero = "0000";
+
+        for (int i = 0; i < str.length(); i++) {
+            char ch = str.charAt(i);
+            if (ch < 0x09 || (ch > 0x0A && ch < 0x20)|| (ch > 0x7E && ch < 0xA0) || ch > 0x100) {
+                String hex = Integer.toString((int)ch,16);
+
+                result.append("\\u" + zero.substring(0, 4 - hex.length()) + hex);
+            } else {
+                result.append(ch);
+            }
+        }
+        return result.toString();
+    }
+
+    // Produce a printable representation of a CollationKey
+    static protected String prettify(CollationKey key) {
+        StringBuffer result = new StringBuffer();
+        byte[] bytes = key.toByteArray();
+
+        for (int i = 0; i < bytes.length; i += 2) {
+            int val = (bytes[i] << 8) + bytes[i+1];
+            result.append(Integer.toString(val, 16) + " ");
+        }
+        return result.toString();
+    }
+
+    //------------------------------------------------------------------------
+    // Everything below here is boilerplate code that makes it possible
+    // to add a new test by simply adding a function to an existing class
+    //------------------------------------------------------------------------
+
+    protected void doTest(Collator col, int strength,
+                          String[] source, String[] target, int[] result) {
+        if (source.length != target.length) {
+            errln("Data size mismatch: source = " +
+                  source.length + ", target = " + target.length);
+
+            return; // Return if "-nothrow" is specified.
+        }
+        if (source.length != result.length) {
+            errln("Data size mismatch: source & target = " +
+                  source.length + ", result = " + result.length);
+
+            return; // Return if "-nothrow" is specified.
+        }
+
+        col.setStrength(strength);
+        for (int i = 0; i < source.length ; i++) {
+            doTest(col, source[i], target[i], result[i]);
+        }
+    }
+
+    protected void doTest(Collator col,
+                          String source, String target, int result) {
+        char relation = '=';
+        if (result <= -1) {
+            relation = '<';
+        } else if (result >= 1) {
+            relation = '>';
+        }
+
+        int compareResult = col.compare(source, target);
+        CollationKey sortKey1 = col.getCollationKey(source);
+        CollationKey sortKey2 = col.getCollationKey(target);
+        int keyResult = sortKey1.compareTo(sortKey2);
+        if (compareResult != keyResult) {
+            errln("Compare and Collation Key results are different! Source = " +
+                  source + " Target = " + target);
+        }
+        if (keyResult != result) {
+            errln("Collation Test failed! Source = " + source + " Target = " +
+                  target + " result should be " + relation);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/CurrencyCollate.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug      4114080 4150807
+ * @summary Test currency collation.  For bug 4114080, make sure the collation
+ * of the euro sign behaves properly. For bug 4150807, make sure the collation
+ * order of ALL the current symbols is correct.  This means they sort
+ * in English alphabetical order of their English names.  This test can be
+ * easily extended to do simple spot checking.  See other collation tests for
+ * more sophisticated testing.
+ */
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.util.Locale;
+import java.text.Collator;
+import java.text.RuleBasedCollator;
+import java.text.CollationKey;
+
+/* Author: Alan Liu
+ * (C) Copyright IBM Corp. 1998 - All Rights Reserved
+ */
+public class CurrencyCollate {
+    static Collator myCollation = Collator.getInstance(Locale.US);
+
+    public static void main(String[] args) {
+        String[] DATA = {
+            "\u20AC", ">", "$",     // euro > dollar
+            "\u20AC", "<", "\u00A3", // euro < pound
+
+            // additional tests for general currency sort order (bug #4150807)
+            "\u00a4", "<", "\u0e3f", // generic currency < baht
+            "\u0e3f", "<", "\u00a2", // baht < cent
+            "\u00a2", "<", "\u20a1", // cent < colon
+            "\u20a1", "<", "\u20a2", // colon < cruzeiro
+            "\u20a2", "<", "\u0024", // cruzeiro < dollar
+            "\u0024", "<", "\u20ab", // dollar < dong
+            "\u20ab", "<", "\u20a3", // dong < franc
+            "\u20a3", "<", "\u20a4", // franc < lira
+            "\u20a4", "<", "\u20a5", // lira < mill
+            "\u20a5", "<", "\u20a6", // mill < naira
+            "\u20a6", "<", "\u20a7", // naira < peseta
+            "\u20a7", "<", "\u00a3", // peseta < pound
+            "\u00a3", "<", "\u20a8", // pound < rupee
+            "\u20a8", "<", "\u20aa", // rupee < shekel
+            "\u20aa", "<", "\u20a9", // shekel < won
+            "\u20a9", "<", "\u00a5"  // won < yen
+        };
+        for (int i=0; i<DATA.length; i+=3) {
+            int expected = DATA[i+1].equals(">") ? 1 : (DATA[i+1].equals("<") ? -1 : 0);
+            int actual = myCollation.compare(DATA[i], DATA[i+2]);
+            if (actual != expected) {
+                throw new RuntimeException("Collation of " +
+                                           DATA[i] + " vs. " +
+                                           DATA[i+2] + " yields " + actual +
+                                           "; expected " + expected);
+            }
+        }
+        System.out.println("Ok");
+    }
+}
+
+//eof
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/DanishTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4930708 4174436 5008498
+ * @library /java/text/testlib
+ * @summary test Danish Collation
+ */
+/*
+(C) Copyright Taligent, Inc. 1996 - All Rights Reserved
+(C) Copyright IBM Corp. 1996 - All Rights Reserved
+
+  The original version of this source code and documentation is copyrighted and
+owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These materials are
+provided under terms of a License Agreement between Taligent and Sun. This
+technology is protected by multiple US and International patents. This notice and
+attribution to Taligent may not be removed.
+  Taligent is a registered trademark of Taligent, Inc.
+*/
+
+import java.util.Locale;
+import java.text.Collator;
+
+// Quick dummy program for printing out test results
+public class DanishTest extends CollatorTest {
+
+    public static void main(String[] args) throws Exception {
+        new DanishTest().run(args);
+    }
+
+    /*
+     * Data for TestPrimary()
+     */
+    private static final String[] primarySourceData = {
+        "Lvi",
+        "L\u00E4vi",
+        "L\u00FCbeck",
+        "ANDR\u00C9",
+        "ANDRE",
+        "ANNONCERER"
+    };
+
+    private static final String[] primaryTargetData = {
+            "Lwi",
+            "L\u00F6wi",
+            "Lybeck",
+            "ANDR\u00E9",
+            "ANDR\u00C9",
+            "ANN\u00D3NCERER"
+    };
+
+    private static final int[] primaryResults = {
+            -1, -1, 0, 0, 0, 0
+    };
+
+    /*
+     * Data for TestTertiary()
+     */
+    private static final String[] tertiarySourceData = {
+            "Luc",
+            "luck",
+            "L\u00FCbeck",
+            "L\u00E4vi",
+            "L\u00F6ww"
+    };
+
+    private static final String[] tertiaryTargetData = {
+            "luck",
+            "L\u00FCbeck",
+            "lybeck",
+            "L\u00F6we",
+            "mast"
+    };
+
+    private static final int[] tertiaryResults = {
+            -1, -1,  1, -1, -1
+    };
+
+    /*
+     * Data for TestExtra()
+     */
+    private static final String[] testData = {
+            "A/S",
+            "ANDRE",
+            "ANDR\u00C9", // E-acute
+            "ANDR\u00C8", // E-grave
+            "ANDR\u00E9", // e-acute
+            "ANDR\u00EA", // e-circ
+            "Andre",
+            "Andr\u00E9", // e-acute
+            "\u00C1NDRE", // A-acute
+            "\u00C0NDRE", // A-grave
+            "andre",
+            "\u00E1ndre", // a-acute
+            "\u00E0ndre", // a-grave
+            "ANDREAS",
+            "ANNONCERER",
+            "ANN\u00D3NCERER", // O-acute
+            "annoncerer",
+            "ann\u00F3ncerer", // o-acute
+            "AS",
+            "A\u00e6RO", // ae-ligature
+            "CA",
+            "\u00C7A", // C-cedilla
+            "CB",
+            "\u00C7C", // C-cedilla
+            "D.S.B.",
+            "DA",
+            "DB",
+            "\u00D0ORA", // capital eth
+            "DSB",
+            "\u00D0SB", // capital eth
+            "DSC",
+            "EKSTRA_ARBEJDE",
+            "EKSTRABUD",
+            "H\u00D8ST",  // could the 0x00D8 be 0x2205?
+            "HAAG",
+            "H\u00C5NDBOG", // A-ring
+            "HAANDV\u00C6RKSBANKEN", // AE-ligature
+            "INTERNETFORBINDELSE",
+            "Internetforbindelse",
+            "\u00CDNTERNETFORBINDELSE", // I-acute
+            "internetforbindelse",
+            "\u00EDnternetforbindelse", // i-acute
+            "Karl",
+            "karl",
+            "NIELSEN",
+            "NIELS J\u00D8RGEN", // O-slash
+            "NIELS-J\u00D8RGEN", // O-slash
+            "OERVAL",
+            "\u0152RVAL", // OE-ligature
+            "\u0153RVAL", // oe-ligature
+            "R\u00C9E, A", // E-acute
+            "REE, B",
+            "R\u00C9E, L", // E-acute
+            "REE, V",
+            "SCHYTT, B",
+            "SCHYTT, H",
+            "SCH\u00DCTT, H", // U-diaeresis
+            "SCHYTT, L",
+            "SCH\u00DCTT, M", // U-diaeresis
+            "SS",
+            "ss",
+            "\u00DF", // sharp S
+            "SSA",
+            "\u00DFA", // sharp S
+            "STOREK\u00C6R", // AE-ligature
+            "STORE VILDMOSE",
+            "STORMLY",
+            "STORM PETERSEN",
+            "THORVALD",
+            "THORVARDUR",
+            "\u00DEORVAR\u0110UR", //  capital thorn, capital d-stroke(like eth) (sami)
+            "THYGESEN",
+            "VESTERG\u00C5RD, A",
+            "VESTERGAARD, A",
+            "VESTERG\u00C5RD, B",                // 50
+            "Westmalle",
+            "YALLE",
+            "Yderligere",
+            "\u00DDderligere", // Y-acute
+            "\u00DCderligere", // U-diaeresis
+            "\u00FDderligere", // y-acute
+            "\u00FCderligere", // u-diaeresis
+            "U\u0308ruk-hai",
+            "ZORO",
+            "\u00C6BLE",  // AE-ligature
+            "\u00E6BLE",  // ae-ligature
+            "\u00C4BLE",  // A-diaeresis
+            "\u00E4BLE",  // a-diaeresis
+            "\u00D8BERG", // O-stroke
+            "\u00F8BERG", // o-stroke
+            "\u00D6BERG", // O-diaeresis
+            "\u00F6BERG"  // o-diaeresis
+    };
+
+    public void TestPrimary() {
+        doTest(myCollation, Collator.PRIMARY,
+               primarySourceData, primaryTargetData, primaryResults);
+    }
+
+    public void TestTertiary() {
+        doTest(myCollation, Collator.TERTIARY,
+               tertiarySourceData, tertiaryTargetData, tertiaryResults);
+
+        for (int i = 0; i < testData.length-1; i++) {
+            for (int j = i+1; j < testData.length; j++) {
+                doTest(myCollation, testData[i], testData[j], -1);
+            }
+        }
+    }
+
+    private final Collator myCollation = Collator.getInstance(new Locale("da", "", ""));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/DummyTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,421 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @library /java/text/testlib
+ * @summary test Dummy Collation
+ */
+
+import java.text.Collator;
+import java.text.RuleBasedCollator;
+
+/*
+(C) Copyright Taligent, Inc. 1996 - All Rights Reserved
+(C) Copyright IBM Corp. 1996 - All Rights Reserved
+
+  The original version of this source code and documentation is copyrighted and
+owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These materials are
+provided under terms of a License Agreement between Taligent and Sun. This
+technology is protected by multiple US and International patents. This notice and
+attribution to Taligent may not be removed.
+  Taligent is a registered trademark of Taligent, Inc.
+*/
+
+public class DummyTest extends CollatorTest {
+
+    public static void main(String[] args) throws Exception {
+        new DummyTest().run(args);
+    }
+
+    private static final String DEFAULTRULES =
+        "='\u200B'=\u200C=\u200D=\u200E=\u200F"
+        // Control Characters
+        + "=\u0000 =\u0001 =\u0002 =\u0003 =\u0004" //null, .. eot
+        + "=\u0005 =\u0006 =\u0007 =\u0008 ='\u0009'" //enq, ...
+        + "='\u000b' =\u000e" //vt,, so
+        + "=\u000f ='\u0010' =\u0011 =\u0012 =\u0013" //si, dle, dc1, dc2, dc3
+        + "=\u0014 =\u0015 =\u0016 =\u0017 =\u0018" //dc4, nak, syn, etb, can
+        + "=\u0019 =\u001a =\u001b =\u001c =\u001d" //em, sub, esc, fs, gs
+        + "=\u001e =\u001f =\u007f"                   //rs, us, del
+        //....then the C1 Latin 1 reserved control codes
+        + "=\u0080 =\u0081 =\u0082 =\u0083 =\u0084 =\u0085"
+        + "=\u0086 =\u0087 =\u0088 =\u0089 =\u008a =\u008b"
+        + "=\u008c =\u008d =\u008e =\u008f =\u0090 =\u0091"
+        + "=\u0092 =\u0093 =\u0094 =\u0095 =\u0096 =\u0097"
+        + "=\u0098 =\u0099 =\u009a =\u009b =\u009c =\u009d"
+        + "=\u009e =\u009f"
+        // IGNORE except for secondary, tertiary difference
+        // Spaces
+        + ";'\u0020';'\u00A0'"                  // spaces
+        + ";'\u2000';'\u2001';'\u2002';'\u2003';'\u2004'"  // spaces
+        + ";'\u2005';'\u2006';'\u2007';'\u2008';'\u2009'"  // spaces
+        + ";'\u200A';'\u3000';'\uFEFF'"                // spaces
+        + ";'\r' ;'\t' ;'\n';'\f';'\u000b'"  // whitespace
+
+        // Non-spacing accents
+
+        + ";\u0301"          // non-spacing acute accent
+        + ";\u0300"          // non-spacing grave accent
+        + ";\u0306"          // non-spacing breve accent
+        + ";\u0302"          // non-spacing circumflex accent
+        + ";\u030c"          // non-spacing caron/hacek accent
+        + ";\u030a"          // non-spacing ring above accent
+        + ";\u030d"          // non-spacing vertical line above
+        + ";\u0308"          // non-spacing diaeresis accent
+        + ";\u030b"          // non-spacing double acute accent
+        + ";\u0303"          // non-spacing tilde accent
+        + ";\u0307"          // non-spacing dot above/overdot accent
+        + ";\u0304"          // non-spacing macron accent
+        + ";\u0337"          // non-spacing short slash overlay (overstruck diacritic)
+        + ";\u0327"          // non-spacing cedilla accent
+        + ";\u0328"          // non-spacing ogonek accent
+        + ";\u0323"          // non-spacing dot-below/underdot accent
+        + ";\u0332"          // non-spacing underscore/underline accent
+        // with the rest of the general diacritical marks in binary order
+        + ";\u0305"          // non-spacing overscore/overline
+        + ";\u0309"          // non-spacing hook above
+        + ";\u030e"          // non-spacing double vertical line above
+        + ";\u030f"          // non-spacing double grave
+        + ";\u0310"          // non-spacing chandrabindu
+        + ";\u0311"          // non-spacing inverted breve
+        + ";\u0312"          // non-spacing turned comma above/cedilla above
+        + ";\u0313"          // non-spacing comma above
+        + ";\u0314"          // non-spacing reversed comma above
+        + ";\u0315"          // non-spacing comma above right
+        + ";\u0316"          // non-spacing grave below
+        + ";\u0317"          // non-spacing acute below
+        + ";\u0318"          // non-spacing left tack below
+        + ";\u0319"          // non-spacing tack below
+        + ";\u031a"          // non-spacing left angle above
+        + ";\u031b"          // non-spacing horn
+        + ";\u031c"          // non-spacing left half ring below
+        + ";\u031d"          // non-spacing up tack below
+        + ";\u031e"          // non-spacing down tack below
+        + ";\u031f"          // non-spacing plus sign below
+        + ";\u0320"          // non-spacing minus sign below
+        + ";\u0321"          // non-spacing palatalized hook below
+        + ";\u0322"          // non-spacing retroflex hook below
+        + ";\u0324"          // non-spacing double dot below
+        + ";\u0325"          // non-spacing ring below
+        + ";\u0326"          // non-spacing comma below
+        + ";\u0329"          // non-spacing vertical line below
+        + ";\u032a"          // non-spacing bridge below
+        + ";\u032b"          // non-spacing inverted double arch below
+        + ";\u032c"          // non-spacing hacek below
+        + ";\u032d"          // non-spacing circumflex below
+        + ";\u032e"          // non-spacing breve below
+        + ";\u032f"          // non-spacing inverted breve below
+        + ";\u0330"          // non-spacing tilde below
+        + ";\u0331"          // non-spacing macron below
+        + ";\u0333"          // non-spacing double underscore
+        + ";\u0334"          // non-spacing tilde overlay
+        + ";\u0335"          // non-spacing short bar overlay
+        + ";\u0336"          // non-spacing long bar overlay
+        + ";\u0338"          // non-spacing long slash overlay
+        + ";\u0339"          // non-spacing right half ring below
+        + ";\u033a"          // non-spacing inverted bridge below
+        + ";\u033b"          // non-spacing square below
+        + ";\u033c"          // non-spacing seagull below
+        + ";\u033d"          // non-spacing x above
+        + ";\u033e"          // non-spacing vertical tilde
+        + ";\u033f"          // non-spacing double overscore
+        + ";\u0340"          // non-spacing grave tone mark
+        + ";\u0341"          // non-spacing acute tone mark
+        + ";\u0342;\u0343;\u0344;\u0345;\u0360;\u0361"    // newer
+        + ";\u0483;\u0484;\u0485;\u0486"    // Cyrillic accents
+
+        + ";\u20D0;\u20D1;\u20D2"           // symbol accents
+        + ";\u20D3;\u20D4;\u20D5"           // symbol accents
+        + ";\u20D6;\u20D7;\u20D8"           // symbol accents
+        + ";\u20D9;\u20DA;\u20DB"           // symbol accents
+        + ";\u20DC;\u20DD;\u20DE"           // symbol accents
+        + ";\u20DF;\u20E0;\u20E1"           // symbol accents
+
+        + ",'\u002D';\u00AD"                // dashes
+        + ";\u2010;\u2011;\u2012"           // dashes
+        + ";\u2013;\u2014;\u2015"           // dashes
+        + ";\u2212"                         // dashes
+
+        // other punctuation
+
+        + "<'\u005f'"        // underline/underscore (spacing)
+        + "<\u00af"          // overline or macron (spacing)
+//        + "<\u00ad"        // syllable hyphen (SHY) or soft hyphen
+        + "<'\u002c'"        // comma (spacing)
+        + "<'\u003b'"        // semicolon
+        + "<'\u003a'"        // colon
+        + "<'\u0021'"        // exclamation point
+        + "<\u00a1"          // inverted exclamation point
+        + "<'\u003f'"        // question mark
+        + "<\u00bf"          // inverted question mark
+        + "<'\u002f'"        // slash
+        + "<'\u002e'"        // period/full stop
+        + "<\u00b4"          // acute accent (spacing)
+        + "<'\u0060'"        // grave accent (spacing)
+        + "<'\u005e'"        // circumflex accent (spacing)
+        + "<\u00a8"          // diaresis/umlaut accent (spacing)
+        + "<'\u007e'"        // tilde accent (spacing)
+        + "<\u00b7"          // middle dot (spacing)
+        + "<\u00b8"          // cedilla accent (spacing)
+        + "<'\u0027'"        // apostrophe
+        + "<'\"'"            // quotation marks
+        + "<\u00ab"          // left angle quotes
+        + "<\u00bb"          // right angle quotes
+        + "<'\u0028'"        // left parenthesis
+        + "<'\u0029'"        // right parenthesis
+        + "<'\u005b'"        // left bracket
+        + "<'\u005d'"        // right bracket
+        + "<'\u007b'"        // left brace
+        + "<'\u007d'"        // right brace
+        + "<\u00a7"          // section symbol
+        + "<\u00b6"          // paragraph symbol
+        + "<\u00a9"          // copyright symbol
+        + "<\u00ae"          // registered trademark symbol
+        + "<'\u0040'"          // at sign
+        + "<\u00a4"          // international currency symbol
+        + "<\u00a2"          // cent sign
+        + "<'\u0024'"        // dollar sign
+        + "<\u00a3"          // pound-sterling sign
+        + "<\u00a5"          // yen sign
+        + "<'\u002a'"        // asterisk
+        + "<'\\u005c'"       // backslash
+        + "<'\u0026'"        // ampersand
+        + "<'\u0023'"        // number sign
+        + "<'\u0025'"        // percent sign
+        + "<'\u002b'"        // plus sign
+//        + "<\u002d"        // hyphen or minus sign
+        + "<\u00b1"          // plus-or-minus sign
+        + "<\u00f7"          // divide sign
+        + "<\u00d7"          // multiply sign
+        + "<'\u003c'"        // less-than sign
+        + "<'\u003d'"        // equal sign
+        + "<'\u003e'"        // greater-than sign
+        + "<\u00ac"          // end of line symbol/logical NOT symbol
+        + "<'\u007c'"          // vertical line/logical OR symbol
+        + "<\u00a6"          // broken vertical line
+        + "<\u00b0"          // degree symbol
+        + "<\u00b5"          // micro symbol
+
+        // NUMERICS
+
+        + "<0<1<2<3<4<5<6<7<8<9"
+        + "<\u00bc<\u00bd<\u00be"   // 1/4,1/2,3/4 fractions
+
+        // NON-IGNORABLES
+        + "<a,A"
+        + "<b,B"
+        + "<c,C"
+        + "<d,D"
+        + "<\u00F0,\u00D0"                  // eth
+        + "<e,E"
+        + "<f,F"
+        + "<g,G"
+        + "<h,H"
+        + "<i,I"
+        + "<j,J"
+        + "<k,K"
+        + "<l,L"
+        + "<m,M"
+        + "<n,N"
+        + "<o,O"
+        + "<p,P"
+        + "<q,Q"
+        + "<r,R"
+        + "<s, S & SS,\u00DF"             // s-zet
+        + "<t,T"
+        + "&th, \u00FE & TH, \u00DE"           // thorn
+        + "<u,U"
+        + "<v,V"
+        + "<w,W"
+        + "<x,X"
+        + "<y,Y"
+        + "<z,Z"
+        + "&AE,\u00C6"                    // ae & AE ligature
+        + "&AE,\u00E6"
+        + "&OE,\u0152"                    // oe & OE ligature
+        + "&OE,\u0153";
+
+    /*
+     * Data for TestPrimary()
+     */
+    private static final String[] primarySourceData = {
+        "p\u00EAche",
+        "abc",
+        "abc",
+        "abc",
+        "abc",
+        "abc",
+        "a\u00E6c",
+        "acHc",
+        "black"
+    };
+
+    private static final String[] primaryTargetData = {
+        "p\u00E9ch\u00E9",
+        "abc",
+        "aBC",
+        "abch",
+        "abd",
+        "\u00E4bc",
+        "a\u00C6c",
+        "aCHc",
+        "black-bird"
+    };
+
+    private static final int[] primaryResults = {
+         0,  0,  0, -1, -1,  0,  0,  0, -1
+    };
+
+    /*
+     * Data for TestSecondary()
+     */
+    private static final String[] secondarySourceData = {
+        "four",
+        "five",
+        "1",
+        "abc",
+        "abc",
+        "abcH",
+        "abc",
+        "acHc"
+    };
+
+    private static final String[] secondaryTargetData = {
+
+        "4",
+        "5",
+        "one",
+        "abc",
+        "aBc",
+        "abch",
+        "abd",
+        "aCHc"
+    };
+
+    private static final int[] secondaryResults = {
+         0,  0,  0,  0,  0,  0, -1,  0
+    };
+
+    /*
+     * Data for TestTertiary()
+     */
+    private static final String[] tertiarySourceData = {
+        "ab'c",
+        "co-op",
+        "ab",
+        "ampersad",
+        "all",
+        "four",
+        "five",
+        "1",
+        "1",
+        "1",
+        "2",
+        "2",
+        "Hello",
+        "a<b",
+        "a<b",
+        "acc",
+        "acHc"
+    };
+
+    private static final String[] tertiaryTargetData = {
+        "abc",
+        "COOP",
+        "abc",
+        "&",
+        "&",
+        "4",
+        "5",
+        "one",
+        "nne",
+        "pne",
+        "two",
+        "uwo",
+        "hellO",
+        "a<=b",
+        "abc",
+        "aCHc",
+        "aCHc"
+    };
+
+    private static final int[] tertiaryResults = {
+        -1,  1, -1, -1, -1, -1, -1,  1,  1, -1,
+         1, -1,  1,  1, -1, -1, -1
+    };
+
+
+    private static final String[] testData = {
+        "a",
+        "A",
+        "\u00e4",
+        "\u00c4",
+        "ae",
+        "aE",
+        "Ae",
+        "AE",
+        "\u00e6",
+        "\u00c6",
+        "b",
+        "c",
+        "z"
+    };
+
+    public void TestPrimary() {
+        doTest(getCollator(), Collator.PRIMARY,
+               primarySourceData, primaryTargetData, primaryResults);
+    }
+
+    public void TestSecondary() {
+        doTest(getCollator(), Collator.SECONDARY,
+               secondarySourceData, secondaryTargetData, secondaryResults);
+    }
+
+    public void TestTertiary() {
+        Collator col = getCollator();
+
+        doTest(col, Collator.TERTIARY,
+               tertiarySourceData, tertiaryTargetData, tertiaryResults);
+
+        for (int i = 0; i < testData.length-1; i++) {
+            for (int j = i+1; j < testData.length; j++) {
+                doTest(col, testData[i], testData[j], -1);
+            }
+        }
+    }
+
+    private RuleBasedCollator myCollation = null;
+    private Collator getCollator() {
+        if (myCollation == null) {
+            try {
+                myCollation = new RuleBasedCollator
+                    (DEFAULTRULES + "& C < ch, cH, Ch, CH & Five, 5 & Four, 4 & one, 1 & Ampersand; '&' & Two, 2 ");
+            } catch (Exception foo) {
+                errln("Collator creation failed.");
+                myCollation = (RuleBasedCollator)Collator.getInstance();
+            }
+        }
+        return myCollation;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/EnglishTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @library /java/text/testlib
+ * @summary test English Collation
+ */
+
+import java.util.Locale;
+import java.text.Collator;
+
+/*
+(C) Copyright Taligent, Inc. 1996 - All Rights Reserved
+(C) Copyright IBM Corp. 1996 - All Rights Reserved
+
+  The original version of this source code and documentation is copyrighted and
+owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These materials are
+provided under terms of a License Agreement between Taligent and Sun. This
+technology is protected by multiple US and International patents. This notice and
+attribution to Taligent may not be removed.
+  Taligent is a registered trademark of Taligent, Inc.
+*/
+
+public class EnglishTest extends CollatorTest {
+
+    public static void main(String[] args) throws Exception {
+        new EnglishTest().run(args);
+    }
+
+    /*
+     * Data for TestPrimary()
+     */
+    private static final String[] primarySourceData = {
+        "p\u00EAche",
+        "abc",
+        "abc",
+        "abc",
+        "a\u00E6c"
+    };
+
+    private static final String[] primaryTargetData = {
+        "p\u00E9ch\u00E9",
+        "aBC",
+        "abd",
+        "\u00E4bc",
+        "a\u00C6c"
+    };
+
+    private static final int[] primaryResults = {
+         0,  0, -1,  0,  0,
+    };
+
+    /*
+     * Data for TestSecondary()
+     */
+    private static final String[] secondarySourceData = {
+        "abc",
+        "abc",
+        "a\u00E6c",
+        "abc",
+        "abc",
+        "p\u00e9ch\u00e9"
+    };
+
+    private static final String[] secondaryTargetData = {
+        "aBd",
+        "\u00E4bc",
+        "a\u00C6c",
+        "aBd",
+        "\u00E4bc",
+        "p\u00eache"
+    };
+
+    private static final int[] secondaryResults = {
+        -1, -1,  0, -1, -1, -1
+    };
+
+    /*
+     * Data for TestTertiary() {
+     */
+    private static final String[] tertiarySourceData = {
+        "ab",
+        "black-bird",
+        "black bird",
+        "black-bird",
+        "Hello",
+        "ABC",
+        "abc",
+        "blackbird",
+        "black-bird",
+        "black-bird",
+        "p\u00EAche",
+        "p\u00E9ch\u00E9",
+        "\u00C4B\u0308C\u0308",
+        "a\u0308bc",
+        "p\u00E9cher",
+        "roles",
+        "abc",
+        "A",
+        "A",
+        "ab",
+        "tcompareplain",
+        "ab",
+        "a#b",
+        "a#b",
+        "abc",
+        "Abcda",
+        "abcda",
+        "abcda",
+        "\u00E6bcda",
+        "\u00E4bcda",
+        "abc",
+        "abc",
+        "abc",
+        "abc",
+        "abc",
+        "acHc",
+        "a\u0308bc",
+        "thi\u0302s"
+    };
+
+    private static final String[] tertiaryTargetData = {
+        "abc",
+        "blackbird",
+        "black-bird",
+        "black",
+        "hello",
+        "ABC",
+        "ABC",
+        "blackbirds",
+        "blackbirds",
+        "blackbird",
+        "p\u00E9ch\u00E9",
+        "p\u00E9cher",
+        "\u00C4B\u0308C\u0308",
+        "A\u0308bc",
+        "p\u00E9che",
+        "ro\u0302le",
+        "A\u00E1cd",
+        "A\u00E1cd",
+        "abc",
+        "abc",
+        "TComparePlain",
+        "aBc",
+        "a#B",
+        "a&b",
+        "a#c",
+        "abcda",
+        "\u00C4bcda",
+        "\u00E4bcda",
+        "\u00C4bcda",
+        "\u00C4bcda",
+        "ab#c",
+        "abc",
+        "ab=c",
+        "abd",
+        "\u00E4bc",
+        "aCHc",
+        "\u00E4bc",
+        "th\u00EEs"
+    };
+
+    private static final int[] tertiaryResults = {
+        -1,  1, -1,  1,  1,  0, -1, -1, -1,  1,
+         1, -1,  0, -1,  1,  1,  1, -1, -1, -1,
+        -1, -1, -1,  1,  1,  1, -1, -1,  1, -1,
+         1,  0,  1, -1, -1, -1,  0,  0
+    };
+
+    private static final String testData[] = {
+        "a",
+        "A",
+        "e",
+        "E",
+        "\u00e9",
+        "\u00e8",
+        "\u00ea",
+        "\u00eb",
+        "ea",
+        "x"
+    };
+
+    public void TestPrimary() {
+        doTest(myCollation, Collator.PRIMARY,
+               primarySourceData, primaryTargetData, primaryResults);
+    }
+
+    public void TestSecondary() {
+        doTest(myCollation, Collator.SECONDARY,
+               secondarySourceData, secondaryTargetData, secondaryResults);
+    }
+
+    public void TestTertiary() {
+        doTest(myCollation, Collator.TERTIARY,
+               tertiarySourceData, tertiaryTargetData, tertiaryResults);
+
+        for (int i = 0; i < testData.length-1; i++) {
+            for (int j = i+1; j < testData.length; j++) {
+                doTest(myCollation, testData[i], testData[j], -1);
+            }
+        }
+    }
+
+    private final Collator myCollation = Collator.getInstance(Locale.ENGLISH);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/FinnishTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @library /java/text/testlib
+ * @summary test Finnish Collation
+ */
+/*
+(C) Copyright Taligent, Inc. 1996 - All Rights Reserved
+(C) Copyright IBM Corp. 1996 - All Rights Reserved
+
+  The original version of this source code and documentation is copyrighted and
+owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These materials are
+provided under terms of a License Agreement between Taligent and Sun. This
+technology is protected by multiple US and International patents. This notice and
+attribution to Taligent may not be removed.
+  Taligent is a registered trademark of Taligent, Inc.
+*/
+
+import java.util.Locale;
+import java.text.Collator;
+
+// Quick dummy program for printing out test results
+public class FinnishTest extends CollatorTest {
+
+    public static void main(String[] args) throws Exception {
+        new FinnishTest().run(args);
+    }
+
+    /*
+     * Data for TestPrimary()
+     */
+    private static final String[] primarySourceData = {
+        "L\u00E5vi",
+        "wat"
+    };
+
+    private static final String[] primaryTargetData = {
+        "L\u00E4we",
+        "vat"
+    };
+
+    private static final int[] primaryResults = {
+        -1,  0
+    };
+
+    /*
+     * Data for TestTertiary()
+     */
+    private static final String tertiarySourceData[] = {
+        "wat",
+        "vat",
+        "a\u00FCbeck"
+    };
+
+    private static final String tertiaryTargetData[] = {
+        "vat",
+        "way",
+        "axbeck"
+    };
+
+    private static final int[] tertiaryResults = {
+         1, -1,  1
+    };
+
+    public void TestPrimary() {
+        doTest(myCollation, Collator.PRIMARY,
+               primarySourceData, primaryTargetData, primaryResults);
+    }
+
+    public void TestTertiary() {
+        doTest(myCollation, Collator.TERTIARY,
+              tertiarySourceData, tertiaryTargetData, tertiaryResults);
+    }
+
+    private final Collator myCollation = Collator.getInstance(new Locale("fi", "FI", ""));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/FrenchTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @library /java/text/testlib
+ * @summary test French Collation
+ */
+/*
+(C) Copyright Taligent, Inc. 1996 - All Rights Reserved
+(C) Copyright IBM Corp. 1996 - All Rights Reserved
+
+  The original version of this source code and documentation is copyrighted and
+owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These materials are
+provided under terms of a License Agreement between Taligent and Sun. This
+technology is protected by multiple US and International patents. This notice and
+attribution to Taligent may not be removed.
+  Taligent is a registered trademark of Taligent, Inc.
+*/
+
+import java.util.Locale;
+import java.text.Collator;
+
+// Quick dummy program for printing out test results
+public class FrenchTest extends CollatorTest {
+
+    public static void main(String[] args) throws Exception {
+        new FrenchTest().run(args);
+    }
+
+    private static final String[] tertiarySourceData = {
+        "abc",
+        "COTE",
+        "p\u00EAche",
+        "p\u00EAcher",
+        "p\u00E9cher",
+        "p\u00E9cher",
+        "Hello"
+    };
+
+    private static final String[] tertiaryTargetData = {
+        "ABC",
+        "c\u00f4te",
+        "p\u00E9ch\u00E9",
+        "p\u00E9ch\u00E9",
+        "p\u00EAche",
+        "p\u00EAcher",
+        "hellO"
+    };
+
+    private static final int[] tertiaryResults = {
+        -1, -1, -1,  1,  1, -1,  1
+    };
+
+    private static final String[] testData = {
+        "a",
+        "A",
+        "e",
+        "E",
+        "\u00e9",
+        "\u00e8",
+        "\u00ea",
+        "\u00eb",
+        "ea",
+        "x"
+    };
+
+    public void TestTertiary() {
+        doTest(myCollation, Collator.TERTIARY,
+               tertiarySourceData, tertiaryTargetData, tertiaryResults);
+
+        for (int i = 0; i < testData.length-1; i++) {
+            for (int j = i+1; j < testData.length; j++) {
+                doTest(myCollation, testData[i], testData[j], -1);
+            }
+        }
+    }
+
+    private final Collator myCollation = Collator.getInstance(Locale.FRANCE);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/G7Test.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @library /java/text/testlib
+ * @summary test G7 Collation
+ */
+/*
+ *
+ *
+ * (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
+ * (C) Copyright IBM Corp. 1996, 1997 - All Rights Reserved
+ *
+ * Portions copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ *   The original version of this source code and documentation is copyrighted
+ * and owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These
+ * materials are provided under terms of a License Agreement between Taligent
+ * and Sun. This technology is protected by multiple US and International
+ * patents. This notice and attribution to Taligent may not be removed.
+ *   Taligent is a registered trademark of Taligent, Inc.
+ *
+*/
+
+/**
+ * G7 Test cases
+ *
+ * @author     Helena Shih
+ */
+
+import java.text.Collator;
+import java.text.RuleBasedCollator;
+import java.util.Locale;
+
+// G7 test program for printing out test results
+
+public class G7Test extends CollatorTest {
+
+    public static void main(String[] args) throws Exception {
+        new G7Test().run(args);
+    }
+
+    private static final String testCases[] = {
+        "black-birds",              // 0
+        "Pat",                      // 1
+        "p\u00E9ch\u00E9",          // 2
+        "p\u00EAche",               // 3
+        "p\u00E9cher",              // 4
+        "p\u00EAcher",              // 5
+        "Tod",                      // 6
+        "T\u00F6ne",                // 7
+        "Tofu",                     // 8
+        "blackbirds",               // 9
+        "Ton",                      // 10
+        "PAT",                      // 11
+        "blackbird",                // 12
+        "black-bird",               // 13
+        "pat",                      // 14
+        // Additional tests
+        "czar",                     // 15
+        "churo",                    // 16
+        "cat",                      // 17
+        "darn",                     // 18
+        "?",                        // 19
+        "quick",                    // 20
+        "#",                        // 21
+        "&",                        // 22
+        "aardvark",                 // 23
+        "a-rdvark",                 // 24
+        "abbot",                    // 25
+        "coop",                     // 26
+        "co-p",                     // 27
+        "cop",                      // 28
+        "zebra"                     // 29
+    };
+
+    // loop to TOTALTESTSET
+    private static final int[][] G7Results = {
+        { 12, 13,  9,  0, 14,  1, 11,  2,  3,  4,
+           5,  6,  8, 10,  7, 31, 31, 31, 31, 31,
+          31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, // en_US
+        { 12, 13,  9,  0, 14,  1, 11,  2,  3,  4,
+           5,  6,  8, 10,  7, 31, 31, 31, 31, 31,
+          31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, // en_GB
+        { 12, 13,  9,  0, 14,  1, 11,  2,  3,  4,
+           5,  6,  8, 10,  7, 31, 31, 31, 31, 31,
+          31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, // en_CA
+        { 12, 13,  9,  0, 14,  1, 11,  3,  2,  4,
+           5,  6,  8, 10,  7, 31, 31, 31, 31, 31,
+          31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, // fr_FR
+        { 12, 13,  9,  0, 14,  1, 11,  3,  2,  4,
+           5,  6,  8, 10,  7, 31, 31, 31, 31, 31,
+          31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, // fr_CA
+        { 12, 13,  9,  0, 14,  1, 11,  2,  3,  4,
+           5,  6,  8, 10,  7, 31, 31, 31, 31, 31,
+          31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, // de_DE
+        { 12, 13,  9,  0, 14,  1, 11,  2,  3,  4,
+           5,  6,  8, 10,  7, 31, 31, 31, 31, 31,
+          31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, // it_IT
+        { 12, 13,  9,  0, 14,  1, 11,  2,  3,  4,
+           5,  6,  8, 10,  7, 31, 31, 31, 31, 31,
+          31, 31, 31, 31, 31, 31, 31, 31, 31, 31 }, // ja_JP
+    };
+
+    // new table collation with rules "& Z < p, P"
+    // loop to FIXEDTESTSET
+    private static final int[] Test1Results = {
+        12, 13,  9,  0,  6,  8, 10,  7, 14,  1,
+        11,  2,  3,  4,  5, 31, 31, 31, 31, 31,
+        31, 31, 31, 31, 31, 31, 31, 31, 31, 31
+    };
+
+    // new table collation with rules "& C < ch , cH, Ch, CH "
+    // loop to TOTALTESTSET
+    private static final int[] Test2Results = {
+        19, 22, 21, 23, 25, 24, 12, 13,  9,  0,
+        17, 26, 28, 27, 15, 16, 18, 14,  1, 11,
+         2,  3,  4,  5, 20,  6,  8, 10,  7, 29
+    };
+
+    // new table collation with rules
+    //     "& Question-mark ; ? & Hash-mark ; # & Ampersand ; '&'  "
+    // loop to TOTALTESTSET
+    private static final int[] Test3Results = {
+        23, 25, 22, 24, 12, 13,  9,  0, 17, 16,
+        26, 28, 27, 15, 18, 21, 14,  1, 11,  2,
+         3,  4,  5, 19, 20,  6,  8, 10,  7, 29
+    };
+
+    // analogous to Japanese rules
+    //     " & aa ; a- & ee ; e- & ii ; i- & oo ; o- & uu ; u- "
+    // loop to TOTALTESTSET
+    private static final int[] Test4Results = {
+        19, 22, 21, 23, 24, 25, 12, 13,  9,  0,
+        17, 16, 26, 27, 28, 15, 18, 14,  1, 11,
+         2,  3,  4,  5, 20,  6,  8, 10,  7, 29
+    };
+
+    public void TestG7Data() {
+        for (int i = 0; i < locales.length; i++) {
+            Collator myCollation= null;
+            RuleBasedCollator tblColl1 = null;
+
+            try {
+                myCollation = Collator.getInstance(locales[i]);
+                tblColl1 = new RuleBasedCollator(((RuleBasedCollator)myCollation).getRules());
+            } catch (Exception foo) {
+                errln("Exception: " + foo.getMessage() +
+                      " Locale : " + locales[i].getDisplayName() +
+                      " getRules failed\n");
+                continue;
+            }
+            for (int j = 0; j < FIXEDTESTSET; j++) {
+                for (int n = j+1; n < FIXEDTESTSET; n++) {
+                    doTest(tblColl1, testCases[G7Results[i][j]],
+                           testCases[G7Results[i][n]], -1);
+                }
+            }
+            myCollation = null;
+        }
+    }
+
+    /*
+     * Demo Test 1 : Create a new table collation with rules "& Z < p, P"
+     */
+    public void TestDemoTest1() {
+        int j = 0;
+        final Collator myCollation = Collator.getInstance(Locale.US);
+        final String defRules = ((RuleBasedCollator)myCollation).getRules();
+        RuleBasedCollator tblColl = null;
+        String newRules = defRules + " & Z < p, P";
+
+        try {
+            tblColl = new RuleBasedCollator(newRules);
+            for (j = 0; j < FIXEDTESTSET; j++) {
+                for (int n = j+1; n < FIXEDTESTSET; n++) {
+                    doTest(tblColl, testCases[Test1Results[j]],
+                           testCases[Test1Results[n]], -1);
+                }
+            }
+            tblColl = null;
+        } catch (Exception foo) {
+            errln("Exception: " + foo.getMessage() +
+                  "\nDemo Test 1 Table Collation object creation failed.");
+        }
+    }
+
+    /*
+     * Demo Test 2 : Create a new table collation with rules
+     *     "& C < ch , cH, Ch, CH"
+     */
+    public void TestDemoTest2() {
+        final Collator myCollation = Collator.getInstance(Locale.US);
+        final String defRules = ((RuleBasedCollator)myCollation).getRules();
+        String newRules = defRules + "& C < ch , cH, Ch, CH";
+
+        try {
+            RuleBasedCollator tblColl = new RuleBasedCollator(newRules);
+            for (int j = 0; j < TOTALTESTSET; j++) {
+                for (int n = j+1; n < TOTALTESTSET; n++) {
+                    doTest(tblColl, testCases[Test2Results[j]],
+                           testCases[Test2Results[n]], -1);
+                }
+            }
+        } catch (Exception foo) {
+            errln("Exception: " + foo.getMessage() +
+                  "\nDemo Test 2 Table Collation object creation failed.\n");
+        }
+    }
+
+    /*
+     * Demo Test 3 : Create a new table collation with rules
+     *     "& Question'-'mark ; '?' & Hash'-'mark ; '#' & Ampersand ; '&'"
+     */
+    public void TestDemoTest3() {
+        final Collator myCollation = Collator.getInstance(Locale.US);
+        final String defRules = ((RuleBasedCollator)myCollation).getRules();
+        RuleBasedCollator tblColl = null;
+        String newRules = defRules + "& Question'-'mark ; '?' & Hash'-'mark ; '#' & Ampersand ; '&";
+
+        try {
+            tblColl = new RuleBasedCollator(newRules);
+            for (int j = 0; j < TOTALTESTSET; j++) {
+                for (int n = j+1; n < TOTALTESTSET; n++) {
+                    doTest(tblColl, testCases[Test3Results[j]],
+                           testCases[Test3Results[n]], -1);
+                }
+            }
+        } catch (Exception foo) {
+            errln("Exception: " + foo.getMessage() +
+                  "\nDemo Test 3 Table Collation object creation failed.");
+        }
+    }
+
+    /*
+     * Demo Test 4 : Create a new table collation with rules
+     *     " & aa ; a'-' & ee ; e'-' & ii ; i'-' & oo ; o'-' & uu ; u'-' "
+     */
+    public void TestDemoTest4() {
+        final Collator myCollation = Collator.getInstance(Locale.US);
+        final String defRules = ((RuleBasedCollator)myCollation).getRules();
+        RuleBasedCollator tblColl = null;
+        String newRules = defRules + " & aa ; a'-' & ee ; e'-' & ii ; i'-' & oo ; o'-' & uu ; u'-' ";
+
+        try {
+            tblColl = new RuleBasedCollator(newRules);
+            for (int j = 0; j < TOTALTESTSET; j++) {
+                for (int n = j+1; n < TOTALTESTSET; n++) {
+                    doTest(tblColl, testCases[Test4Results[j]],
+                           testCases[Test4Results[n]], -1);
+                }
+            }
+        } catch (Exception foo) {
+            errln("Exception: " + foo.getMessage() +
+                  "\nDemo Test 4 Table Collation object creation failed.");
+        }
+        tblColl = null;
+    }
+
+    private static final int FIXEDTESTSET = 15;
+    private static final int TOTALTESTSET = 30;
+
+    private static final Locale locales[] = {
+        Locale.US,
+        Locale.UK,
+        Locale.CANADA,
+        Locale.FRANCE,
+        Locale.CANADA_FRENCH,
+        Locale.GERMANY,
+        Locale.JAPAN,
+        Locale.ITALY
+    };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/GermanTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @library /java/text/testlib
+ * @summary test German Collation
+ */
+/*
+(C) Copyright Taligent, Inc. 1996 - All Rights Reserved
+(C) Copyright IBM Corp. 1996 - All Rights Reserved
+
+  The original version of this source code and documentation is copyrighted and
+owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These materials are
+provided under terms of a License Agreement between Taligent and Sun. This
+technology is protected by multiple US and International patents. This notice and
+attribution to Taligent may not be removed.
+  Taligent is a registered trademark of Taligent, Inc.
+*/
+
+import java.util.Locale;
+import java.text.Collator;
+
+// Quick dummy program for printing out test results
+public class GermanTest extends CollatorTest {
+
+    public static void main(String[] args) throws Exception {
+        new GermanTest().run(args);
+    }
+
+    /*
+     * Shared data for TestPrimary() and TestTertiary()
+     */
+    private static final String testSourceData[] = {
+        "Gr\u00F6\u00DFe",
+        "abc",
+        "T\u00F6ne",
+        "T\u00F6ne",
+        "T\u00F6ne",
+        "a\u0308bc",
+        "\u00E4bc",
+        "\u00E4bc",
+        "Stra\u00DFe",
+        "efg",
+        "\u00E4bc",
+        "Stra\u00DFe"
+    };
+
+    private static final String testTargetData[] = {
+        "Grossist",
+        "a\u0308bc",
+        "Ton",
+        "Tod",
+        "Tofu",
+        "A\u0308bc",
+        "a\u0308bc",
+        "aebc",
+        "Strasse",
+        "efg",
+        "aebc",
+        "Strasse"
+    };
+
+    /*
+     * Data for TestPrimary()
+     */
+    private static final int[] primaryResults = {
+        -1,  0,  1,  1,  1,  0,  0, -1,  0,  0,
+        -1,  0
+    };
+
+    /*
+     * Data for TestTertiary()
+     */
+    private static final int[] tertiaryResults = {
+        -1, -1,  1,  1,  1, -1,  0, -1,  1,  0,
+        -1,  1
+    };
+
+    public void TestPrimary() {
+        doTest(myCollation, Collator.PRIMARY,
+               testSourceData, testTargetData, primaryResults);
+    }
+
+    public void TestTertiary() {
+        doTest(myCollation, Collator.TERTIARY,
+               testSourceData, testTargetData, tertiaryResults);
+    }
+
+    private final Collator myCollation = Collator.getInstance(Locale.GERMAN);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/IteratorTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4062985 4108758 4108762 4157299
+ * @library /java/text/testlib
+ * @summary Test CollationElementIterator, particularly the new methods in 1.2
+ */
+/*
+ * (C) Copyright IBM Corp. 1998 - All Rights Reserved
+ *
+ * The original version of this source code and documentation is copyrighted
+ * and owned by IBM, Inc. These materials are provided under terms of a
+ * License Agreement between IBM and Sun. This technology is protected by
+ * multiple US and International patents. This notice and attribution to IBM
+ * may not be removed.
+ */
+
+import java.util.Locale;
+import java.text.*;
+
+public class IteratorTest extends CollatorTest {
+    // TODO:
+    //  - Test previous() with contracting character sequences, which don't work
+    //      at the moment.
+    //  - Test edge cases on setOffset(), e.g. offset > length, etc.
+    //
+    public static void main(String[] args) throws Exception {
+        new IteratorTest().run(args);
+    }
+
+    /**
+     * Test for CollationElementIterator.previous()
+     *
+     * @bug 4108758 - Make sure it works with contracting characters
+     *
+     */
+    public void TestPrevious() throws ParseException {
+        // A basic test to see if it's working at all
+        backAndForth(en_us.getCollationElementIterator(test1));
+
+        // Test with a contracting character sequence
+        RuleBasedCollator c1 = new RuleBasedCollator(
+            "< a,A < b,B < c,C, d,D < z,Z < ch,cH,Ch,CH" );
+
+        backAndForth(c1.getCollationElementIterator("abchdcba"));
+
+        // Test with an expanding character sequence
+        RuleBasedCollator c2 = new RuleBasedCollator(
+            "< a < b < c/abd < d" );
+
+        backAndForth(c2.getCollationElementIterator("abcd"));
+
+        // Now try both
+        RuleBasedCollator c3 = new RuleBasedCollator(
+            "< a < b < c/aba < d < z < ch" );
+
+        backAndForth(c3.getCollationElementIterator("abcdbchdc"));
+    }
+
+    /**
+     * Test for getOffset() and setOffset()
+     */
+    public void TestOffset() {
+        CollationElementIterator iter = en_us.getCollationElementIterator(test1);
+
+        // Run all the way through the iterator, then get the offset
+        int orders[] = getOrders(iter);
+
+        int offset = iter.getOffset();
+        if (offset != test1.length()) {
+            System.out.println("offset at end != length: "
+                                + offset + " vs " + test1.length());
+        }
+
+        // Now set the offset back to the beginning and see if it works
+        iter.setOffset(0);
+        assertEqual(iter, en_us.getCollationElementIterator(test1));
+
+        // TODO: try iterating halfway through a messy string.
+    }
+
+    /**
+     * Test for setText()
+     */
+    public void TestSetText() {
+        CollationElementIterator iter1 = en_us.getCollationElementIterator(test1);
+        CollationElementIterator iter2 = en_us.getCollationElementIterator(test2);
+
+        // Run through the second iterator just to exercise it
+        int c = iter2.next();
+        int i = 0;
+        while ( ++i < 10 && c != CollationElementIterator.NULLORDER) {
+            c = iter2.next();
+        }
+
+        // Now set it to point to the same string as the first iterator
+        iter2.setText(test1);
+        assertEqual(iter1, iter2);
+    }
+
+    /** @bug 4108762
+     * Test for getMaxExpansion()
+     */
+    public void TestMaxExpansion() throws ParseException {
+        // Try a simple one first:
+        // The only expansion ends with 'e' and has length 2
+        String[][] test1 = {
+            { "< a & ae = \u00e4 < b < e", "" },
+            { "a",  "1" },
+            { "b",  "1" },
+            { "e",  "2" },
+        };
+        verifyExpansion(test1);
+
+        // Now a more complicated one:
+        //   "a1" --> "ae"
+        //   "z" --> "aeef"
+        //
+        String[][] test2 = {
+            { "< a & ae = a1 & aeef = z < b < e < f", "" },
+            { "a",  "1" },
+            { "b",  "1" },
+            { "e",  "2" },
+            { "f",  "4" },
+        };
+        verifyExpansion(test2);
+    }
+
+    /*
+     * @bug 4157299
+     */
+    public void TestClearBuffers() throws ParseException {
+        RuleBasedCollator c = new RuleBasedCollator("< a < b < c & ab = d");
+        CollationElementIterator i = c.getCollationElementIterator("abcd");
+        int e0 = i.next();   // save the first collation element
+        i.setOffset(3);      // go to the expanding character
+        i.next();            // but only use up half of it
+        i.setOffset(0);      // go back to the beginning
+        int e = i.next();    // and get this one again
+        if (e != e0) {
+           errln("got " + Integer.toString(e, 16) + ", expected " +
+                       Integer.toString(e0, 16));
+        }
+    }
+
+    //------------------------------------------------------------------------
+    // Internal utilities
+    //
+
+    private void backAndForth(CollationElementIterator iter) {
+        // Run through the iterator forwards and stick it into an array
+        int [] orders = getOrders(iter);
+
+        // Now go through it backwards and make sure we get the same values
+        int index = orders.length;
+        int o;
+
+        while ((o = iter.previous()) != CollationElementIterator.NULLORDER) {
+            if (o != orders[--index]) {
+                errln("Mismatch at index " + index + ": "
+                        + orders[index] + " vs " + o);
+                break;
+            }
+        }
+        if (index != 0) {
+            errln("Didn't get back to beginning - index is " + index);
+
+            iter.reset();
+            err("next: ");
+            while ((o = iter.next()) != NULLORDER) {
+                err( Integer.toHexString(o) + " ");
+            }
+            errln("");
+
+            err("prev: ");
+            while ((o = iter.previous()) != NULLORDER) {
+                 err( Integer.toHexString(o) + " ");
+            }
+            errln("");
+        }
+    }
+
+    /**
+     * Verify that getMaxExpansion works on a given set of collation rules
+     *
+     * The first row of the "tests" array contains the collation rules
+     * at index 0, and the string at index 1 is ignored.
+     *
+     * Subsequent rows of the array contain a character and a number, both
+     * represented as strings.  The character's collation order is determined,
+     * and getMaxExpansion is called for that character.  If its value is
+     * not equal to the specified number, an error results.
+     */
+    private void verifyExpansion(String[][] tests) throws ParseException
+    {
+        RuleBasedCollator coll = new RuleBasedCollator(tests[0][0]);
+        CollationElementIterator iter = coll.getCollationElementIterator("");
+
+        for (int i = 1; i < tests.length; i++) {
+            // First get the collation key that the test string expands to
+            iter.setText(tests[i][0]);
+
+            int order = iter.next();
+
+            if (order == NULLORDER || iter.next() != NULLORDER) {
+                iter.reset();
+                errln("verifyExpansion: '" + tests[i][0] +
+                    "' has multiple orders:" + orderString(iter));
+            }
+
+            int expansion = iter.getMaxExpansion(order);
+            int expect = new Integer(tests[i][1]).intValue();
+
+            if (expansion != expect) {
+                errln("expansion for '" + tests[i][0] + "' is wrong: " +
+                    "expected " + expect + ", got " + expansion);
+            }
+        }
+    }
+
+    /**
+     * Return an integer array containing all of the collation orders
+     * returned by calls to next on the specified iterator
+     */
+    private int[] getOrders(CollationElementIterator iter)
+    {
+        int maxSize = 100;
+        int size = 0;
+        int[] orders = new int[maxSize];
+
+        int order;
+        while ((order = iter.next()) != NULLORDER) {
+            if (size == maxSize) {
+                maxSize *= 2;
+                int[] temp = new int[maxSize];
+                System.arraycopy(orders, 0, temp, 0, size);
+                orders = temp;
+            }
+            orders[size++] = order;
+        }
+
+        if (orders.length > size) {
+            int[] temp = new int[size];
+            System.arraycopy(orders, 0, temp, 0, size);
+            orders = temp;
+        }
+        return orders;
+    };
+
+    /**
+     * Return a string containing all of the collation orders
+     * returned by calls to next on the specified iterator
+     */
+    private String orderString(CollationElementIterator iter) {
+        StringBuffer buf = new StringBuffer();
+
+        int order;
+        while ((order = iter.next()) != NULLORDER) {
+            buf.append( Integer.toHexString(order) + " ");
+        }
+        return buf.toString();
+    }
+
+    static final private int NULLORDER = CollationElementIterator.NULLORDER;
+    RuleBasedCollator en_us = (RuleBasedCollator)Collator.getInstance(Locale.US);
+
+    String test1 = "What subset of all possible test cases?";
+    String test2 = "has the highest probability of detecting";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/JapaneseTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,324 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test 1.1 02/09/11
+ * @bug 4176141 4655819
+ * @summary Regression tests for Japanese Collation
+ */
+
+import java.text.*;
+import java.util.*;
+
+public class JapaneseTest {
+
+    // NOTE:
+    //   Golden data in this test case is locale data dependent and
+    //   may need to be changed if the Japanese locale collation rules
+    //   are changed.
+
+    /*
+     *                    | NO_DECOMP(default) | CANONICAL_DECOMP | FULL_DECOMP
+     * -------------------+--------------------+------------------+-------------
+     *  PRIMARY           | s1 < s2 (-1)       | s1 < s2 (-1)     | s1 < s2 (-1)
+     *  SECONDARY         | s1 < s2 (-1)       | s1 < s2 (-1)     | s1 < s2 (-1)
+     *  TERTIARY(default) | S1 < s2 (-1)       | s1 < s2 (-1)     | s1 < s2 (-1)
+     */
+    static final int[][] results1 = {
+        { -1, -1, -1},
+        { -1, -1, -1},
+        { -1, -1, -1},
+    };
+    static final String[][] compData1 = {
+        /*
+         * Data to verify '<' relationship in LocaleElements_ja.java
+         */
+        {"\u3084", "\u30E6",
+         "Hiragana \"YA\"(0x3084) <---> Katakana \"YU\"(0x30E6)"},
+        {"\u30E6", "\u3088",
+         "Katakana \"YU\"(0x30E6) <---> Hiragana \"YO\"(0x3088)"},
+        {"\u00B1", "\u2260",
+         "Plus-Minus Sign(0x00B1) <---> Not Equal To(0x2260)"},
+        {"\u3011", "\u2260",
+         "Right Black Lenticular Bracket(0x3011) <---> Not Equal To(0x2260)"},
+        {"\u2260", "\u2103",
+         "Not Equal To(0x2260) <---> Degree Celsius(0x2103)"},
+        {"\u2260", "\u2606",
+         "Not Equal To(0x2260) <---> White Star(0x2606)"},
+        {"\u30FD", "\u309E",
+         "Katakana Iteration Mark(0x30FD) <---> Hiragana Voiced Iteration Mark(0x309E)"},
+        {"\u3059\u309D", "\u3059\u309E",
+         "Hiragana \"SU\"(0x3059)Hiragana Iteration Mark(0x309D) <---> Hiragana \"SU\"(0x3059)Hiragana Voiced Iteration Mark(0x309E)"},
+        {"\u821E", "\u798F",
+         "CJK Unified Ideograph(0x821E) <---> CJK Unified Ideograph(0x798F)"},
+
+        /*
+         * Data to verify normalization
+         */
+        {"\u2260", "\u225F",
+         "Not Equal To(0x2260) <---> Questioned Equal To(0x225F)"},
+        {"\u226E", "\u2260",
+         "Not Less-than(0x226E) <---> Not Equal To(0x2260)"},
+        {"\u226E", "\u226D",
+         "Not Less-than(0x226E) <---> Not Equivalent To(0x226D)"},
+    };
+
+    /*
+     *                    | NO_DECOMP(default) | CANONICAL_DECOMP | FULL_DECOMP
+     * -------------------+--------------------+------------------+-------------
+     *  PRIMARY           | s1 = s2 (0)        | s1 = s2 (0)      | s1 = s2 (0)
+     *  SECONDARY         | s1 < s2 (-1)       | s1 < s2 (-1)     | s1 < s2 (-1)
+     *  TERTIARY(default) | S1 < s2 (-1)       | s1 < s2 (-1)     | s1 < s2 (-1)
+     */
+    static final int[][] results2 = {
+        {  0,  0,  0},
+        { -1, -1, -1},
+        { -1, -1, -1},
+    };
+    static final String[][] compData2 = {
+        /*
+         * Data to verify ';' relationship in LocaleElements_ja.java
+         */
+        {"\u3099", "\u309A",
+         "Combining Katakana-Hiragana Voiced Sound Mark(0x3099) <---> Combining Katakana-Hiragana Semi-voiced Sound Mark(0x309A)"},
+        {"\u3053\u3046\u3068\u3046", "\u3053\u3046\u3068\u3099\u3046",
+         "Hiragana \"KOUTOU\"(0x3053 0x3046 0x3068 0x3046) <---> Hiragana \"KOUTO\"(0x3053 0x3046 0x3068)Combining Katakana-Hiragana Voiced Sound Mark(0X3099)\"U\"(0x3046)"},
+        {"\u3053\u3046\u3068\u3046", "\u3053\u3046\u3069\u3046",
+         "Hiragana \"KOUTOU\"(0x3053 0x3046 0x3068 0x3046) <---> Hiragana \"KOUDOU\"(0x3053 0x3046 0x3069 0x3046)"},
+        {"\u3053\u3046\u3069\u3046", "\u3054\u3046\u3068\u3046",
+         "Hiragana \"KOUTOU\"(0x3053 0x3046 0x3069 0x3046) <---> Hiragana \"GOUTOU\"(0x3054 0x3046 0x3068 0x3046)"},
+        {"\u3054\u3046\u3068\u3046", "\u3054\u3046\u3069\u3046",
+         "Hiragana \"GOUTOU\"(0x3054 0x3046 0x3068 0x3046) <---> Hiragana \"GOUDOU\"(0x3054 0x3046 0x3069 0x3046)"},
+    };
+
+    /*
+     *                    | NO_DECOMP(default) | CANONICAL_DECOMP | FULL_DECOMP
+     * -------------------+--------------------+------------------+-------------
+     *  PRIMARY           | s1 = s2 (0)        | s1 = s2 (0)      | s1 = s2 (0)
+     *  SECONDARY         | s1 = s2 (0)        | s1 = s2 (0)      | s1 = s2 (0)
+     *  TERTIARY(default) | S1 < s2 (-1)       | s1 < s2 (-1)     | s1 < s2 (-1)
+     */
+    static final int[][] results3 = {
+        {  0,  0,  0},
+        {  0,  0,  0},
+        { -1, -1, -1},
+    };
+    static final String[][] compData3 = {
+        /*
+         * Data to verify ',' relationship in LocaleElements_ja.java
+         */
+        {"\u3042", "\u3041",
+         "Hiragana \"A\"(0x3042) <---> Hiragana \"a\"(0x3041)"},
+        {"\u3041", "\u30A2",
+         "Hiragana \"a\"(0x3041) <---> Katakana \"A\"(0x30A2)"},
+        {"\u30A2", "\u30A1",
+         "Katakana \"A\"(0x30A2) <---> Katakana \"a\"(0x30A1)"},
+        {"\u3094", "\u30F4",
+         "Hiragana \"VU\"(0x3094) <---> Katakana \"VU\"(0x30F4)"},
+        {"\u3094", "\u30A6\u3099",
+         "Hiragana \"VU\"(0x3094) <---> Katakana \"U\"(0x30A6)Combining Katakana-Hiragana Voiced Sound Mark(0x3099)"},
+        {"\u3046\u3099", "\u30F4",
+         "Hiragana \"U\"(0x3046)Combining Katakana-Hiragana Voiced Sound Mark(0x3099) <---> Katakana \"VU\"(0x30F4)"},
+        {"\u3046\u3099", "\u30A6\u3099",
+         "Hiragana \"U\"(0x3046)Combining Katakana-Hiragana Voiced Sound Mark(0x3099) <---> Katakana \"U\"(0x30A6)Combining Katakana-Hiragana Voiced Sound Mark(0x3099)"},
+        {"\u30AB\u30A2", "\u30AB\u30FC",
+         "Katakana \"KAA\"(0x30AB 0x30A2) <---> Katakana \"KA-\"(0x30AB 0x30FC)"},
+        {"\u30CB\u30A1\u30A2", "\u30CB\u30A1\u30FC",
+         "Katakana \"NyaA\"(0x30CB 0x30A1 0x30A2) <---> Katakana \"Nya-\"(0x30CB 0x30A1 0x30FC)"},
+        {"\u30B3\u30AA\u30D2\u30A4", "\u30B3\u30FC\u30D2\u30FC",
+         "Katakana \"KOOHII\"(0x30B3 0x30AA 0x30D2 0x30A4) <---> Katakana \"KO-HI-\"(0x30B3 0x30FC 0x30D2 0x30FC)"},
+        {"\u308A\u3088\u3046", "\u308A\u3087\u3046",
+         "Hiragana \"RIYOU\"(0x308A 0x3088 0x3046) <---> Hiragana \"Ryou\"(0x308A 0x3087 0x3046)"},
+        {"\u3081\u3064\u304D", "\u3081\u3063\u304D",
+         "Hiragana \"METSUKI\"(0x3081 0x3064 0x304D) <---> Hiragana \"MEKKI\"(0x3081 0x3063 0x304D)"},
+        {"\u3075\u3042\u3093", "\u30D5\u30A1\u30F3",
+         "Hiragana \"FUAN\"(0x3075 0x3042 0x3093) <---> Katakana \"FUaN\"(0x30D5 0x30A1 0x30F3)"},
+        {"\u3075\u3041\u3093", "\u30D5\u30A2\u30F3",
+         "Hiragana \"FUaN\"(0x3075 0x3041 0x3093) <---> Katakana \"FUAN\"(0x30D5 0x30A2 0x30F3)"},
+        {"\u30D5\u30A2\u30F3", "\u30D5\u30A1\u30F3",
+         "Katakana \"FUAN\"(0x30D5 0x30A2 0x30F3) <---> Katakana \"FUaN\"(0x30D5 0x30A1 0x30F3)"},
+    };
+
+    /*
+     *                    | NO_DECOMP(default) | CANONICAL_DECOMP | FULL_DECOMP
+     * -------------------+--------------------+------------------+-------------
+     *  PRIMARY           | s1 = s2 (0)        | s1 = s2 (0)      | s1 = s2 (0)
+     *  SECONDARY         | s1 = s2 (0)        | s1 = s2 (0)      | s1 = s2 (0)
+     *  TERTIARY(default) | S1 = s2 (0)        | s1 = s2 (0)      | s1 = s2 (0)
+     */
+    static final int[][] results4 = {
+        {  0,  0,  0},
+        {  0,  0,  0},
+        {  0,  0,  0},
+    };
+    static final String[][] compData4 = {
+        /*
+         * Data to verify Japanese normalization
+         */
+        {"\u309E", "\u309D\u3099",
+         "Hiragana Voiced Iteration Mark(0x309E) <---> Hiragana Iteration Mark(0x309D)Combining Katakana-Hiragana Voiced Sound Mark(0x3099)"},
+        {"\u30FE", "\u30FD\u3099",
+         "Katakana Voiced Iteration Mark(0x30FE) <---> Katakana iteration mark(0x30FD)Combining Katakana-Hiragana Voiced Sound Mark(0x3099)"},
+        {"\u306F\u3099", "\u3070",
+         "Hiragana \"HA\"(0x306F)Combining Katakana-Hiragana Voiced Sound Mark(0x3099) <---> Hiragana \"BA\"(0x3070)"},
+        {"\u306F\u309A", "\u3071",
+         "Hiragana \"HA\"(0x306F)Combining Katakana-Hiragana Semi-voiced Sound Mark(0x309A) <---> Hiragana \"PA\"(0x3071)"},
+        {"\u30EF\u3099", "\u30F7",
+         "Katakana \"WA\"(0x306F)Combining Katakana-Hiragana Voiced Sound Mark(0x3099) <---> Katakana \"VA\"(0x30F7)"},
+        {"\u30F0\u3099", "\u30F8",
+         "Katakana \"WI\"(0x30F0)Combining Katakana-Hiragana Voiced Sound Mark(0x3099) <---> Katakana \"VI\"(0x30F8)"},
+        {"\u30F1\u3099", "\u30F9",
+         "Katakana \"WE\"(0x30F1)Combining Katakana-Hiragana Voiced Sound Mark(0x3099) <---> Katakana \"VE\"(0x30F9)"},
+        {"\u30F2\u3099", "\u30FA",
+         "Katakana \"WO\"(0x30F2)Combining Katakana-Hiragana Voiced Sound Mark(0x3099) <---> Katakana \"VO\"(0x30FA)"},
+        {"\u3046\u3099", "\u3094",
+         "Hiragana \"U\"(0x3046)Combining Katakana-Hiragana Voiced Sound Mark(0x3099) <---> Hiragana \"VU\"(0x3094)"},
+        {"\u30A6\u3099", "\u30F4",
+         "Katakana \"U\"(0x30A6)Combining Katakana-Hiragana Voiced Sound Mark(0x3099) <---> Katakana \"VU\"(0x30F4)"},
+
+        // verify normalization
+        {"\u2260", "\u003D\u0338",
+         "Not Equal To(0x2260) <---> Equal(0x003D)Combining Long Solidus Overlay(0x0338)"},
+        {"\u2262", "\u2261\u0338",
+         "Not Identical To(0x2262) <---> Identical To(0x2261)Combining Long Solidus Overlay(0x0338)"},
+        {"\u226E", "\u003C\u0338",
+         "Not Less-than(0x226E) <---> Less-than Sign(0x003C)Combining Long Solidus Overlay(0x0338)"},
+
+        // Verify a character which has been added since Unicode 2.1.X.
+        {"\u798F", "\uFA1B",
+         "CJK Unified Ideograph \"FUKU\"(0x798F) <---> CJK Compatibility Ideograph \"FUKU\"(0xFA1B)"},
+    };
+
+    /*
+     *                    | NO_DECOMP(default) | CANONICAL_DECOMP | FULL_DECOMP
+     * -------------------+--------------------+------------------+-------------
+     *  PRIMARY           | s1 > s2 (1)        | s1 = s2 (0)      | s1 = s2 (0)
+     *  SECONDARY         | s1 > s2 (1)        | s1 = s2 (0)      | s1 = s2 (0)
+     *  TERTIARY(default) | S1 > s2 (1)        | s1 = s2 (0)      | s1 = s2 (0)
+     */
+    static final int[][] results5 = {
+        {  1,  0,  0},
+        {  1,  0,  0},
+        {  1,  0,  0},
+    };
+    static final String[][] compData5 = {
+        /*
+         * Data to verify normalization
+         */
+        {"\u226D", "\u224D\u0338",
+         "Not Equivalent To(0x226D) <---> Equivalent To(0x224D)Combining Long Solidus Overlay(0x0338)"},
+    };
+
+    static final int[][] results6 = {
+        {  1, -1, -1},
+        {  1, -1, -1},
+        {  1, -1, -1},
+    };
+    static final String[][] compData6 = {
+        /*
+         * Data to verify normalization
+         */
+        {"\u226D", "\u226C",
+         "Not Equivalent To(0x226D) <---> Between(0x226C)"},
+        {"\u226D", "\u225F",
+         "Not Equivalent To(0x226D) <---> Questioned Equal To(0x225F)"},
+    };
+
+
+    /*
+     * The following data isn't used at the moment because iteration marks
+     * aren't supported now.
+     */
+    static final String[][] compData0 = {
+        {"\u307F\u307F", "\u307F\u309D",
+         "Hiragana \"MIMI\"(0x307F 0x307F) <---> Hiragana \"MI\"(0x307F)Hiragana Iteration Mark(0x309D)"},
+        {"\u3044\u3059\u305A", "\u3044\u3059\u309E",
+         "Hiragana \"ISUZU\"(0x3044 0x3059 0x305A) <---> Hiragana \"ISU\"(0x3044 0x3059)Hiragana Voiced Iteration Mark(0x309E)"},
+        {"\u30DF\u30DF", "\u30DF\u30FD",
+         "Katakana \"MIMI\"(0x30DF 0x30DF) <---> Katakana \"MI\"(0x30DF)Katakana Iteration Mark(0x30FD)"},
+        {"\u30A4\u30B9\u30BA", "\u30A4\u30B9\u30FE",
+         "Katakana \"ISUZU\"(0x30A4 0x30B9 0x30BA) <---> Katakana \"ISU\"(0x30A4 0x30B9)Katakana Voiced Iteration Mark(0x30FE)"},
+    };
+
+
+    static final String[] decomp_name = {
+        "NO_DECOMP", "CANONICAL_DECOMP", "FULL_DECOMP"
+    };
+
+    static final String[] strength_name = {
+        "PRIMARY", "SECONDARY", "TERTIARY"
+    };
+
+
+    Collator col = Collator.getInstance(Locale.JAPAN);
+    int result = 0;
+
+    public static void main(String[] args) throws Exception {
+        new JapaneseTest().run();
+    }
+
+    public void run() {
+        // Use all available localse on the initial testing....
+        // Locale[] locales = Locale.getAvailableLocales();
+        Locale[] locales = { Locale.getDefault() };
+
+        for (int l = 0; l < locales.length; l++) {
+            Locale.setDefault(locales[l]);
+
+            for (int decomp = 0; decomp < 3; decomp++) {// See decomp_name.
+                col.setDecomposition(decomp);
+
+                for (int strength = 0; strength < 3; strength++) {// See strength_name.
+//                  System.err.println("\n" + locales[l] + ": " + strength_name[strength] + " --- " + decomp_name[decomp]);
+
+                    col.setStrength(strength);
+                    doCompare(compData1, results1[strength][decomp], strength, decomp);
+                    doCompare(compData2, results2[strength][decomp], strength, decomp);
+                    doCompare(compData3, results3[strength][decomp], strength, decomp);
+                    doCompare(compData4, results4[strength][decomp], strength, decomp);
+                    doCompare(compData5, results5[strength][decomp], strength, decomp);
+                    doCompare(compData6, results6[strength][decomp], strength, decomp);
+                }
+            }
+        }
+
+        /* Check result */
+        if (result !=0) {
+            throw new RuntimeException("Unexpected results on Japanese collation.");
+        }
+    }
+
+    void doCompare(String[][] s, int expectedValue, int strength, int decomp) {
+        int value;
+        for (int i=0; i < s.length; i++) {
+            if ((value = col.compare(s[i][0], s[i][1])) != expectedValue) {
+                result++;
+                System.err.println(strength_name[strength] +
+                                   ": compare() returned unexpected value.(" +
+                                   value + ") on " + decomp_name[decomp] +
+                                   "     Expected(" + expectedValue +
+                                   ") for " + s[i][2]);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/KoreanTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test 1.1 02/09/12
+ * @bug 4176141 4655819
+ * @summary Regression tests for Korean Collation
+ */
+
+import java.text.*;
+import java.util.*;
+
+public class KoreanTest {
+
+    // NOTE:
+    //   Golden data in this test case is locale data dependent and
+    //   may need to be changed if the Korean locale collation rules
+    //   are changed.
+
+    // And, CollationDecomp has been set to 0(NO_DECOMPOSITION) in
+    // LocaleElements_ko.java.
+    // This is very important to consider what is correct behavior in
+    // Korean Collator. Sometimes different from other locales.
+
+    /*
+     * TERTIARY(default): s1 < s2,  SECONDARY: s1 < s2,  PRIMARY: s1 < s2
+     */
+    static final String[][] compData1 = {
+        /*
+         * Data to verify '<' relationship in LocaleElements_ja.java
+         */
+        {"\uACE0\uC591\uC774", "\u732B",
+         "Hangul \"Cat\"(0xACE0 0xC591 0xC774) <---> Chinese Kanji \"Cat\"(0x732B)"},
+        {"\u30FB", "\u2025",
+         "Katakana middle dot(0x30FB) <---> Two dot leader(0x2025)"},
+
+        {"\u00B1", "\u2260",
+         "Plus-Minus Sign(0x00B1) <---> Not Equal To(0x2260)"},
+        {"\u3011", "\u2260",
+         "Right Black Lenticular Bracket(0x3011) <---> Not Equal To(0x2260)"},
+        {"\u2260", "\u2103",
+         "Not Equal To(0x2260) <---> Degree Celsius(0x2103)"},
+        {"\u2260", "\u2606",
+         "Not Equal To(0x2260) <---> White Star(0x2606)"},
+
+        // Unlike other locales' Collator, compare() returns -1 because of
+        // NO_DECOMPOSITION.
+        /* above "assumption" is no longer true, now we do normalize ("decomposition")
+           for the pattern in ko locale, but exclude those hangul syllables, so the
+           test case below need to be excluded from tiger/1.5
+        {"\u003D\u0338", "\u2260",
+         "Equal(0x003D)Combining Long Solidus Overlay(0x0338) <---> Not Equal To(0x2260)"},
+         */
+    };
+
+    /*
+     * TERTIARY(default): s1 = s2,  SECONDARY: s1 = s2,  PRIMARY: s1 = s2
+     */
+    static final String[][] compData2 = {
+        // Verify a character which has been added since Unicode 2.1.X.
+        {"\u798F", "\uFA1B",
+         "CJK Unified Ideograph \"FUKU\"(0x798F) <---> CJK Compatibility Ideograph \"FUKU\"(0xFA1B)"},
+
+    };
+
+    Collator col = Collator.getInstance(Locale.KOREA);
+    int result = 0;
+
+    public static void main(String[] args) throws Exception {
+        new KoreanTest().run();
+    }
+
+    public void run() {
+        //
+        // Test for TERTIARY(default)
+        //
+        doCompare(compData1);
+        doEquals(compData2);
+
+        //
+        // Test for SECONDARY
+        //
+        col.setStrength(Collator.SECONDARY);
+        doCompare(compData1);
+        doEquals(compData2);
+
+        //
+        // Test for PRIMARY
+        //
+        col.setStrength(Collator.PRIMARY);
+        doCompare(compData1);
+        doEquals(compData2);
+
+        if (result !=0) {
+            throw new RuntimeException("Unexpected results on Korean collation.");
+        }
+    }
+
+    /* compare() should return -1 for each combination. */
+    void doCompare(String[][] s) {
+        int value;
+        for (int i=0; i < s.length; i++) {
+            if ((value = col.compare(s[i][0], s[i][1])) > -1) {
+                result++;
+                System.err.println("TERTIARY: The first string should be less than the second string:  " +
+                    s[i][2] + "  compare() returned " + value + ".");
+            }
+        }
+    }
+
+    /* equals() should return true for each combination. */
+    void doEquals(String[][] s) {
+        for (int i=0; i < s.length; i++) {
+            if (!col.equals(s[i][0], s[i][1])) {
+                result++;
+                System.err.println("TERTIARY: The first string should be equals to the second string:  " +
+                    s[i][2] + "  compare() returned " +
+                    col.compare(s[i][0], s[i][1] + "."));
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/MonkeyTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @library /java/text/testlib
+ * @summary test Collation, Monkey style
+ */
+/*
+(C) Copyright Taligent, Inc. 1996 - All Rights Reserved
+(C) Copyright IBM Corp. 1996 - All Rights Reserved
+
+  The original version of this source code and documentation is copyrighted and
+owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These materials are
+provided under terms of a License Agreement between Taligent and Sun. This
+technology is protected by multiple US and International patents. This notice and
+attribution to Taligent may not be removed.
+  Taligent is a registered trademark of Taligent, Inc.
+*/
+
+import java.io.IOException;
+import java.util.Random;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.util.Locale;
+import java.text.Collator;
+import java.text.RuleBasedCollator;
+import java.text.CollationKey;
+
+public class MonkeyTest extends CollatorTest
+{
+    public static void main(String[] args) throws Exception {
+        new MonkeyTest().run(args);
+    }
+
+    public void report(String s, String t, int result, int revResult)
+    {
+        if (result == -1)
+        {
+            if (revResult != 1)
+                errln(" --> Test Failed");
+        }
+        else if (result == 1)
+        {
+            if (revResult != -1)
+                errln(" --> Test Failed");
+        }
+        else if (result == 0)
+        {
+            if (revResult != 0)
+                errln(" --> Test Failed");
+        }
+    }
+
+    public void TestCollationKey()
+    {
+        String source = "-abcdefghijklmnopqrstuvwxyz#&^$@";
+        Random r = new Random(3);
+        int s = checkValue(r.nextInt() % source.length());
+        int t = checkValue(r.nextInt() % source.length());
+        int slen = checkValue((r.nextInt() - source.length()) % source.length());
+        int tlen = checkValue((r.nextInt() - source.length()) % source.length());
+        String subs = source.substring((s > slen ? slen : s), (s >= slen ? s : slen));
+        String subt = source.substring((t > tlen ? tlen : t), (t >= tlen ? t : tlen));
+        myCollator.setStrength(Collator.TERTIARY);
+        CollationKey CollationKey1 = myCollator.getCollationKey(subs);
+        CollationKey CollationKey2 = myCollator.getCollationKey(subt);
+        int result = CollationKey1.compareTo(CollationKey2);  // Tertiary
+        int revResult = CollationKey2.compareTo(CollationKey1);  // Tertiary
+        report(("CollationKey(" + subs + ")"), ("CollationKey(" + subt + ")"), result, revResult);
+        myCollator.setStrength(Collator.SECONDARY);
+        CollationKey1 = myCollator.getCollationKey(subs);
+        CollationKey2 = myCollator.getCollationKey(subt);
+        result = CollationKey1.compareTo(CollationKey2);  // Secondary
+        revResult = CollationKey2.compareTo(CollationKey1);   // Secondary
+        report(("CollationKey(" + subs + ")") , ("CollationKey(" + subt + ")"), result, revResult);
+        myCollator.setStrength(Collator.PRIMARY);
+        CollationKey1 = myCollator.getCollationKey(subs);
+        CollationKey2 = myCollator.getCollationKey(subt);
+        result = CollationKey1.compareTo(CollationKey2);  // Primary
+        revResult = CollationKey2.compareTo(CollationKey1);   // Primary
+        report(("CollationKey(" + subs + ")"), ("CollationKey(" + subt + ")"), result, revResult);
+        String addOne = subs + "\uE000";
+        CollationKey1 = myCollator.getCollationKey(subs);
+        CollationKey2 = myCollator.getCollationKey(addOne);
+        result = CollationKey1.compareTo(CollationKey2);
+        if (result != -1)
+            errln("CollationKey(" + subs + ")" + ".LT." + "CollationKey(" + addOne + ") Failed.");
+        result = CollationKey2.compareTo(CollationKey1);
+        if (result != 1)
+            errln("CollationKey(" + addOne + ")" + ".GT." + "CollationKey(" + subs + ") Failed.");
+    }
+    private static int checkValue(int value)
+    {
+        value *= (value > 0) ? 1 : -1;
+        return value;
+    }
+    public void TestCompare()
+    {
+        String source = "-abcdefghijklmnopqrstuvwxyz#&^$@";
+        Random r = new Random(3);
+        int s = checkValue(r.nextInt() % source.length());
+        int t = checkValue(r.nextInt() % source.length());
+        int slen = checkValue((r.nextInt() - source.length()) % source.length());
+        int tlen = checkValue((r.nextInt() - source.length()) % source.length());
+        String subs = source.substring((s > slen ? slen : s), (s >= slen ? s : slen));
+        String subt = source.substring((t > tlen ? tlen : t), (t >= tlen ? t : tlen));
+        myCollator.setStrength(Collator.TERTIARY);
+        int result = myCollator.compare(subs, subt);  // Tertiary
+        int revResult = myCollator.compare(subt, subs);  // Tertiary
+        report(subs, subt, result, revResult);
+        myCollator.setStrength(Collator.SECONDARY);
+        result = myCollator.compare(subs, subt);  // Secondary
+        revResult = myCollator.compare(subt, subs);  // Secondary
+        report(subs, subt, result, revResult);
+        myCollator.setStrength(Collator.PRIMARY);
+        result = myCollator.compare(subs, subt);  // Primary
+        revResult = myCollator.compare(subt, subs);  // Primary
+        report(subs, subt, result, revResult);
+        String addOne = subs + "\uE000";
+        result = myCollator.compare(subs, addOne);
+        if (result != -1)
+            errln("Test : " + subs + " .LT. " + addOne + " Failed.");
+        result = myCollator.compare(addOne, subs);
+        if (result != 1)
+            errln("Test : " + addOne + " .GE. " + subs + " Failed.");
+    }
+    private static Collator myCollator = Collator.getInstance();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/Regression.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,940 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 4048446 4051866 4053636 4054238 4054734 4054736 4058613 4059820 4060154
+ *      4062418 4065540 4066189 4066696 4076676 4078588 4079231 4081866 4087241
+ *      4087243 4092260 4095316 4101940 4103436 4114076 4114077 4124632 4132736
+ *      4133509 4139572 4141640 4179126 4179686 4244884 4663220
+ * @library /java/text/testlib
+ * @summary Regression tests for Collation and associated classes
+ */
+/*
+(C) Copyright Taligent, Inc. 1996 - All Rights Reserved
+(C) Copyright IBM Corp. 1996 - All Rights Reserved
+
+  The original version of this source code and documentation is copyrighted and
+owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These materials are
+provided under terms of a License Agreement between Taligent and Sun. This
+technology is protected by multiple US and International patents. This notice and
+attribution to Taligent may not be removed.
+  Taligent is a registered trademark of Taligent, Inc.
+*/
+
+import java.text.*;
+import java.util.Locale;
+import java.util.Vector;
+
+
+public class Regression extends CollatorTest {
+
+    public static void main(String[] args) throws Exception {
+        new Regression().run(args);
+    }
+
+    // CollationElementIterator.reset() doesn't work
+    //
+    public void Test4048446() {
+        CollationElementIterator i1 = en_us.getCollationElementIterator(test1);
+        CollationElementIterator i2 = en_us.getCollationElementIterator(test1);
+
+        while ( i1.next() != CollationElementIterator.NULLORDER ) {
+        }
+        i1.reset();
+
+        assertEqual(i1, i2);
+    }
+
+
+    // Collator -> rules -> Collator round-trip broken for expanding characters
+    //
+    public void Test4051866() throws ParseException {
+        // Build a collator containing expanding characters
+        RuleBasedCollator c1 = new RuleBasedCollator("< o "
+                                                    +"& oe ,o\u3080"
+                                                    +"& oe ,\u1530 ,O"
+                                                    +"& OE ,O\u3080"
+                                                    +"& OE ,\u1520"
+                                                    +"< p ,P");
+
+        // Build another using the rules from  the first
+        RuleBasedCollator c2 = new RuleBasedCollator(c1.getRules());
+
+        // Make sure they're the same
+        if (!c1.getRules().equals(c2.getRules())) {
+            errln("Rules are not equal");
+        }
+    }
+
+    // Collator thinks "black-bird" == "black"
+    //
+    public void Test4053636() {
+        if (en_us.equals("black-bird","black")) {
+            errln("black-bird == black");
+        }
+    }
+
+
+    // CollationElementIterator will not work correctly if the associated
+    // Collator object's mode is changed
+    //
+    public void Test4054238() {
+        RuleBasedCollator c = (RuleBasedCollator) en_us.clone();
+
+        c.setDecomposition(Collator.CANONICAL_DECOMPOSITION);
+        CollationElementIterator i1 = en_us.getCollationElementIterator(test3);
+
+        c.setDecomposition(Collator.NO_DECOMPOSITION);
+        CollationElementIterator i2 = en_us.getCollationElementIterator(test3);
+
+        // At this point, BOTH iterators should use NO_DECOMPOSITION, since the
+        // collator itself is in that mode
+        assertEqual(i1, i2);
+    }
+
+    // Collator.IDENTICAL documented but not implemented
+    //
+    public void Test4054734() {
+        RuleBasedCollator c = (RuleBasedCollator) en_us.clone();
+        try {
+            c.setStrength(Collator.IDENTICAL);
+        }
+        catch (Exception e) {
+            errln("Caught " + e.toString() + " setting Collator.IDENTICAL");
+        }
+
+        String[] decomp = {
+            "\u0001",   "<",    "\u0002",
+            "\u0001",   "=",    "\u0001",
+            "A\u0001",  ">",    "~\u0002",      // Ensure A and ~ are not compared bitwise
+            "\u00C0",   "=",    "A\u0300"       // Decomp should make these equal
+        };
+        c.setDecomposition(Collator.CANONICAL_DECOMPOSITION);
+        compareArray(c, decomp);
+
+        String[] nodecomp = {
+            "\u00C0",   ">",    "A\u0300"       // A-grave vs. A combining-grave
+        };
+        c.setDecomposition(Collator.NO_DECOMPOSITION);
+        compareArray(c, nodecomp);
+    }
+
+    // Full Decomposition mode not implemented
+    //
+    public void Test4054736() {
+        RuleBasedCollator c = (RuleBasedCollator) en_us.clone();
+        c.setDecomposition(Collator.FULL_DECOMPOSITION);
+
+        String[] tests = {
+            "\uFB4f", "=", "\u05D0\u05DC",  // Alef-Lamed vs. Alef, Lamed
+        };
+
+        compareArray(c, tests);
+    }
+
+    // Collator.getInstance() causes an ArrayIndexOutofBoundsException for Korean
+    //
+    public void Test4058613() {
+        // Creating a default collator doesn't work when Korean is the default
+        // locale
+
+        Locale oldDefault = Locale.getDefault();
+
+        Locale.setDefault( Locale.KOREAN );
+        try {
+            Collator c = Collator.getInstance();
+
+            // Since the fix to this bug was to turn of decomposition for Korean collators,
+            // ensure that's what we got
+            if (c.getDecomposition() != Collator.NO_DECOMPOSITION) {
+              errln("Decomposition is not set to NO_DECOMPOSITION");
+            }
+        }
+        finally {
+            Locale.setDefault(oldDefault);
+        }
+    }
+
+    // RuleBasedCollator.getRules does not return the exact pattern as input
+    // for expanding character sequences
+    //
+    public void Test4059820() {
+        RuleBasedCollator c = null;
+        try {
+            c = new RuleBasedCollator("< a < b , c/a < d < z");
+        } catch (ParseException e) {
+            errln("Exception building collator: " + e.toString());
+            return;
+        }
+        if ( c.getRules().indexOf("c/a") == -1) {
+            errln("returned rules do not contain 'c/a'");
+        }
+    }
+
+    // MergeCollation::fixEntry broken for "& H < \u0131, \u0130, i, I"
+    //
+    public void Test4060154() {
+        RuleBasedCollator c = null;
+        try {
+            c = new RuleBasedCollator("< g, G < h, H < i, I < j, J"
+                                      + " & H < \u0131, \u0130, i, I" );
+        } catch (ParseException e) {
+            errln("Exception building collator: " + e.toString());
+            return;
+        }
+        c.setDecomposition(Collator.CANONICAL_DECOMPOSITION);
+
+        String[] tertiary = {
+            "A",        "<",    "B",
+            "H",        "<",    "\u0131",
+            "H",        "<",    "I",
+            "\u0131",   "<",    "\u0130",
+            "\u0130",   "<",    "i",
+            "\u0130",   ">",    "H",
+        };
+        c.setStrength(Collator.TERTIARY);
+        compareArray(c, tertiary);
+
+        String[] secondary = {
+            "H",        "<",    "I",
+            "\u0131",   "=",    "\u0130",
+        };
+        c.setStrength(Collator.PRIMARY);
+        compareArray(c, secondary);
+    };
+
+    // Secondary/Tertiary comparison incorrect in French Secondary
+    //
+    public void Test4062418() throws ParseException {
+        RuleBasedCollator c = (RuleBasedCollator) Collator.getInstance(Locale.FRANCE);
+        c.setStrength(Collator.SECONDARY);
+
+        String[] tests = {
+                "p\u00eache",    "<",    "p\u00e9ch\u00e9",    // Comparing accents from end, p\u00e9ch\u00e9 is greater
+        };
+
+        compareArray(c, tests);
+    }
+
+    // Collator.compare() method broken if either string contains spaces
+    //
+    public void Test4065540() {
+        if (en_us.compare("abcd e", "abcd f") == 0) {
+            errln("'abcd e' == 'abcd f'");
+        }
+    }
+
+    // Unicode characters need to be recursively decomposed to get the
+    // correct result. For example,
+    // u1EB1 -> \u0103 + \u0300 -> a + \u0306 + \u0300.
+    //
+    public void Test4066189() {
+        String test1 = "\u1EB1";
+        String test2 = "a\u0306\u0300";
+
+        RuleBasedCollator c1 = (RuleBasedCollator) en_us.clone();
+        c1.setDecomposition(Collator.FULL_DECOMPOSITION);
+        CollationElementIterator i1 = en_us.getCollationElementIterator(test1);
+
+        RuleBasedCollator c2 = (RuleBasedCollator) en_us.clone();
+        c2.setDecomposition(Collator.NO_DECOMPOSITION);
+        CollationElementIterator i2 = en_us.getCollationElementIterator(test2);
+
+        assertEqual(i1, i2);
+    }
+
+    // French secondary collation checking at the end of compare iteration fails
+    //
+    public void Test4066696() {
+        RuleBasedCollator c = (RuleBasedCollator) Collator.getInstance(Locale.FRANCE);
+        c.setStrength(Collator.SECONDARY);
+
+        String[] tests = {
+            "\u00e0",   "<",     "\u01fa",       // a-grave <  A-ring-acute
+        };
+
+        compareArray(c, tests);
+    }
+
+
+    // Bad canonicalization of same-class combining characters
+    //
+    public void Test4076676() {
+        // These combining characters are all in the same class, so they should not
+        // be reordered, and they should compare as unequal.
+        String s1 = "A\u0301\u0302\u0300";
+        String s2 = "A\u0302\u0300\u0301";
+
+        RuleBasedCollator c = (RuleBasedCollator) en_us.clone();
+        c.setStrength(Collator.TERTIARY);
+
+        if (c.compare(s1,s2) == 0) {
+            errln("Same-class combining chars were reordered");
+        }
+    }
+
+
+    // RuleBasedCollator.equals(null) throws NullPointerException
+    //
+    public void Test4079231() {
+        try {
+            if (en_us.equals(null)) {
+                errln("en_us.equals(null) returned true");
+            }
+        }
+        catch (Exception e) {
+            errln("en_us.equals(null) threw " + e.toString());
+        }
+    }
+
+    // RuleBasedCollator breaks on "< a < bb" rule
+    //
+    public void Test4078588() throws ParseException {
+        RuleBasedCollator rbc=new RuleBasedCollator("< a < bb");
+
+        int result = rbc.compare("a","bb");
+
+        if (result != -1) {
+            errln("Compare(a,bb) returned " + result + "; expected -1");
+        }
+    }
+
+    // Combining characters in different classes not reordered properly.
+    //
+    public void Test4081866() throws ParseException {
+        // These combining characters are all in different classes,
+        // so they should be reordered and the strings should compare as equal.
+        String s1 = "A\u0300\u0316\u0327\u0315";
+        String s2 = "A\u0327\u0316\u0315\u0300";
+
+        RuleBasedCollator c = (RuleBasedCollator) en_us.clone();
+        c.setStrength(Collator.TERTIARY);
+
+        // Now that the default collators are set to NO_DECOMPOSITION
+        // (as a result of fixing bug 4114077), we must set it explicitly
+        // when we're testing reordering behavior.  -- lwerner, 5/5/98
+        c.setDecomposition(Collator.CANONICAL_DECOMPOSITION);
+
+        if (c.compare(s1,s2) != 0) {
+            errln("Combining chars were not reordered");
+        }
+    }
+
+    // string comparison errors in Scandinavian collators
+    //
+    public void Test4087241() {
+        RuleBasedCollator c = (RuleBasedCollator) Collator.getInstance(
+                                                        new Locale("da", "DK"));
+        c.setStrength(Collator.SECONDARY);
+
+        String[] tests = {
+            "\u007a",   "<",    "\u00e6",       // z        < ae
+            "a\u0308",  "<",    "a\u030a",      // a-unlaut < a-ring
+            "Y",        "<",    "u\u0308",      // Y        < u-umlaut
+        };
+
+        compareArray(c, tests);
+    }
+
+    // CollationKey takes ignorable strings into account when it shouldn't
+    //
+    public void Test4087243() {
+        RuleBasedCollator c = (RuleBasedCollator) en_us.clone();
+        c.setStrength(Collator.TERTIARY);
+
+        String[] tests = {
+            "123",      "=",    "123\u0001",        // 1 2 3  =  1 2 3 ctrl-A
+        };
+
+        compareArray(c, tests);
+    }
+
+    // Mu/micro conflict
+    // Micro symbol and greek lowercase letter Mu should sort identically
+    //
+    public void Test4092260() {
+        Collator c = Collator.getInstance(new Locale("el", ""));
+
+        // will only be equal when FULL_DECOMPOSITION is used
+        c.setDecomposition(Collator.FULL_DECOMPOSITION);
+
+        String[] tests = {
+            "\u00B5",      "=",    "\u03BC",
+        };
+
+        compareArray(c, tests);
+    }
+
+    void Test4095316() {
+        Collator c = Collator.getInstance(new Locale("el", "GR"));
+        c.setStrength(Collator.TERTIARY);
+        // javadocs for RuleBasedCollator clearly specify that characters containing compatability
+        // chars MUST use FULL_DECOMPOSITION to get accurate comparisons.
+        c.setDecomposition(Collator.FULL_DECOMPOSITION);
+
+        String[] tests = {
+            "\u03D4",      "=",    "\u03AB",
+        };
+
+        compareArray(c, tests);
+    }
+
+    public void Test4101940() {
+        try {
+            RuleBasedCollator c = new RuleBasedCollator("< a < b");
+            CollationElementIterator i = c.getCollationElementIterator("");
+            i.reset();
+
+            if (i.next() != i.NULLORDER) {
+                errln("next did not return NULLORDER");
+            }
+        }
+        catch (Exception e) {
+            errln("Caught " + e );
+        }
+    }
+
+    // Collator.compare not handling spaces properly
+    //
+    public void Test4103436() {
+        RuleBasedCollator c = (RuleBasedCollator) en_us.clone();
+        c.setStrength(Collator.TERTIARY);
+
+        String[] tests = {
+            "file",      "<",    "file access",
+            "file",      "<",    "fileaccess",
+        };
+
+        compareArray(c, tests);
+    }
+
+    // Collation not Unicode conformant with Hangul syllables
+    //
+    public void Test4114076() {
+        RuleBasedCollator c = (RuleBasedCollator) en_us.clone();
+        c.setStrength(Collator.TERTIARY);
+
+        //
+        // With Canonical decomposition, Hangul syllables should get decomposed
+        // into Jamo, but Jamo characters should not be decomposed into
+        // conjoining Jamo
+        //
+        c.setDecomposition(Collator.CANONICAL_DECOMPOSITION);
+        String[] test1 = {
+            "\ud4db",   "=",    "\u1111\u1171\u11b6",
+        };
+        compareArray(c, test1);
+
+        // Full decomposition result should be the same as canonical decomposition
+        // for all hangul.
+        c.setDecomposition(Collator.FULL_DECOMPOSITION);
+        compareArray(c, test1);
+
+    }
+
+
+    // Collator.getCollationKey was hanging on certain character sequences
+    //
+    public void Test4124632() throws Exception {
+        Collator coll = Collator.getInstance(Locale.JAPAN);
+
+        try {
+            coll.getCollationKey("A\u0308bc");
+        } catch (OutOfMemoryError e) {
+            errln("Ran out of memory -- probably an infinite loop");
+        }
+    }
+
+    // sort order of french words with multiple accents has errors
+    //
+    public void Test4132736() {
+        Collator c = Collator.getInstance(Locale.FRANCE);
+
+        String[] test1 = {
+            "e\u0300e\u0301",   "<",    "e\u0301e\u0300",
+            "e\u0300\u0301",    ">",    "e\u0301\u0300",
+        };
+        compareArray(c, test1);
+    }
+
+    // The sorting using java.text.CollationKey is not in the exact order
+    //
+    public void Test4133509() {
+        String[] test1 = {
+            "Exception",    "<",    "ExceptionInInitializerError",
+            "Graphics",     "<",    "GraphicsEnvironment",
+            "String",       "<",    "StringBuffer",
+        };
+        compareArray(en_us, test1);
+    }
+
+    // Collation with decomposition off doesn't work for Europe
+    //
+    public void Test4114077() {
+        // Ensure that we get the same results with decomposition off
+        // as we do with it on....
+
+        RuleBasedCollator c = (RuleBasedCollator) en_us.clone();
+        c.setStrength(Collator.TERTIARY);
+
+        String[] test1 = {
+            "\u00C0",        "=", "A\u0300",        // Should be equivalent
+            "p\u00eache",         ">", "p\u00e9ch\u00e9",
+            "\u0204",        "=", "E\u030F",
+            "\u01fa",        "=", "A\u030a\u0301",  // a-ring-acute -> a-ring, acute
+                                                    //   -> a, ring, acute
+            "A\u0300\u0316", "<", "A\u0316\u0300",  // No reordering --> unequal
+        };
+        c.setDecomposition(Collator.NO_DECOMPOSITION);
+        compareArray(c, test1);
+
+        String[] test2 = {
+            "A\u0300\u0316", "=", "A\u0316\u0300",      // Reordering --> equal
+        };
+        c.setDecomposition(Collator.CANONICAL_DECOMPOSITION);
+        compareArray(c, test2);
+    }
+
+    // Support for Swedish gone in 1.1.6 (Can't create Swedish collator)
+    //
+    public void Test4141640() {
+        //
+        // Rather than just creating a Swedish collator, we might as well
+        // try to instantiate one for every locale available on the system
+        // in order to prevent this sort of bug from cropping up in the future
+        //
+        Locale[] locales = Collator.getAvailableLocales();
+
+        for (int i = 0; i < locales.length; i++) {
+            try {
+                Collator c = Collator.getInstance(locales[i]);
+            } catch (Exception e) {
+                errln("Caught " + e + " creating collator for " + locales[i]);
+            }
+        }
+    }
+
+    // getCollationKey throws exception for spanish text
+    // Cannot reproduce this bug on 1.2, however it DOES fail on 1.1.6
+    //
+    public void Test4139572() {
+        //
+        // Code pasted straight from the bug report
+        //
+        // create spanish locale and collator
+        Locale l = new Locale("es", "es");
+        Collator col = Collator.getInstance(l);
+
+        // this spanish phrase kills it!
+        col.getCollationKey("Nombre De Objeto");
+    }
+
+    // RuleBasedCollator doesn't use getCollationElementIterator internally
+    //
+    public void Test4146160() throws ParseException {
+        //
+        // Use a custom collator class whose getCollationElementIterator
+        // methods increment a count....
+        //
+        My4146160Collator.count = 0;
+        new My4146160Collator().getCollationKey("1");
+        if (My4146160Collator.count < 1) {
+            errln("getCollationElementIterator not called");
+        }
+
+        My4146160Collator.count = 0;
+        new My4146160Collator().compare("1", "2");
+        if (My4146160Collator.count < 1) {
+            errln("getCollationElementIterator not called");
+        }
+    }
+
+    static class My4146160Collator extends RuleBasedCollator {
+        public My4146160Collator() throws ParseException {
+            super(Regression.en_us.getRules());
+        }
+
+        public CollationElementIterator getCollationElementIterator(
+                                            String text) {
+            count++;
+            return super.getCollationElementIterator(text);
+        }
+        public CollationElementIterator getCollationElementIterator(
+                                            CharacterIterator text) {
+            count++;
+            return super.getCollationElementIterator(text);
+        }
+
+        public static int count = 0;
+    };
+
+    // CollationElementIterator.previous broken for expanding char sequences
+    //
+    public void Test4179686() throws ParseException {
+
+        // Create a collator with a few expanding character sequences in it....
+        RuleBasedCollator coll = new RuleBasedCollator(en_us.getRules()
+                                                    + " & ae ; \u00e4 & AE ; \u00c4"
+                                                    + " & oe ; \u00f6 & OE ; \u00d6"
+                                                    + " & ue ; \u00fc & UE ; \u00dc");
+
+        String text = "T\u00f6ne"; // o-umlaut
+
+        CollationElementIterator iter = coll.getCollationElementIterator(text);
+        Vector elements = new Vector();
+        int elem;
+
+        // Iterate forward and collect all of the elements into a Vector
+        while ((elem = iter.next()) != iter.NULLORDER) {
+            elements.addElement(new Integer(elem));
+        }
+
+        // Now iterate backward and make sure they're the same
+        int index = elements.size() - 1;
+        while ((elem = iter.previous()) != iter.NULLORDER) {
+            int expect = ((Integer)elements.elementAt(index)).intValue();
+
+            if (elem != expect) {
+                errln("Mismatch at index " + index
+                      + ": got " + Integer.toString(elem,16)
+                      + ", expected " + Integer.toString(expect,16));
+            }
+            index--;
+        }
+    }
+
+    public void Test4244884() throws ParseException {
+        RuleBasedCollator coll = (RuleBasedCollator)Collator.getInstance(Locale.US);
+        coll = new RuleBasedCollator(coll.getRules()
+                + " & C < ch , cH , Ch , CH < cat < crunchy");
+
+        String[] testStrings = new String[] {
+            "car",
+            "cave",
+            "clamp",
+            "cramp",
+            "czar",
+            "church",
+            "catalogue",
+            "crunchy",
+            "dog"
+        };
+
+        for (int i = 1; i < testStrings.length; i++) {
+            if (coll.compare(testStrings[i - 1], testStrings[i]) >= 0) {
+                errln("error: \"" + testStrings[i - 1]
+                    + "\" is greater than or equal to \"" + testStrings[i]
+                    + "\".");
+            }
+        }
+    }
+
+    public void Test4179216() throws ParseException {
+        // you can position a CollationElementIterator in the middle of
+        // a contracting character sequence, yielding a bogus collation
+        // element
+        RuleBasedCollator coll = (RuleBasedCollator)Collator.getInstance(Locale.US);
+        coll = new RuleBasedCollator(coll.getRules()
+                + " & C < ch , cH , Ch , CH < cat < crunchy");
+        String testText = "church church catcatcher runcrunchynchy";
+        CollationElementIterator iter = coll.getCollationElementIterator(
+                testText);
+
+        // test that the "ch" combination works properly
+        iter.setOffset(4);
+        int elt4 = CollationElementIterator.primaryOrder(iter.next());
+
+        iter.reset();
+        int elt0 = CollationElementIterator.primaryOrder(iter.next());
+
+        iter.setOffset(5);
+        int elt5 = CollationElementIterator.primaryOrder(iter.next());
+
+        if (elt4 != elt0 || elt5 != elt0)
+            errln("The collation elements at positions 0 (" + elt0 + "), 4 ("
+                    + elt4 + "), and 5 (" + elt5 + ") don't match.");
+
+        // test that the "cat" combination works properly
+        iter.setOffset(14);
+        int elt14 = CollationElementIterator.primaryOrder(iter.next());
+
+        iter.setOffset(15);
+        int elt15 = CollationElementIterator.primaryOrder(iter.next());
+
+        iter.setOffset(16);
+        int elt16 = CollationElementIterator.primaryOrder(iter.next());
+
+        iter.setOffset(17);
+        int elt17 = CollationElementIterator.primaryOrder(iter.next());
+
+        iter.setOffset(18);
+        int elt18 = CollationElementIterator.primaryOrder(iter.next());
+
+        iter.setOffset(19);
+        int elt19 = CollationElementIterator.primaryOrder(iter.next());
+
+        if (elt14 != elt15 || elt14 != elt16 || elt14 != elt17
+                || elt14 != elt18 || elt14 != elt19)
+            errln("\"cat\" elements don't match: elt14 = " + elt14 + ", elt15 = "
+            + elt15 + ", elt16 = " + elt16 + ", elt17 = " + elt17
+            + ", elt18 = " + elt18 + ", elt19 = " + elt19);
+
+        // now generate a complete list of the collation elements,
+        // first using next() and then using setOffset(), and
+        // make sure both interfaces return the same set of elements
+        iter.reset();
+
+        int elt = iter.next();
+        int count = 0;
+        while (elt != CollationElementIterator.NULLORDER) {
+            ++count;
+            elt = iter.next();
+        }
+
+        String[] nextElements = new String[count];
+        String[] setOffsetElements = new String[count];
+        int lastPos = 0;
+
+        iter.reset();
+        elt = iter.next();
+        count = 0;
+        while (elt != CollationElementIterator.NULLORDER) {
+            nextElements[count++] = testText.substring(lastPos, iter.getOffset());
+            lastPos = iter.getOffset();
+            elt = iter.next();
+        }
+        count = 0;
+        for (int i = 0; i < testText.length(); ) {
+            iter.setOffset(i);
+            lastPos = iter.getOffset();
+            elt = iter.next();
+            setOffsetElements[count++] = testText.substring(lastPos, iter.getOffset());
+            i = iter.getOffset();
+        }
+        for (int i = 0; i < nextElements.length; i++) {
+            if (nextElements[i].equals(setOffsetElements[i])) {
+                logln(nextElements[i]);
+            } else {
+                errln("Error: next() yielded " + nextElements[i] + ", but setOffset() yielded "
+                    + setOffsetElements[i]);
+            }
+        }
+    }
+
+    public void Test4216006() throws Exception {
+        // rule parser barfs on "<\u00e0=a\u0300", and on other cases
+        // where the same token (after normalization) appears twice in a row
+        boolean caughtException = false;
+        try {
+            RuleBasedCollator dummy = new RuleBasedCollator("\u00e0<a\u0300");
+        }
+        catch (ParseException e) {
+            caughtException = true;
+        }
+        if (!caughtException) {
+            throw new Exception("\"a<a\" collation sequence didn't cause parse error!");
+        }
+
+        RuleBasedCollator collator = new RuleBasedCollator("<\u00e0=a\u0300");
+        collator.setDecomposition(Collator.FULL_DECOMPOSITION);
+        collator.setStrength(Collator.IDENTICAL);
+
+        String[] tests = {
+            "a\u0300", "=", "\u00e0",
+            "\u00e0",  "=", "a\u0300"
+        };
+
+        compareArray(collator, tests);
+    }
+
+    public void Test4171974() {
+        // test French accent ordering more thoroughly
+        String[] frenchList = {
+            "\u0075\u0075",     // u u
+            "\u00fc\u0075",     // u-umlaut u
+            "\u01d6\u0075",     // u-umlaut-macron u
+            "\u016b\u0075",     // u-macron u
+            "\u1e7b\u0075",     // u-macron-umlaut u
+            "\u0075\u00fc",     // u u-umlaut
+            "\u00fc\u00fc",     // u-umlaut u-umlaut
+            "\u01d6\u00fc",     // u-umlaut-macron u-umlaut
+            "\u016b\u00fc",     // u-macron u-umlaut
+            "\u1e7b\u00fc",     // u-macron-umlaut u-umlaut
+            "\u0075\u01d6",     // u u-umlaut-macron
+            "\u00fc\u01d6",     // u-umlaut u-umlaut-macron
+            "\u01d6\u01d6",     // u-umlaut-macron u-umlaut-macron
+            "\u016b\u01d6",     // u-macron u-umlaut-macron
+            "\u1e7b\u01d6",     // u-macron-umlaut u-umlaut-macron
+            "\u0075\u016b",     // u u-macron
+            "\u00fc\u016b",     // u-umlaut u-macron
+            "\u01d6\u016b",     // u-umlaut-macron u-macron
+            "\u016b\u016b",     // u-macron u-macron
+            "\u1e7b\u016b",     // u-macron-umlaut u-macron
+            "\u0075\u1e7b",     // u u-macron-umlaut
+            "\u00fc\u1e7b",     // u-umlaut u-macron-umlaut
+            "\u01d6\u1e7b",     // u-umlaut-macron u-macron-umlaut
+            "\u016b\u1e7b",     // u-macron u-macron-umlaut
+            "\u1e7b\u1e7b"      // u-macron-umlaut u-macron-umlaut
+        };
+        Collator french = Collator.getInstance(Locale.FRENCH);
+
+        logln("Testing French order...");
+        checkListOrder(frenchList, french);
+
+        logln("Testing French order without decomposition...");
+        french.setDecomposition(Collator.NO_DECOMPOSITION);
+        checkListOrder(frenchList, french);
+
+        String[] englishList = {
+            "\u0075\u0075",     // u u
+            "\u0075\u00fc",     // u u-umlaut
+            "\u0075\u01d6",     // u u-umlaut-macron
+            "\u0075\u016b",     // u u-macron
+            "\u0075\u1e7b",     // u u-macron-umlaut
+            "\u00fc\u0075",     // u-umlaut u
+            "\u00fc\u00fc",     // u-umlaut u-umlaut
+            "\u00fc\u01d6",     // u-umlaut u-umlaut-macron
+            "\u00fc\u016b",     // u-umlaut u-macron
+            "\u00fc\u1e7b",     // u-umlaut u-macron-umlaut
+            "\u01d6\u0075",     // u-umlaut-macron u
+            "\u01d6\u00fc",     // u-umlaut-macron u-umlaut
+            "\u01d6\u01d6",     // u-umlaut-macron u-umlaut-macron
+            "\u01d6\u016b",     // u-umlaut-macron u-macron
+            "\u01d6\u1e7b",     // u-umlaut-macron u-macron-umlaut
+            "\u016b\u0075",     // u-macron u
+            "\u016b\u00fc",     // u-macron u-umlaut
+            "\u016b\u01d6",     // u-macron u-umlaut-macron
+            "\u016b\u016b",     // u-macron u-macron
+            "\u016b\u1e7b",     // u-macron u-macron-umlaut
+            "\u1e7b\u0075",     // u-macron-umlaut u
+            "\u1e7b\u00fc",     // u-macron-umlaut u-umlaut
+            "\u1e7b\u01d6",     // u-macron-umlaut u-umlaut-macron
+            "\u1e7b\u016b",     // u-macron-umlaut u-macron
+            "\u1e7b\u1e7b"      // u-macron-umlaut u-macron-umlaut
+        };
+        Collator english = Collator.getInstance(Locale.ENGLISH);
+
+        logln("Testing English order...");
+        checkListOrder(englishList, english);
+
+        logln("Testing English order without decomposition...");
+        english.setDecomposition(Collator.NO_DECOMPOSITION);
+        checkListOrder(englishList, english);
+    }
+
+    private void checkListOrder(String[] sortedList, Collator c) {
+        // this function uses the specified Collator to make sure the
+        // passed-in list is already sorted into ascending order
+        for (int i = 0; i < sortedList.length - 1; i++) {
+            if (c.compare(sortedList[i], sortedList[i + 1]) >= 0) {
+                errln("List out of order at element #" + i + ": "
+                        + prettify(sortedList[i]) + " >= "
+                        + prettify(sortedList[i + 1]));
+            }
+        }
+    }
+
+    // CollationElementIterator set doesn't work propertly with next/prev
+    public void Test4663220() {
+        RuleBasedCollator collator = (RuleBasedCollator)Collator.getInstance(Locale.US);
+        CharacterIterator stringIter = new StringCharacterIterator("fox");
+        CollationElementIterator iter = collator.getCollationElementIterator(stringIter);
+
+        int[] elements_next = new int[3];
+        logln("calling next:");
+        for (int i = 0; i < 3; ++i) {
+            logln("[" + i + "] " + (elements_next[i] = iter.next()));
+        }
+
+        int[] elements_fwd = new int[3];
+        logln("calling set/next:");
+        for (int i = 0; i < 3; ++i) {
+            iter.setOffset(i);
+            logln("[" + i + "] " + (elements_fwd[i] = iter.next()));
+        }
+
+        for (int i = 0; i < 3; ++i) {
+            if (elements_next[i] != elements_fwd[i]) {
+                errln("mismatch at position " + i +
+                      ": " + elements_next[i] +
+                      " != " + elements_fwd[i]);
+            }
+        }
+    }
+
+    //------------------------------------------------------------------------
+    // Internal utilities
+    //
+    private void compareArray(Collator c, String[] tests) {
+        for (int i = 0; i < tests.length; i += 3) {
+
+            int expect = 0;
+            if (tests[i+1].equals("<")) {
+                expect = -1;
+            } else if (tests[i+1].equals(">")) {
+                expect = 1;
+            } else if (tests[i+1].equals("=")) {
+                expect = 0;
+            } else {
+                expect = Integer.decode(tests[i+1]).intValue();
+            }
+
+            int result = c.compare(tests[i], tests[i+2]);
+            if (sign(result) != sign(expect))
+            {
+                errln( i/3 + ": compare(" + prettify(tests[i])
+                                    + " , " + prettify(tests[i+2])
+                                    + ") got " + result + "; expected " + expect);
+            }
+            else
+            {
+                // Collator.compare worked OK; now try the collation keys
+                CollationKey k1 = c.getCollationKey(tests[i]);
+                CollationKey k2 = c.getCollationKey(tests[i+2]);
+
+                result = k1.compareTo(k2);
+                if (sign(result) != sign(expect)) {
+                    errln( i/3 + ": key(" + prettify(tests[i])
+                                        + ").compareTo(key(" + prettify(tests[i+2])
+                                        + ")) got " + result + "; expected " + expect);
+
+                    errln("  " + prettify(k1) + " vs. " + prettify(k2));
+                }
+            }
+        }
+    }
+
+    private static final int sign(int i) {
+        if (i < 0) return -1;
+        if (i > 0) return 1;
+        return 0;
+    }
+
+
+    static RuleBasedCollator en_us = (RuleBasedCollator)Collator.getInstance(Locale.US);
+
+    String test1 = "XFILE What subset of all possible test cases has the highest probability of detecting the most errors?";
+    String test2 = "Xf ile What subset of all possible test cases has the lowest probability of detecting the least errors?";
+    String test3 = "a\u00FCbeck Gr\u00F6\u00DFe L\u00FCbeck";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/SpanishTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @library /java/text/testlib
+ * @summary test Spanish Collation
+ */
+/*
+(C) Copyright Taligent, Inc. 1996 - All Rights Reserved
+(C) Copyright IBM Corp. 1996 - All Rights Reserved
+
+  The original version of this source code and documentation is copyrighted and
+owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These materials are
+provided under terms of a License Agreement between Taligent and Sun. This
+technology is protected by multiple US and International patents. This notice and
+attribution to Taligent may not be removed.
+  Taligent is a registered trademark of Taligent, Inc.
+*/
+
+import java.util.Locale;
+import java.text.Collator;
+
+// Quick dummy program for printing out test results
+public class SpanishTest extends CollatorTest {
+
+    public static void main(String[] args) throws Exception {
+        new SpanishTest().run(args);
+    }
+
+    /*
+     * TestPrimary()
+     */
+    private static final String[] primarySourceData = {
+        "alias",
+        "acHc",
+        "acc",
+        "Hello"
+    };
+
+    private static final String[] primaryTargetData = {
+        "allias",
+        "aCHc",
+        "aCHc",
+        "hellO"
+    };
+
+    private static final int[] primaryResults = {
+        -1,  0, -1,  0
+    };
+
+    /*
+     * TestTertiary()
+     */
+    private static final String[] tertiarySourceData = {
+        "alias",
+        "Elliot",
+        "Hello",
+        "acHc",
+        "acc"
+    };
+
+    private static final String[] tertiaryTargetData = {
+        "allias",
+        "Emiot",
+        "hellO",
+        "aCHc",
+        "aCHc"
+    };
+
+    private static final int[] tertiaryResults = {
+        -1, -1,  1, -1, -1
+    };
+
+    public void TestPrimary() {
+        doTest(myCollation, Collator.PRIMARY,
+               primarySourceData, primaryTargetData, primaryResults);
+    }
+
+    public void TestTertiary() {
+        doTest(myCollation, Collator.TERTIARY,
+               tertiarySourceData, tertiaryTargetData, tertiaryResults);
+    }
+
+    private final Collator myCollation = Collator.getInstance(new Locale("es", "ES", ""));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/SurrogatesTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @library /java/text/testlib
+ * @summary test Supplementary Character Collation
+ */
+
+import java.text.Collator;
+import java.text.RuleBasedCollator;
+
+// Quick dummy program for printing out test results
+public class SurrogatesTest extends CollatorTest {
+
+    public static void main(String[] args) throws Exception {
+        new SurrogatesTest().run(args);
+    }
+
+    /*
+     * Data for TestPrimary()
+     */
+    private static final String[] primarySourceData = {
+        "A\ud800\udc04BCD"
+    };
+
+    private static final String[] primaryTargetData = {
+        "A\ud800\udc05BCD"
+    };
+
+    private static final int[] primaryResults = {
+         0
+    };
+
+    /*
+     * Data for TestTertiary()
+     */
+    private static final String[] tertiarySourceData = {
+        "ABCD",
+        "ABCD",
+        "A\ud800\udc00CD",
+        "WXYZ",
+        "WXYZ",
+        "AFEM",
+        "FGM",
+        "BB",
+        "BB"
+    };
+
+    private static final String[] tertiaryTargetData = {
+        "A\ud800\udc00CD",
+        "AB\ud800\udc00D",
+        "A\ud800\udc01CD",
+        "W\ud800\udc0aYZ",
+        "W\ud800\udc0bYZ",
+        "A\ud800\udc08M",
+        "\ud800\udc08M",
+        "\ud800\udc04\ud800\udc02",
+        "\ud800\udc04\ud800\udc05"
+    };
+
+    private static final int[] tertiaryResults = {
+        -1,  1,  1,  1, -1, -1, -1, -1,  1
+    };
+
+    public void TestPrimary() {
+        doTest(myCollation, Collator.PRIMARY,
+               primarySourceData, primaryTargetData, primaryResults);
+    }
+
+    public void TestTertiary() {
+        doTest(myCollation, Collator.TERTIARY,
+               tertiarySourceData, tertiaryTargetData, tertiaryResults);
+    }
+
+    private Collator getCollator() {
+        RuleBasedCollator base = (RuleBasedCollator)Collator.getInstance();
+        String rule = base.getRules();
+        try {
+            return new RuleBasedCollator(rule
+                                     + "&B < \ud800\udc01 < \ud800\udc00"
+                                     + ", \ud800\udc02, \ud800\udc03"
+                                     + "; \ud800\udc04, \ud800\udc05"
+                                     + "< \ud800\udc06 < \ud800\udc07"
+                                     + "&FE < \ud800\udc08"
+                                     + "&PE, \ud800\udc09"
+                                     + "&Z < \ud800\udc0a < \ud800\udc0b < \ud800\udc0c"
+                                     + "&\ud800\udc0a < x, X"
+                                     + "&A < \ud800\udc04\ud800\udc05");
+        } catch (Exception e) {
+            errln("Failed to create new RulebasedCollator object");
+            return null;
+        }
+    }
+
+    private Collator myCollation = getCollator();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/Test4401726.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 4401726
+ * @author John O'Conner
+ * @library /java/text/testlib
+ * @summary Regression tests for Collation and associated classes
+ */
+
+
+import java.text.*;
+import java.util.Locale;
+import java.util.Vector;
+
+public class Test4401726 extends CollatorTest {
+
+    public static void main(String[] args) throws Exception {
+        new Test4401726().run(args);
+    }
+
+   public void TestSetOffSet() {
+
+       int[] expected = {0, -1, 65536};
+       int[] actual = new int[expected.length];
+
+        try {
+            String rule = "< a, A < d; D";
+
+            RuleBasedCollator rbc = new RuleBasedCollator(rule);
+            String str = "aD";
+            CollationElementIterator iterator =
+                rbc.getCollationElementIterator(str);
+
+            iterator.setOffset(0);
+            actual[0] = iterator.getOffset();
+            actual[1] = iterator.previous();
+            iterator.setOffset(0);
+            actual[2] = iterator.next();
+
+            if (compareArray(expected, actual) == false) {
+                errln("Failed.");
+            }
+
+            str = "a";
+            iterator = rbc.getCollationElementIterator(str);
+            iterator.setOffset(0);
+            actual[0] = iterator.getOffset();
+            actual[1] = iterator.previous();
+            iterator.setOffset(0);
+            actual[2] = iterator.next();
+
+            if (compareArray(expected, actual) == false) {
+                errln("Failed.");
+            }
+
+        } catch (ParseException e) {
+            errln("Unexpected ParseException: " + e);
+        }
+
+
+    }
+
+    boolean compareArray(int[] expected, int[] actual) {
+        boolean retVal = false;
+        if (expected.length == actual.length) {
+            int errors = 0;
+            for(int x=0; x< expected.length; ++x) {
+                if (expected[x] != actual[x]) {
+                    ++errors;
+                }
+            }
+            if (errors == 0) retVal = true;
+        }
+        return retVal;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/ThaiTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @library /java/text/testlib
+ * @summary test Thai Collation
+ */
+/*
+ * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ *
+ * This software is the proprietary information of Oracle.
+ * Use is subject to license terms.
+ *
+ */
+
+import java.util.Locale;
+import java.text.Collator;
+import java.text.RuleBasedCollator;
+
+public class ThaiTest extends CollatorTest {
+
+    public static void main(String[] args) throws Exception {
+        new ThaiTest().run(args);
+    }
+
+    /*
+     * Data for TestPrimary()
+     */
+    private static final String[] primarySourceData = {
+        "\u0e01\u0e01",
+        "\u0e07\u0e42\u0e01\u0e49",
+        "\u0e10\u0e34\u0e19",
+        "\u0e16\u0e32\u0e21\u0e23\u0e23\u0e04\u0e40\u0e17\u0e28\u0e19\u0e32",
+        "\u0e23\u0e21\u0e18\u0e23\u0e23\u0e21\u0e4c\u0e1b\u0e23\u0e30\u0e01\u0e31\u0e19\u0e20\u0e31\u0e22",
+        "\u0e23\u0e23\u0e21\u0e2a\u0e34\u0e17\u0e18\u0e34\u0e4c\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e07\u0e2b\u0e21\u0e32\u0e22\u0e41\u0e25\u0e30\u0e22\u0e35\u0e48\u0e2b\u0e49\u0e2d\u0e01\u0e32\u0e23\u0e04\u0e49\u0e32\u0e02\u0e32\u0e22",
+        "\u0e23\u0e23\u0e25\u0e38\u0e19\u0e34\u0e15\u0e34\u0e20\u0e32\u0e27\u0e30",
+        "\u0e01\u0e25\u0e37\u0e2d\u0e41\u0e01\u0e07",
+        "\u0e21\u0e17\u0e34\u0e25\u0e41\u0e2d\u0e25\u0e01\u0e2d\u0e2e\u0e2d\u0e25\u0e4c",
+        "\u0e40\u0e2d\u0e35\u0e48\u0e22\u0e21\u0e2d\u0e48\u0e2d\u0e07",
+        "\u0e2a\u0e14\u0e32\u0e1b\u0e31\u0e15\u0e15\u0e34\u0e1c\u0e25",
+        "\u0e2d\u0e19\u0e01\u0e23\u0e23\u0e21\u0e2a\u0e34\u0e17\u0e18\u0e34\u0e4c",
+        "\u0e21\u0e49\u0e40\u0e17\u0e49\u0e32\u0e22\u0e32\u0e22\u0e21\u0e48\u0e2d\u0e21",
+        "\u0e2a\u0e49\u0e25\u0e30\u0e21\u0e32\u0e19",
+        "\u0e2a\u0e49\u0e28\u0e36\u0e01",
+        "\u0e2a\u0e49\u0e2d\u0e31\u0e48\u0e27",
+        "\u0e2a\u0e49\u0e40\u0e14\u0e37\u0e2d\u0e19",
+        "\u0e2a\u0e49\u0e40\u0e25\u0e37\u0e48\u0e2d\u0e19",
+        "\u0e2a\u0e49\u0e41\u0e02\u0e27\u0e19",
+        "\u0e2a\u0e49\u0e41\u0e2b\u0e49\u0e07",
+        "\u0e2a\u0e49\u0e44\u0e01\u0e48",
+        "\u0e2b",
+        "\u0e2b\u0e0b\u0e2d\u0e07",
+        "\u0e2b\u0e19",
+        "\u0e2b\u0e1b\u0e25\u0e32\u0e23\u0e49\u0e32",
+        "\u0e2b\u0e21",
+        "\u0e2b\u0e21\u0e17\u0e2d\u0e07",
+        "\u0e2b\u0e21\u0e2a\u0e31\u0e1a\u0e1b\u0e30\u0e23\u0e14",
+        "\u0e2b\u0e21\u0e49",
+        "\u0e2b\u0e23\u0e13\u0e22\u0e4c",
+        "\u0e2b\u0e25",
+        "\u0e2b\u0e25\u0e19\u0e49\u0e33",
+        "\u0e2b\u0e25\u0e48",
+        "\u0e2b\u0e25\u0e48\u0e16\u0e19\u0e19",
+        "\u0e2b\u0e25\u0e48\u0e17\u0e27\u0e35\u0e1b",
+        "\u0e2b\u0e25\u0e48\u0e17\u0e32\u0e07",
+        "\u0e2b\u0e25\u0e48\u0e23\u0e27\u0e1a",
+        "\u0e2b\u0e49",
+        "\u0e2d",
+        "\u0e2d\u0e49",
+        "\u0e2e\u0e42\u0e25",
+        "\u0e2e\u0e44\u0e1f",
+        "\u0e2e\u0e49"
+    };
+
+    private static final String[] primaryTargetData = {
+        "\u0e01\u0e01",
+        "\u0e07\u0e42\u0e01\u0e49",
+        "\u0e10\u0e34\u0e19",
+        "\u0e16\u0e32\u0e21\u0e23\u0e23\u0e04\u0e40\u0e17\u0e28\u0e19\u0e32",
+        "\u0e23\u0e21\u0e18\u0e23\u0e23\u0e21\u0e4c\u0e1b\u0e23\u0e30\u0e01\u0e31\u0e19\u0e20\u0e31\u0e22",
+        "\u0e23\u0e23\u0e21\u0e2a\u0e34\u0e17\u0e18\u0e34\u0e4c\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e07\u0e2b\u0e21\u0e32\u0e22\u0e41\u0e25\u0e30\u0e22\u0e35\u0e48\u0e2b\u0e49\u0e2d\u0e01\u0e32\u0e23\u0e04\u0e49\u0e32\u0e02\u0e32\u0e22",
+        "\u0e23\u0e23\u0e25\u0e38\u0e19\u0e34\u0e15\u0e34\u0e20\u0e32\u0e27\u0e30",
+        "\u0e01\u0e25\u0e37\u0e2d\u0e41\u0e01\u0e07",
+        "\u0e21\u0e17\u0e34\u0e25\u0e41\u0e2d\u0e25\u0e01\u0e2d\u0e2e\u0e2d\u0e25\u0e4c",
+        "\u0e40\u0e2d\u0e35\u0e48\u0e22\u0e21\u0e2d\u0e48\u0e2d\u0e07",
+        "\u0e2a\u0e14\u0e32\u0e1b\u0e31\u0e15\u0e15\u0e34\u0e1c\u0e25",
+        "\u0e2d\u0e19\u0e01\u0e23\u0e23\u0e21\u0e2a\u0e34\u0e17\u0e18\u0e34\u0e4c",
+        "\u0e21\u0e49\u0e40\u0e17\u0e49\u0e32\u0e22\u0e32\u0e22\u0e21\u0e48\u0e2d\u0e21",
+        "\u0e2a\u0e49\u0e25\u0e30\u0e21\u0e32\u0e19",
+        "\u0e2a\u0e49\u0e28\u0e36\u0e01",
+        "\u0e2a\u0e49\u0e2d\u0e31\u0e48\u0e27",
+        "\u0e2a\u0e49\u0e40\u0e14\u0e37\u0e2d\u0e19",
+        "\u0e2a\u0e49\u0e40\u0e25\u0e37\u0e48\u0e2d\u0e19",
+        "\u0e2a\u0e49\u0e41\u0e02\u0e27\u0e19",
+        "\u0e2a\u0e49\u0e41\u0e2b\u0e49\u0e07",
+        "\u0e2a\u0e49\u0e44\u0e01\u0e48",
+        "\u0e2b",
+        "\u0e2b\u0e0b\u0e2d\u0e07",
+        "\u0e2b\u0e19",
+        "\u0e2b\u0e1b\u0e25\u0e32\u0e23\u0e49\u0e32",
+        "\u0e2b\u0e21",
+        "\u0e2b\u0e21\u0e17\u0e2d\u0e07",
+        "\u0e2b\u0e21\u0e2a\u0e31\u0e1a\u0e1b\u0e30\u0e23\u0e14",
+        "\u0e2b\u0e21\u0e49",
+        "\u0e2b\u0e23\u0e13\u0e22\u0e4c",
+        "\u0e2b\u0e25",
+        "\u0e2b\u0e25\u0e19\u0e49\u0e33",
+        "\u0e2b\u0e25\u0e48",
+        "\u0e2b\u0e25\u0e48\u0e16\u0e19\u0e19",
+        "\u0e2b\u0e25\u0e48\u0e17\u0e27\u0e35\u0e1b",
+        "\u0e2b\u0e25\u0e48\u0e17\u0e32\u0e07",
+        "\u0e2b\u0e25\u0e48\u0e23\u0e27\u0e1a",
+        "\u0e2b\u0e49",
+        "\u0e2d",
+        "\u0e2d\u0e49",
+        "\u0e2e\u0e42\u0e25",
+        "\u0e2e\u0e44\u0e1f",
+        "\u0e2e\u0e49"
+    };
+
+    private static final int[] primaryResults = {
+         0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+         0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+         0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+         0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+         0,  0,  0
+    };
+
+    public void TestPrimary() {
+        doTest(myCollation, Collator.PRIMARY,
+               primarySourceData, primaryTargetData, primaryResults);
+    }
+
+    private final Collator myCollation = Collator.getInstance(new Locale("th"));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/TurkishTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @library /java/text/testlib
+ * @summary test Turkish Collation
+ */
+/*
+(C) Copyright Taligent, Inc. 1996 - All Rights Reserved
+(C) Copyright IBM Corp. 1996 - All Rights Reserved
+
+  The original version of this source code and documentation is copyrighted and
+owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These materials are
+provided under terms of a License Agreement between Taligent and Sun. This
+technology is protected by multiple US and International patents. This notice and
+attribution to Taligent may not be removed.
+  Taligent is a registered trademark of Taligent, Inc.
+*/
+
+import java.util.Locale;
+import java.text.Collator;
+
+// Quick dummy program for printing out test results
+public class TurkishTest extends CollatorTest {
+
+    public static void main(String[] args) throws Exception {
+        new TurkishTest().run(args);
+    }
+
+    /*
+     * Data for TestPrimary()
+     */
+    private static final String[] primarySourceData = {
+        "\u00FCoid",
+        "vo\u0131d",
+        "idea",
+        "Idea",
+        "\u0130dea"
+    };
+
+    private static final String[] primaryTargetData = {
+        "void",
+        "void",
+        "Idea",
+        "\u0130dea",
+        "\u0131dea"
+    };
+
+    private static final int[] primaryResults = {
+        -1,  -1,  1, -1, 1
+    };
+
+    /*
+     * Data for TestTertiary()
+     */
+    private static final String[] tertiarySourceData = {
+        "s\u0327",
+        "v\u00E4t",
+        "old",
+        "\u00FCoid",
+        "h\u011Ealt",
+        "stres\u015E",
+        "vo\u0131d",
+        "idea",
+       "idea",
+       "\u0131dea"
+    };
+
+    private static final String tertiaryTargetData[] = {
+        "u\u0308",
+        "vbt",
+        "\u00D6ay",
+        "void",
+        "halt",
+        "\u015Etre\u015Es",
+        "void",
+        "Idea",
+       "\u0130dea",
+       "Idea"
+    };
+
+    private static final int[] tertiaryResults = {
+        -1, -1, -1, -1,  1, -1, -1,  1, -1, -1
+    };
+
+    public void TestPrimary() {
+        doTest(myCollation, Collator.PRIMARY,
+               primarySourceData, primaryTargetData, primaryResults);
+    }
+
+    public void TestTertiary() {
+        doTest(myCollation, Collator.TERTIARY,
+               tertiarySourceData, tertiaryTargetData, tertiaryResults);
+    }
+
+    private final Collator myCollation = Collator.getInstance(new Locale("tr", "TR", ""));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/VietnameseTest.java	Fri Jun 28 22:43:42 2019 +0100
@@ -0,0 +1,364 @@
+/*
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4932968 5015215
+ * @library /java/text/testlib
+ * @summary test Vietnamese Collation
+ */
+
+/*
+ *******************************************************************************
+ * (C) Copyright IBM Corp. 1996-2003 - All Rights Reserved                     *
+ *                                                                             *
+ * The original version of this source code and documentation is copyrighted   *
+ * and owned by IBM, These materials are provided under terms of a License     *
+ * Agreement between IBM and Sun. This technology is protected by multiple     *
+ * US and International patents. This notice and attribution to IBM may not    *
+ * to removed.                                                                 *
+ *******************************************************************************
+ */<