diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/support/StringMatcherTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/support/StringMatcherTests.java index 212b9ae8e612e..146f28e9fbef6 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/support/StringMatcherTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/support/StringMatcherTests.java @@ -45,7 +45,7 @@ public void testSingleQuestionMark() throws Exception { public void testUnicodeWildcard() throws Exception { // Lucene automatons don't work correctly on strings with high surrogates - final String prefix = randomValueOtherThanMany(StringMatcherTests::hasHighSurrogate, + final String prefix = randomValueOtherThanMany(s -> StringMatcherTests.hasHighSurrogate(s) || s.contains("\\"), () -> randomRealisticUnicodeOfLengthBetween(3, 5)); final StringMatcher matcher = StringMatcher.of(prefix + "*"); for (int i = 0; i < 10; i++) {