Exemple #1
0
 /*
  * Tests the method public int following(int offset)
  */
 public void TestFollowing() {
   RuleBasedBreakIterator rbbi = new RuleBasedBreakIterator(".;");
   // Tests when "else if (offset < fText.getBeginIndex())" is true
   rbbi.setText("dummy");
   if (rbbi.following(-1) != 0) {
     errln(
         "RuleBasedBreakIterator.following(-1) was suppose to return "
             + "0 when the object has a fText of dummy.");
   }
 }
Exemple #2
0
 private void _testFollowing(RuleBasedBreakIterator rbbi, String text, int[] boundaries) {
   logln("testFollowing():");
   int p = 2;
   for (int i = 0; i <= text.length(); i++) {
     if (i == boundaries[p]) ++p;
     int b = rbbi.following(i);
     logln("rbbi.following(" + i + ") -> " + b);
     if (b != boundaries[p])
       errln(
           "Wrong result from following() for "
               + i
               + ": expected "
               + boundaries[p]
               + ", got "
               + b);
   }
 }