< prev index next >

test/jdk/java/text/BreakIterator/BreakIteratorTest.java

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 1996, 2022, 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.
--- 1,7 ---
  /*
!  * Copyright (c) 1996, 2023, 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.

*** 25,12 ***
   * @test
   * @bug 4035266 4052418 4068133 4068137 4068139 4086052 4095322 4097779
   *      4097920 4098467 4111338 4113835 4117554 4143071 4146175 4152117
   *      4152416 4153072 4158381 4214367 4217703 4638433 8264765 8291660
   *      8294008
!  * @library /java/text/testlib
-  * @run main/timeout=2000 BreakIteratorTest
   * @summary test BreakIterator
   */
  
  /*
   * This file is available under and governed by the GNU General Public
--- 25,11 ---
   * @test
   * @bug 4035266 4052418 4068133 4068137 4068139 4086052 4095322 4097779
   *      4097920 4098467 4111338 4113835 4117554 4143071 4146175 4152117
   *      4152416 4153072 4158381 4214367 4217703 4638433 8264765 8291660
   *      8294008
!  * @run junit/timeout=2000 BreakIteratorTest
   * @summary test BreakIterator
   */
  
  /*
   * This file is available under and governed by the GNU General Public

*** 76,28 ***
  import java.util.Locale;
  import java.util.Vector;
  import java.util.function.Predicate;
  import java.util.regex.Pattern;
  
! 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
      //=========================================================================
  
--- 75,20 ---
  import java.util.Locale;
  import java.util.Vector;
  import java.util.function.Predicate;
  import java.util.regex.Pattern;
  
! import org.junit.jupiter.api.Test;
  
! import static org.junit.jupiter.api.Assertions.fail;
! 
! public class BreakIteratorTest {
+     private final BreakIterator characterBreak = BreakIterator.getCharacterInstance();
+     private final BreakIterator wordBreak = BreakIterator.getWordInstance();
+     private final BreakIterator lineBreak = BreakIterator.getLineInstance();
+     private final BreakIterator sentenceBreak = BreakIterator.getSentenceInstance();
  
  
      //=========================================================================
      // general test subroutines
      //=========================================================================
  

*** 113,19 ***
          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++)
--- 104,16 ---
          bi.setText(text);
  
          Vector nextResults = testFirstAndNext(bi, text);
          Vector previousResults = testLastAndPrevious(bi, text);
  
!         System.out.println("comparing forward and backward...");
          compareFragmentLists("forward iteration", "backward iteration", nextResults,
                          previousResults);
!         System.out.println("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++)

*** 144,23 ***
          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;
--- 132,23 ---
          int p = bi.first();
          int lastP = p;
          Vector<String> result = new Vector<String>();
  
          if (p != 0)
!             fail("first() returned " + p + " instead of 0");
          while (p != BreakIterator.DONE) {
              p = bi.next();
              if (p != BreakIterator.DONE) {
                  if (p <= lastP)
!                     fail("next() failed to move forward: next() on position "
                                      + lastP + " yielded " + p);
  
                  result.addElement(text.substring(lastP, p));
              }
              else {
                  if (lastP != text.length())
!                     fail("next() returned DONE prematurely: offset was "
                                      + lastP + " instead of " + text.length());
              }
              lastP = p;
          }
          return result;

*** 170,23 ***
          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;
--- 158,23 ---
          int p = bi.last();
          int lastP = p;
          Vector<String> result = new Vector<String>();
  
          if (p != text.length())
!             fail("last() returned " + p + " instead of " + text.length());
          while (p != BreakIterator.DONE) {
              p = bi.previous();
              if (p != BreakIterator.DONE) {
                  if (p >= lastP)
!                     fail("previous() failed to move backward: previous() on position "
                                      + lastP + " yielded " + p);
  
                  result.insertElementAt(text.substring(p, lastP), 0);
              }
              else {
                  if (lastP != 0)
!                     fail("previous() returned DONE prematurely: offset was "
                                      + lastP + " instead of 0");
              }
              lastP = p;
          }
          return result;

*** 225,103 ***
                      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();
              }
--- 213,104 ---
                      while (tempT2 < tempT1 && tempP2 < f2.size()) {
                          tempT2 += ((String)f2.elementAt(tempP2)).length();
                          ++tempP2;
                      }
                  }
!                 System.out.println("*** " + f1Name + " has:");
                  while (p1 <= tempP1 && p1 < f1.size()) {
                      s1 = (String)f1.elementAt(p1);
                      t1 += s1.length();
                      debugLogln(" *** >" + s1 + "<");
                      ++p1;
                  }
!                 System.out.println("***** " + f2Name + " has:");
                  while (p2 <= tempP2 && p2 < f2.size()) {
                      s2 = (String)f2.elementAt(p2);
                      t2 += s2.length();
                      debugLogln(" ***** >" + s2 + "<");
                      ++p2;
                  }
!                 fail("Discrepancy between " + f1Name + " and " + f2Name
+                         + "\n---\n" + f1 +"\n---\n" + f2);
              }
          }
      }
  
      private void testFollowing(BreakIterator bi, String text, int[] boundaries) {
!         System.out.println("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);
!                 System.out.println("bi.following(" + i + ") -> " + b);
                  if (b != boundaries[p])
!                     fail("Wrong result from following() for " + i + ": expected " + boundaries[p]
                            + ", got " + b);
              }
          } catch (IllegalArgumentException illargExp) {
!             fail("IllegalArgumentException caught from following() for offset: " + i);
          }
      }
  
      private void testPreceding(BreakIterator bi, String text, int[] boundaries) {
!         System.out.println("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);
!                 System.out.println("bi.preceding(" + i + ") -> " + b);
                  if (b != boundaries[p])
!                     fail("Wrong result from preceding() for " + i + ": expected " + boundaries[p]
                            + ", got " + b);
  
                  if (i == boundaries[p + 1])
                      ++p;
              }
          } catch (IllegalArgumentException illargExp) {
!             fail("IllegalArgumentException caught from preceding() for offset: " + i);
          }
      }
  
      private void testIsBoundary(BreakIterator bi, String text, int[] boundaries) {
!         System.out.println("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);
!             System.out.println("bi.isBoundary(" + i + ") -> " + isB);
  
              if (i == boundaries[p]) {
                  if (!isB)
!                     fail("Wrong result from isBoundary() for " + i + ": expected true, got false");
                  ++p;
              }
              else {
                  if (isB)
!                     fail("Wrong result from isBoundary() for " + i + ": expected false, got true");
              }
          }
      }
  
      private void doMultipleSelectionTest(BreakIterator iterator, String testText)
      {
!         System.out.println("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);
!             System.out.println("next(" + count + ") -> " + testOffset);
              if (offset != testOffset)
!                 fail("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();
              }

*** 332,13 ***
          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();
              }
--- 321,13 ---
          count = 0;
  
          do {
              testOffset = testIterator.last();
              testOffset = testIterator.next(count);
!             System.out.println("next(" + count + ") -> " + testOffset);
              if (offset != testOffset)
!                 fail("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();
              }

*** 380,11 ***
                      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;
                      }
--- 369,11 ---
                      for (int l = tb.first(); l != BreakIterator.DONE; l = tb.next()) {
                          if (l == 2)
                              seen2 = true;
                      }
                      if (!seen2) {
!                         fail("No break between U+" + Integer.toHexString((int)(work.charAt(1)))
                                      + " and U+" + Integer.toHexString((int)(work.charAt(2))));
                          errorCount++;
                          if (errorCount >= 75)
                              return;
                      }

*** 404,11 ***
              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;
--- 393,11 ---
              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) {
!                         fail("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;

*** 442,11 ***
                  }
  
                  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;
                      }
--- 431,11 ---
                  }
  
                  tb.setText(work.toString());
                  for (int k = tb.first(); k != BreakIterator.DONE; k = tb.next())
                      if (k == 2) {
!                         fail("Break between U+" + Integer.toHexString((int)(work.charAt(1)))
                                  + " and U+" + Integer.toHexString((int)(work.charAt(2))));
                          errorCount++;
                          if (errorCount >= 75)
                              return;
                      }

*** 467,17 ***
                  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");
--- 456,18 ---
                  temp = Integer.toHexString((int)c);
                  out.append(zeros.substring(0, 4 - temp.length()));
                  out.append(temp);
              }
          }
!         System.out.println(out.toString());
      }
  
      //=========================================================================
      // tests
      //=========================================================================
  
+     @Test
      public void TestWordBreak() {
  
          Vector<String> wordSelectionData = new Vector<String>();
  
          wordSelectionData.addElement("12,34");

*** 557,19 ***
--- 547,21 ---
          wordSelectionData.addElement(" ");
  
          generalIteratorTest(wordBreak, wordSelectionData);
      }
  
+     @Test
      public void TestBug4097779() {
          Vector<String> wordSelectionData = new Vector<String>();
  
          wordSelectionData.addElement("aa\u0300a");
          wordSelectionData.addElement(" ");
  
          generalIteratorTest(wordBreak, wordSelectionData);
      }
  
+     @Test
      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

*** 595,10 ***
--- 587,11 ---
          wordSelectionData.addElement(" ");
  
          generalIteratorTest(wordBreak, wordSelectionData);
      }
  
+     @Test
      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

*** 607,10 ***
--- 600,11 ---
          wordSelectionData.addElement("abc");
  
          generalIteratorTest(wordBreak, wordSelectionData);
      }
  
+     @Test
      public void TestSentenceBreak() {
          Vector<String> sentenceSelectionData = new Vector<String>();
  
          sentenceSelectionData.addElement("This is a simple sample sentence. ");
          sentenceSelectionData.addElement("(This is it.) ");

*** 642,19 ***
--- 636,21 ---
          sentenceSelectionData.addElement("Yes, I am definatelly 12\" tall!!");
  
          generalIteratorTest(sentenceBreak, sentenceSelectionData);
      }
  
+     @Test
      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);
      }
  
+     @Test
      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

*** 670,10 ***
--- 666,11 ---
          sentenceSelectionData.addElement("He said, \"I can go there.\"\u2029");
  
          generalIteratorTest(sentenceBreak, sentenceSelectionData);
      }
  
+     @Test
      public void TestBug4117554Sentences() {
          Vector<String> sentenceSelectionData = new Vector<String>();
  
          // Treat fullwidth variants of .!? the same as their
          // normal counterparts

*** 692,10 ***
--- 689,11 ---
          sentenceSelectionData.addElement("(yes)");
  
          generalIteratorTest(sentenceBreak, sentenceSelectionData);
      }
  
+     @Test
      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.  ");

*** 709,10 ***
--- 707,11 ---
          sentenceSelectionData.addElement("Another test.\u2029");
  
          generalIteratorTest(sentenceBreak, sentenceSelectionData);
      }
  
+     @Test
      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.  ");

*** 720,10 ***
--- 719,11 ---
          sentenceSelectionData.addElement("The day after will be the 30th.\u2029");
  
          generalIteratorTest(sentenceBreak, sentenceSelectionData);
      }
  
+     @Test
      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 "

*** 732,10 ***
--- 732,11 ---
                  + "implementor of this interface.\u2029");
  
          generalIteratorTest(sentenceBreak, sentenceSelectionData);
      }
  
+     @Test
      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

*** 750,10 ***
--- 751,11 ---
                  + "constructs a non-negative BigInteger.\u2029");
  
          generalIteratorTest(sentenceBreak, sentenceSelectionData);
      }
  
+     @Test
      public void TestBug8264765() {
          Vector<String> sentenceSelectionData = new Vector<String>();
  
          // Comma should not be regarded as the start of a sentence,
          // otherwise the backwards rule would break the following sentence.

*** 761,10 ***
--- 763,11 ---
              "Due to a problem (e.g., software bug), the server is down. ");
  
          generalIteratorTest(sentenceBreak, sentenceSelectionData);
      }
  
+     @Test
      public void TestLineBreak() {
          Vector<String> lineSelectionData = new Vector<String>();
  
          lineSelectionData.addElement("Multi-");
          lineSelectionData.addElement("Level ");

*** 797,10 ***
--- 800,11 ---
          lineSelectionData.addElement("all");
  
          generalIteratorTest(lineBreak, lineSelectionData);
      }
  
+     @Test
      public void TestBug4068133() {
          Vector<String> lineSelectionData = new Vector<String>();
  
          lineSelectionData.addElement("\u96f6");
          lineSelectionData.addElement("\u4e00\u3002");

*** 813,19 ***
--- 817,21 ---
          lineSelectionData.addElement("\u516b");
  
          generalIteratorTest(lineBreak, lineSelectionData);
      }
  
+     @Test
      public void TestBug4086052() {
          Vector<String> lineSelectionData = new Vector<String>();
  
          lineSelectionData.addElement("foo\u00a0bar ");
  //        lineSelectionData.addElement("foo\ufeffbar");
  
          generalIteratorTest(lineBreak, lineSelectionData);
      }
  
+     @Test
      public void TestBug4097920() {
          Vector<String> lineSelectionData = new Vector<String>();
  
          lineSelectionData.addElement("dog,");
          lineSelectionData.addElement("cat,");

*** 834,10 ***
--- 840,11 ---
          lineSelectionData.addElement("(two)\n");
  
          generalIteratorTest(lineBreak, lineSelectionData);
      }
      /*
+     @Test
      public void TestBug4035266() {
          Vector<String> lineSelectionData = new Vector<String>();
  
          lineSelectionData.addElement("The ");
          lineSelectionData.addElement("balance ");

*** 847,10 ***
--- 854,11 ---
          lineSelectionData.addElement("-$32,456.78!\n");
  
          generalIteratorTest(lineBreak, lineSelectionData);
      }
      */
