diff --git a/community/community-it/kernel-it/src/test/java/org/neo4j/kernel/api/index/SimpleIndexAccessorCompatibility.java b/community/community-it/kernel-it/src/test/java/org/neo4j/kernel/api/index/SimpleIndexAccessorCompatibility.java index dfc19439cc668..fefb43bc4f038 100644 --- a/community/community-it/kernel-it/src/test/java/org/neo4j/kernel/api/index/SimpleIndexAccessorCompatibility.java +++ b/community/community-it/kernel-it/src/test/java/org/neo4j/kernel/api/index/SimpleIndexAccessorCompatibility.java @@ -406,7 +406,7 @@ public void testIndexRangeSeekByDurationArray() throws Exception @Test public void testIndexRangeSeekByTextArray() throws Exception { - testIndexRangeSeek( () -> random.randomValues().nextStringArray() ); + testIndexRangeSeek( () -> random.randomValues().nextBasicMultilingualPlaneStringArray() ); } @Test diff --git a/community/random-values/src/main/java/org/neo4j/values/storable/RandomValues.java b/community/random-values/src/main/java/org/neo4j/values/storable/RandomValues.java index fddd2d7353684..595f36f505ac2 100644 --- a/community/random-values/src/main/java/org/neo4j/values/storable/RandomValues.java +++ b/community/random-values/src/main/java/org/neo4j/values/storable/RandomValues.java @@ -1502,6 +1502,22 @@ public short[] nextShortArrayRaw( int minLength, int maxLength ) return shorts; } + public TextArray nextBasicMultilingualPlaneStringArray() + { + return Values.stringArray( nextBasicMultilingualPlaneStringArrayRaw() ); + } + + public String[] nextBasicMultilingualPlaneStringArrayRaw() + { + return nextBasicMultilingualPlaneStringArrayRaw( configuration.arrayMinLength(), configuration.arrayMaxLength(), configuration.stringMinLength(), + configuration.stringMaxLength() ); + } + + public String[] nextBasicMultilingualPlaneStringArrayRaw( int minLength, int maxLength, int minStringLength, int maxStringLength ) + { + return nextStringArrayRaw( minLength, maxLength, () -> nextBasicMultilingualPlaneTextValue( minStringLength, maxStringLength ).stringValue() ); + } + /** * Returns the next pseudorandom alpha-numeric {@link TextArray}. *

@@ -1534,13 +1550,7 @@ public String[] nextAlphaNumericStringArrayRaw( int minLength, int maxLength ) public String[] nextAlphaNumericStringArrayRaw( int minLength, int maxLength, int minStringLength, int maxStringLength ) { - int length = intBetween( minLength, maxLength ); - String[] strings = new String[length]; - for ( int i = 0; i < length; i++ ) - { - strings[i] = nextAlphaNumericTextValue( minStringLength, maxStringLength ).stringValue(); - } - return strings; + return nextStringArrayRaw( minLength, maxLength, () -> nextAlphaNumericTextValue( minStringLength, maxStringLength ).stringValue() ); } /** @@ -1581,12 +1591,17 @@ public String[] nextStringArrayRaw( int minLength, int maxLength ) } public String[] nextStringArrayRaw( int minLength, int maxLength, int minStringLength, int maxStringLength ) + { + return nextStringArrayRaw( minLength, maxLength, () -> nextTextValue( minStringLength, maxStringLength ).stringValue() ); + } + + private String[] nextStringArrayRaw( int minLength, int maxLength, StringCreator stringCreator ) { int length = intBetween( minLength, maxLength ); String[] strings = new String[length]; for ( int i = 0; i < length; i++ ) { - strings[i] = nextTextValue( minStringLength, maxStringLength ).stringValue(); + strings[i] = stringCreator.create(); } return strings; } @@ -1941,4 +1956,10 @@ private static int nextPowerOf2( int i ) { return 1 << (32 - Integer.numberOfLeadingZeros( i )); } + + @FunctionalInterface + private interface StringCreator + { + String create(); + } }