Skip to content

Commit bd1e02d

Browse files
committed
apply review comment
1 parent 5c0fa16 commit bd1e02d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

server/src/test/java/org/elasticsearch/common/regex/RegexTests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,15 @@ public void testThousandsAndLongPattern() throws IOException {
256256
}
257257

258258
public void testIntersectNonDeterminizedAutomaton() {
259+
// patterns too complex to determinize within the default limit
259260
String[] patterns = randomArray(20, 100, size -> new String[size], () -> "*" + randomAlphanumericOfLength(10) + "*");
260261
Automaton a = Regex.simpleMatchToNonDeterminizedAutomaton(patterns);
262+
assertFalse(a.isDeterministic());
261263
Automaton b = Regex.simpleMatchToNonDeterminizedAutomaton(Arrays.copyOfRange(patterns, patterns.length / 2, patterns.length));
264+
assertFalse(b.isDeterministic());
262265
assertFalse(Operations.isEmpty(Operations.intersection(a, b)));
263266
IllegalArgumentException exc = expectThrows(IllegalArgumentException.class, () -> assertMatchesAll(a, "my_test"));
267+
// the run automaton expects a deterministic automaton
264268
assertThat(exc.getMessage(), containsString("deterministic"));
265269
expectThrows(TooComplexToDeterminizeException.class, () -> Regex.simpleMatchToAutomaton(patterns));
266270
}

0 commit comments

Comments
 (0)