diff --git a/modules/analysis/common/src/test/org/apache/lucene/collation/CollationTestBase.java b/modules/analysis/common/src/test/org/apache/lucene/collation/CollationTestBase.java index 442788a389c..e65732a3693 100644 --- a/modules/analysis/common/src/test/org/apache/lucene/collation/CollationTestBase.java +++ b/modules/analysis/common/src/test/org/apache/lucene/collation/CollationTestBase.java @@ -257,27 +257,6 @@ public abstract class CollationTestBase extends LuceneTestCase { } assertEquals(expectedResult, buff.toString()); } - - private String randomString() { - // ideally we could do this! - // return _TestUtil.randomUnicodeString(random); - // - // http://bugs.icu-project.org/trac/ticket/8060 - // http://bugs.icu-project.org/trac/ticket/7732 - // ... - // - // as a workaround, just test the BMP for now (and avoid 0xFFFF etc) - int length = _TestUtil.nextInt(random, 0, 10); - char chars[] = new char[length]; - for (int i = 0; i < length; i++) { - if (random.nextBoolean()) { - chars[i] = (char) _TestUtil.nextInt(random, 0, 0xD7FF); - } else { - chars[i] = (char) _TestUtil.nextInt(random, 0xE000, 0xFFFD); - } - } - return new String(chars, 0, length); - } public void assertThreadSafe(final Analyzer analyzer) throws Exception { int numTestPoints = 100; @@ -289,7 +268,7 @@ public abstract class CollationTestBase extends LuceneTestCase { // and ensure they are the same as the ones we produced in serial fashion. for (int i = 0; i < numTestPoints; i++) { - String term = randomString(); + String term = _TestUtil.randomSimpleString(random); TokenStream ts = analyzer.reusableTokenStream("fake", new StringReader(term)); TermToBytesRefAttribute termAtt = ts.addAttribute(TermToBytesRefAttribute.class); BytesRef bytes = termAtt.getBytesRef(); diff --git a/modules/analysis/common/src/test/org/apache/lucene/collation/TestCollationKeyAnalyzer.java b/modules/analysis/common/src/test/org/apache/lucene/collation/TestCollationKeyAnalyzer.java index ba348d9fe9f..bff441c148d 100644 --- a/modules/analysis/common/src/test/org/apache/lucene/collation/TestCollationKeyAnalyzer.java +++ b/modules/analysis/common/src/test/org/apache/lucene/collation/TestCollationKeyAnalyzer.java @@ -87,8 +87,7 @@ public class TestCollationKeyAnalyzer extends CollationTestBase { public void testThreadSafe() throws Exception { int iters = 20 * RANDOM_MULTIPLIER; for (int i = 0; i < iters; i++) { - Locale locale = randomLocale(random); - Collator collator = Collator.getInstance(locale); + Collator collator = Collator.getInstance(Locale.GERMAN); collator.setStrength(Collator.PRIMARY); assertThreadSafe(new CollationKeyAnalyzer(TEST_VERSION_CURRENT, collator)); } diff --git a/modules/analysis/icu/src/test/org/apache/lucene/collation/TestICUCollationKeyAnalyzer.java b/modules/analysis/icu/src/test/org/apache/lucene/collation/TestICUCollationKeyAnalyzer.java index ad481ee74cb..dc6a3e80300 100644 --- a/modules/analysis/icu/src/test/org/apache/lucene/collation/TestICUCollationKeyAnalyzer.java +++ b/modules/analysis/icu/src/test/org/apache/lucene/collation/TestICUCollationKeyAnalyzer.java @@ -19,6 +19,7 @@ package org.apache.lucene.collation; import com.ibm.icu.text.Collator; + import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.index.codecs.CodecProvider; import org.apache.lucene.util.BytesRef; @@ -88,7 +89,7 @@ public class TestICUCollationKeyAnalyzer extends CollationTestBase { public void testThreadSafe() throws Exception { int iters = 20 * RANDOM_MULTIPLIER; for (int i = 0; i < iters; i++) { - Locale locale = randomLocale(random); + Locale locale = Locale.GERMAN; Collator collator = Collator.getInstance(locale); collator.setStrength(Collator.IDENTICAL); assertThreadSafe(new ICUCollationKeyAnalyzer(TEST_VERSION_CURRENT, collator));