Skip to content

Apache Lucene open-source search software

fix flaky test: removing dead states can turn the NFA into a DFA

Robert Muir5e7d8affeadb
diff --git a/lucene/core/src/test/org/apache/lucene/util/automaton/TestAutomaton.java b/lucene/core/src/test/org/apache/lucene/util/automaton/TestAutomaton.java
index e9e35416db4..11ba6bee79c 100644
--- a/lucene/core/src/test/org/apache/lucene/util/automaton/TestAutomaton.java
+++ b/lucene/core/src/test/org/apache/lucene/util/automaton/TestAutomaton.java
@@ -880,9 +880,11 @@ public class TestAutomaton extends LuceneTestCase {
newTerms.add(newTerm.toBytesRef());
}
terms = newTerms;
- boolean wasDeterministic1 = a.isDeterministic();
+ boolean wasDeterministic = a.isDeterministic();
a = Operations.concatenate(Automata.makeString(prefix.utf8ToString()), a);
- assertEquals(wasDeterministic1, a.isDeterministic());
+ if (wasDeterministic) {
+ assertTrue(a.isDeterministic());
+ }
}
break;