public virtual void testConsumeSentenceInstance() { // we use the default locale, as its randomized by LuceneTestCase BreakIterator bi = BreakIterator.getSentenceInstance(Locale.Default); CharArrayIterator ci = CharArrayIterator.newSentenceInstance(); for (int i = 0; i < 10000; i++) { char[] text = TestUtil.randomUnicodeString(random()).toCharArray(); ci.setText(text, 0, text.Length); consume(bi, ci); } }
/* run this to test if your JRE is buggy * public void testWordInstanceJREBUG() { * // we use the default locale, as its randomized by LuceneTestCase * BreakIterator bi = BreakIterator.getWordInstance(Locale.getDefault()); * Segment ci = new Segment(); * for (int i = 0; i < 10000; i++) { * char text[] = TestUtil.randomUnicodeString(random).toCharArray(); * ci.array = text; * ci.offset = 0; * ci.count = text.length; * consume(bi, ci); * } * } */ public virtual void testSentenceInstance() { doTests(CharArrayIterator.newSentenceInstance()); }