+     @Test
      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

*** 872,17 ***
          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");
--- 880,18 ---
          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")) {
!             System.out.println("This test is skipped in th locale.");
              return;
          }
  
          generalIteratorTest(lineBreak, lineSelectionData);
      }
  
+     @Test
      public void TestBug4117554Lines() {
          Vector<String> lineSelectionData = new Vector<String>();
  
          // Fullwidth .!? should be treated as postJwrd
          lineSelectionData.addElement("\u4e01\uff0e");

*** 890,13 ***
          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>();
  
--- 899,14 ---
          lineSelectionData.addElement("\u4e03\uff1f");
  
          generalIteratorTest(lineBreak, lineSelectionData);
      }
  
+     @Test
      public void TestBug4217703() {
          if (Locale.getDefault().getLanguage().equals("th")) {
!             System.out.println("This test is skipped in th locale.");
              return;
          }
  
          Vector<String> lineSelectionData = new Vector<String>();
  

*** 919,10 ***
--- 929,11 ---
      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";
  
+     @Test
      public void TestCharacterBreak() {
          Vector<String> characterSelectionData = new Vector<String>();
  
          characterSelectionData.addElement(graveS);
          characterSelectionData.addElement(acuteBelowI);

*** 950,10 ***
--- 961,11 ---
          characterSelectionData.addElement("\n");
  
          generalIteratorTest(characterBreak, characterSelectionData);
      }
  
+     @Test
      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

*** 990,10 ***
--- 1002,11 ---
          characterSelectionData.addElement("\u1112\u116c");
  
          generalIteratorTest(characterBreak, characterSelectionData);
      }
  
