LUCENE-9028: fix test compile

This commit is contained in:
Mikhail Khludnev 2019-11-01 16:40:13 -07:00
parent 332f1d7741
commit 1f6c06f305
2 changed files with 8 additions and 8 deletions

View File

@ -18,7 +18,7 @@
package org.apache.lucene.queries.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.Arrays;
import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.CharArraySet; import org.apache.lucene.analysis.CharArraySet;
@ -740,7 +740,7 @@ public class TestIntervals extends LuceneTestCase {
} }
public void testPrefix() throws IOException { public void testPrefix() throws IOException {
for (IntervalsSource source : List.of(Intervals.prefix(new BytesRef("p")), for (IntervalsSource source : Arrays.asList(Intervals.prefix(new BytesRef("p")),
Intervals.multiterm(PrefixQuery.toAutomaton(new BytesRef("p")), "p*" ) )) { Intervals.multiterm(PrefixQuery.toAutomaton(new BytesRef("p")), "p*" ) )) {
checkIntervals(source, "field1", 5, new int[][]{ checkIntervals(source, "field1", 5, new int[][]{
{}, {},
@ -756,12 +756,12 @@ public class TestIntervals extends LuceneTestCase {
assertMatch(mi, 1, 1, 6, 14); assertMatch(mi, 1, 1, 6, 14);
} }
for (IntervalsSource noSuch : List.of(Intervals.prefix(new BytesRef("qqq")), for (IntervalsSource noSuch : Arrays.asList(Intervals.prefix(new BytesRef("qqq")),
Intervals.multiterm(PrefixQuery.toAutomaton(new BytesRef("qqq")), "qqq*" ))) { Intervals.multiterm(PrefixQuery.toAutomaton(new BytesRef("qqq")), "qqq*" ))) {
checkIntervals(noSuch, "field1", 0, new int[][]{}); checkIntervals(noSuch, "field1", 0, new int[][]{});
} }
for (IntervalsSource source : List.of(Intervals.prefix(new BytesRef("p"), 1), for (IntervalsSource source : Arrays.asList(Intervals.prefix(new BytesRef("p"), 1),
Intervals.multiterm(PrefixQuery.toAutomaton(new BytesRef("p")), 1, "p*")) ) { Intervals.multiterm(PrefixQuery.toAutomaton(new BytesRef("p")), 1, "p*")) ) {
IllegalStateException e = expectThrows(IllegalStateException.class, () -> { IllegalStateException e = expectThrows(IllegalStateException.class, () -> {
for (LeafReaderContext ctx : searcher.getIndexReader().leaves()) { for (LeafReaderContext ctx : searcher.getIndexReader().leaves()) {

View File

@ -211,10 +211,10 @@ public class TestPayloadCheckQuery extends LuceneTestCase {
} }
public void testRewrite() throws IOException { public void testRewrite() throws IOException {
SpanMultiTermQueryWrapper fiv = new SpanMultiTermQueryWrapper(new WildcardQuery(new Term("field", "fiv*"))); SpanMultiTermQueryWrapper<WildcardQuery> fiv = new SpanMultiTermQueryWrapper<>(new WildcardQuery(new Term("field", "fiv*")));
SpanMultiTermQueryWrapper hund = new SpanMultiTermQueryWrapper(new WildcardQuery(new Term("field", "hund*"))); SpanMultiTermQueryWrapper<WildcardQuery> hund = new SpanMultiTermQueryWrapper<>(new WildcardQuery(new Term("field", "hund*")));
SpanMultiTermQueryWrapper twent = new SpanMultiTermQueryWrapper(new WildcardQuery(new Term("field", "twent*"))); SpanMultiTermQueryWrapper<WildcardQuery> twent = new SpanMultiTermQueryWrapper<>(new WildcardQuery(new Term("field", "twent*")));
SpanMultiTermQueryWrapper nin = new SpanMultiTermQueryWrapper(new WildcardQuery(new Term("field", "nin*"))); SpanMultiTermQueryWrapper<WildcardQuery> nin = new SpanMultiTermQueryWrapper<>(new WildcardQuery(new Term("field", "nin*")));
SpanNearQuery sq = new SpanNearQuery(new SpanQuery[] {fiv, hund, twent, nin}, 0, true); SpanNearQuery sq = new SpanNearQuery(new SpanQuery[] {fiv, hund, twent, nin}, 0, true);