public void testOutOfRange() throws Exception {
    StringBuilder text = new StringBuilder(TEXT);
    BreakIterator bi = BreakIterator.getWordInstance(Locale.ROOT);
    BoundaryScanner scanner = new BreakIteratorBoundaryScanner(bi);

    int start = TEXT.length() + 1;
    assertEquals(start, scanner.findStartOffset(text, start));
    assertEquals(start, scanner.findEndOffset(text, start));
    start = 0;
    assertEquals(start, scanner.findStartOffset(text, start));
    start = -1;
    assertEquals(start, scanner.findEndOffset(text, start));
  }
 protected String getFragmentSourceMSO(
     StringBuilder buffer,
     int[] index,
     Field[] values,
     int startOffset,
     int endOffset,
     int[] modifiedStartOffset) {
   while (buffer.length() < endOffset && index[0] < values.length) {
     buffer.append(values[index[0]++].stringValue());
     buffer.append(getMultiValuedSeparator());
   }
   int bufferLength = buffer.length();
   // we added the multi value char to the last buffer, ignore it
   if (values[index[0] - 1].fieldType().tokenized()) {
     bufferLength--;
   }
   int eo =
       bufferLength < endOffset ? bufferLength : boundaryScanner.findEndOffset(buffer, endOffset);
   modifiedStartOffset[0] = boundaryScanner.findStartOffset(buffer, startOffset);
   return buffer.substring(modifiedStartOffset[0], eo);
 }
 private void testFindEndOffset(
     StringBuilder text, int start, int expected, BoundaryScanner scanner) throws Exception {
   assertEquals(expected, scanner.findEndOffset(text, start));
 }