+     @Test
      public void TestBug4153072() {
          BreakIterator iter = BreakIterator.getWordInstance();
          String str = "...Hello, World!...";
          int begin = 3;
          int end = str.length() - 3;

*** 1003,21 ***
          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
--- 1016,22 ---
          iter.setText(new StringCharacterIterator(str, begin, end, begin));
          for (int index = -1; index < begin + 1; ++index) {
              try {
                  dummy = iter.isBoundary(index);
                  if (index < begin)
!                     fail("Didn't get exception with offset = " + index +
                                      " and begin index = " + begin);
              }
              catch (IllegalArgumentException e) {
                  if (index >= begin)
!                     fail("Got exception with offset = " + index +
                                      " and begin index = " + begin);
              }
          }
      }
  
+     @Test
      public void TestBug4146175Sentences() {
          Vector<String> sentenceSelectionData = new Vector<String>();
  
          // break between periods and opening punctuation even when there's no
          // intervening space

*** 1029,13 ***
          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>();
  
--- 1043,14 ---
          sentenceSelectionData.addElement("\u300c\u3053\u308c\u306f");
  
          generalIteratorTest(sentenceBreak, sentenceSelectionData);
      }
  
+     @Test
      public void TestBug4146175Lines() {
          if (Locale.getDefault().getLanguage().equals("th")) {
!             System.out.println("This test is skipped in th locale.");
              return;
          }
  
          Vector<String> lineSelectionData = new Vector<String>();
  

*** 1044,13 ***
          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>();
  
--- 1059,14 ---
          lineSelectionData.addElement("\u308f");
  
          generalIteratorTest(lineBreak, lineSelectionData);
      }
  
