diff --git a/lucene/core/src/test/org/apache/lucene/search/TestTermInSetQuery.java b/lucene/core/src/test/org/apache/lucene/search/TestTermInSetQuery.java index a62d7f8fc4d9..e78689e1e46b 100644 --- a/lucene/core/src/test/org/apache/lucene/search/TestTermInSetQuery.java +++ b/lucene/core/src/test/org/apache/lucene/search/TestTermInSetQuery.java @@ -25,7 +25,6 @@ import java.util.List; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.Supplier; import java.util.stream.Collectors; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field.Store; @@ -47,7 +46,6 @@ import org.apache.lucene.tests.util.TestUtil; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.IOUtils; -import org.apache.lucene.util.automaton.ByteRunAutomaton; public class TestTermInSetQuery extends LuceneTestCase { @@ -359,48 +357,4 @@ public void testIsConsideredCostlyByQueryCache() throws IOException { // cached after two uses assertTrue(policy.shouldCache(query)); } - - public void testVisitor() { - // singleton reports back to consumeTerms() - TermInSetQuery singleton = new TermInSetQuery("field", newBytesRef("term1")); - singleton.visit( - new QueryVisitor() { - @Override - public void consumeTerms(Query query, Term... terms) { - assertEquals(1, terms.length); - assertEquals(new Term("field", newBytesRef("term1")), terms[0]); - } - - @Override - public void consumeTermsMatching( - Query query, String field, Supplier automaton) { - fail("Singleton TermInSetQuery should not try to build ByteRunAutomaton"); - } - }); - - // multiple values built into automaton - List terms = new ArrayList<>(); - for (int i = 0; i < 100; i++) { - terms.add(newBytesRef("term" + i)); - } - TermInSetQuery t = new TermInSetQuery("field", terms); - t.visit( - new QueryVisitor() { - @Override - public void consumeTerms(Query query, Term... terms) { - fail("TermInSetQuery with multiple terms should build automaton"); - } - - @Override - public void consumeTermsMatching( - Query query, String field, Supplier automaton) { - ByteRunAutomaton a = automaton.get(); - BytesRef test = newBytesRef("nonmatching"); - assertFalse(a.run(test.bytes, test.offset, test.length)); - for (BytesRef term : terms) { - assertTrue(a.run(term.bytes, term.offset, term.length)); - } - } - }); - } }