mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-13 21:01:01 +08:00
Merge pull request #1724 from querydsl/remove-duplicate-logic
Remove duplicate lucene test logic
This commit is contained in:
commit
382ecd3dfe
@ -18,6 +18,7 @@ import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
@ -39,6 +40,7 @@ import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.querydsl.core.*;
|
||||
import com.querydsl.core.types.*;
|
||||
import com.querydsl.core.types.dsl.*;
|
||||
@ -78,6 +80,9 @@ public class LuceneSerializerTest {
|
||||
private IndexWriter writer;
|
||||
private IndexSearcher searcher;
|
||||
|
||||
private static final Set<? extends Operator> UNSUPPORTED_OPERATORS = Sets.immutableEnumSet(Ops.STARTS_WITH_IC,
|
||||
Ops.EQ_IGNORE_CASE, Ops.ENDS_WITH_IC, Ops.STRING_CONTAINS_IC);
|
||||
|
||||
private final QueryMetadata metadata = new DefaultQueryMetadata();
|
||||
|
||||
private Document createDocument() {
|
||||
@ -635,14 +640,7 @@ public class LuceneSerializerTest {
|
||||
}
|
||||
|
||||
private boolean unsupportedOperation(Predicate filter) {
|
||||
if (filter instanceof Operation<?>) {
|
||||
Operator op = ((Operation<?>) filter).getOperator();
|
||||
if (op == Ops.STARTS_WITH_IC || op == Ops.EQ_IGNORE_CASE || op == Ops.STARTS_WITH_IC
|
||||
|| op == Ops.ENDS_WITH_IC || op == Ops.STRING_CONTAINS_IC) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return UNSUPPORTED_OPERATORS.contains(((Operation<?>) filter).getOperator());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@ -18,6 +18,7 @@ import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
||||
import org.apache.lucene.document.*;
|
||||
@ -36,6 +37,7 @@ import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.querydsl.core.*;
|
||||
import com.querydsl.core.types.*;
|
||||
import com.querydsl.core.types.dsl.*;
|
||||
@ -75,6 +77,9 @@ public class LuceneSerializerTest {
|
||||
private IndexWriter writer;
|
||||
private IndexSearcher searcher;
|
||||
|
||||
private static final Set<? extends Operator> UNSUPPORTED_OPERATORS = Sets.immutableEnumSet(Ops.STARTS_WITH_IC,
|
||||
Ops.EQ_IGNORE_CASE, Ops.ENDS_WITH_IC, Ops.STRING_CONTAINS_IC);
|
||||
|
||||
private final QueryMetadata metadata = new DefaultQueryMetadata();
|
||||
|
||||
private Document createDocument() {
|
||||
@ -637,14 +642,7 @@ public class LuceneSerializerTest {
|
||||
}
|
||||
|
||||
private boolean unsupportedOperation(Predicate filter) {
|
||||
if (filter instanceof Operation<?>) {
|
||||
Operator op = ((Operation<?>) filter).getOperator();
|
||||
if (op == Ops.STARTS_WITH_IC || op == Ops.EQ_IGNORE_CASE || op == Ops.STARTS_WITH_IC
|
||||
|| op == Ops.ENDS_WITH_IC || op == Ops.STRING_CONTAINS_IC) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return UNSUPPORTED_OPERATORS.contains(((Operation<?>) filter).getOperator());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@ -18,6 +18,7 @@ import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
@ -41,6 +42,7 @@ import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.querydsl.core.DefaultQueryMetadata;
|
||||
import com.querydsl.core.MatchingFiltersFactory;
|
||||
@ -95,6 +97,9 @@ public class LuceneSerializerTest {
|
||||
private IndexWriter writer;
|
||||
private IndexSearcher searcher;
|
||||
|
||||
private static final Set<? extends Operator> UNSUPPORTED_OPERATORS = Sets.immutableEnumSet(Ops.STARTS_WITH_IC,
|
||||
Ops.EQ_IGNORE_CASE, Ops.ENDS_WITH_IC, Ops.STRING_CONTAINS_IC);
|
||||
|
||||
private final QueryMetadata metadata = new DefaultQueryMetadata();
|
||||
|
||||
private Document createDocument() {
|
||||
@ -712,15 +717,7 @@ public class LuceneSerializerTest {
|
||||
}
|
||||
|
||||
private boolean unsupportedOperation(Predicate filter) {
|
||||
if (filter instanceof Operation<?>) {
|
||||
Operator op = ((Operation<?>) filter).getOperator();
|
||||
if (op == Ops.STARTS_WITH_IC || op == Ops.EQ_IGNORE_CASE
|
||||
|| op == Ops.STARTS_WITH_IC || op == Ops.ENDS_WITH_IC
|
||||
|| op == Ops.STRING_CONTAINS_IC) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return UNSUPPORTED_OPERATORS.contains(((Operation<?>) filter).getOperator());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Loading…
Reference in New Issue
Block a user