+     @Test
      public void TestBug4214367() {
          if (Locale.getDefault().getLanguage().equals("th")) {
!             System.out.println("This test is skipped in th locale.");
              return;
          }
  
          Vector<String> wordSelectionData = new Vector<String>();
  

*** 1068,34 ***
          + "\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"
--- 1084,37 ---
          + "\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";
  
+     @Test
      public void TestSentenceInvariants()
      {
          BreakIterator e = BreakIterator.getSentenceInstance();
          doOtherInvariantTest(e, cannedTestChars + ".,\u3001\u3002\u3041\u3042\u3043\ufeff");
      }
  
+     @Test
      public void TestWordInvariants()
      {
          if (Locale.getDefault().getLanguage().equals("th")) {
!             System.out.println("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");
      }
  
+     @Test
      public void TestLineInvariants()
      {
          if (Locale.getDefault().getLanguage().equals("th")) {
!             System.out.println("This test is skipped in th locale.");
              return;
          }
  
          BreakIterator e = BreakIterator.getLineInstance();
          String testChars = cannedTestChars + ".,;:\u3001\u3002\u3041\u3042\u3043\u3044\u3045"

*** 1140,11 ***
                                                                   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;
--- 1159,11 ---
                                                                   work.charAt(l) == '\u2011' ||
                                                                   work.charAt(l) == '\u202f' ||
                                                                   work.charAt(l) == '\ufeff')) {
                                  continue;
                              }
!                             fail("Got break between U+" + Integer.toHexString((int)
                                      (work.charAt(l - 1))) + " and U+" + Integer.toHexString(
                                      (int)(work.charAt(l))));
                              errorCount++;
                              if (errorCount >= 75)
                                  return;

*** 1193,11 ***
                      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;
--- 1212,11 ---
                      boolean saw2 = false;
                      for (int l = e.first(); l != BreakIterator.DONE; l = e.next())
                          if (l == 2)
                              saw2 = true;
                      if (!saw2) {
!                         fail("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;

*** 1206,41 ***
              }
          }
          */
      }
  
      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
  
