Skip to content

Apache Lucene open-source search software

Correct test error that allowed an empty array.

Dawid Weiss0c13a52df546
diff --git a/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestDirectoryTaxonomyReader.java b/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestDirectoryTaxonomyReader.java
index 3da05830e1e..cff8dc24a30 100644
--- a/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestDirectoryTaxonomyReader.java
+++ b/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestDirectoryTaxonomyReader.java
@@ -16,6 +16,7 @@
*/
package org.apache.lucene.facet.taxonomy.directory;
+import com.carrotsearch.randomizedtesting.RandomizedTest;
import com.carrotsearch.randomizedtesting.generators.RandomNumbers;
import java.io.IOException;
import java.util.Arrays;
@@ -572,7 +573,7 @@ public class TestDirectoryTaxonomyReader extends FacetTestCase {
public void testCallingBulkPathReturnsCorrectResult() throws Exception {
Directory src = newDirectory();
DirectoryTaxonomyWriter w = new DirectoryTaxonomyWriter(src);
- String randomArray[] = new String[random().nextInt(1000)];
+ String randomArray[] = new String[RandomizedTest.randomIntBetween(1, 1000)];
// adding a smaller bound on ints ensures that we will have some duplicate ordinals in random
// test cases
Arrays.setAll(randomArray, i -> Integer.toString(random().nextInt(500)));