Skip to content

Commit

Permalink
temporarily remove broken test case
Browse files Browse the repository at this point in the history
  • Loading branch information
gsmiller committed Jun 2, 2023
1 parent 9fa1e9d commit 74459ee
Showing 1 changed file with 0 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {

Expand Down Expand Up @@ -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<ByteRunAutomaton> automaton) {
fail("Singleton TermInSetQuery should not try to build ByteRunAutomaton");
}
});

// multiple values built into automaton
List<BytesRef> 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<ByteRunAutomaton> 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));
}
}
});
}
}

0 comments on commit 74459ee

Please sign in to comment.