--- 1225,45 ---
              }
          }
          */
      }
  
+     @Test
      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");
      }
  
+     @Test
      public void TestEmptyString()
      {
          String text = "";
          Vector<String> x = new Vector<String>();
          x.addElement(text);
  
          generalIteratorTest(lineBreak, x);
      }
  
+     @Test
      public void TestGetAvailableLocales()
      {
          Locale[] locList = BreakIterator.getAvailableLocales();
  
          if (locList.length == 0)
!             fail("getAvailableLocales() returned an empty list!");
          // I have no idea how to test this function...
      }
  
  
      /**
       * Bug 4095322
       */
+     @Test
      public void TestJapaneseLineBreak()
      {
          StringBuffer testString = new StringBuffer("\u4e00x\u4e8c");
          // Breaking on <Kanji>$<Kanji> is inconsistent
  

*** 1285,22 ***
          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);
              }
          }
--- 1308,22 ---
          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) {
!                 fail("ja line break failure: failed to start at 0 and bounced at " + j);
              }
              j = iter.next();
              if (j != 1) {
!                 fail("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) {
!                 fail("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);
              }
          }

*** 1308,32 ***
          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;
  
--- 1331,33 ---
          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) {
!                 fail("ja line break failure: failed to start at 0 and bounded at " + j);
              }
              j = iter.next();
              if (j != 2) {
!                 fail("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) {
!                 fail("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
       */
+     @Test
      public void TestLineBreakBasedOnUnicode3_0_0()
      {
          BreakIterator iter;
          int i;
  

*** 1343,11 ***
          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);
  
--- 1367,11 ---
          iter = BreakIterator.getWordInstance(Locale.US);
          iter.setText("\u0216\u0217\u0218\u0219\u021A");
          i = iter.first();
          i = iter.next();
          if (i != 5) {
!             fail("Word break failure: failed to stop at 5 and bounded at " + i);
          }
  
  
          iter = BreakIterator.getLineInstance(Locale.US);
  

*** 1356,45 ***
           */
          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(Locale.of("th"));
--- 1380,45 ---
           */
          iter.setText("32\u301f1");
          i = iter.first();
          i = iter.next();
          if (i != 3) {
!             fail("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) {
!             fail("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) {
!             fail("Khmer line break failure: failed to stop before \\u17DB(Sc) at 1 and bounded at " + i);
          }
          i = iter.next();
          if (i != 3) {
!             fail("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) {
!             fail("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(Locale.of("th"));

*** 1407,40 ***
           */
          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 ");
--- 1431,42 ---
           */
          iter.setText("\u0E57\u201C\u0E55\u201D\u0E53");
          i = iter.first();
          i = iter.next();
          if (i != 1) {
!             fail("Thai line break failure: failed to stop before \\u201C(Pi) at 1 and bounded at " + i);
          }
          i = iter.next();
          if (i != 4) {
!             fail("Thai line break failure: failed to stop after \\u201D(Pf) at 4 and bounded at " + i);
          }
      }
  
      /**
       * Bug 4068137
       */
+     @Test
      public void TestEndBehavior()
      {
          String testString = "boo.";
          BreakIterator wb = BreakIterator.getWordInstance();
          wb.setText(testString);
  
          if (wb.first() != 0)
!             fail("Didn't get break at beginning of string.");
          if (wb.next() != 3)
!             fail("Didn't get break before period in \"boo.\"");
          if (wb.current() != 4 && wb.next() != 4)
!             fail("Didn't get break at end of string.");
      }
  
      // [serialization test has been removed pursuant to bug #4152965]
  
      /**
       * Bug 4450804
       */
+     @Test
      public void TestLineBreakContractions() {
          Vector<String> expected = new Vector<String>();
  
          expected.add("These ");
          expected.add("are ");

*** 1451,10 ***
--- 1477,11 ---
          expected.add("them?");
          generalIteratorTest(lineBreak, expected);
      }
  
      private static final Pattern CODEPOINT = Pattern.compile("([0-9A-F]{4,5})");
+     @Test
      public void TestGraphemeBreak() throws Exception {
          Files.lines(Paths.get(System.getProperty("test.root"),
                  "../../src/java.base/share/data/unicodedata/auxiliary/GraphemeBreakTest.txt"))
                  .map(ln -> ln.replaceFirst("#.*", ""))
                  .filter(Predicate.not(String::isEmpty))

*** 1468,9 ***
--- 1495,10 ---
                              .toList());
                      generalIteratorTest(characterBreak, expected);
                  });
      }
  
+     @Test
      public void TestSetTextIOOBException() {
          BreakIterator.getCharacterInstance().setText(new StringCharacterIterator("abcfefg", 1, 5, 3));
      }
  }
< prev index next >