| 1 |
|
package org.apache.lucene.search; |
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
import junit.framework.TestCase; |
| 20 |
|
import org.apache.lucene.index.Term; |
| 21 |
|
|
|
|
|
| 95% |
Uncovered Elements: 1 (20) |
Complexity: 3 |
Complexity Density: 0.17 |
|
| 22 |
|
public class TestBooleanQuery extends TestCase { |
| 23 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 1 |
Complexity Density: 0.07 |
1
PASS
|
|
| 24 |
1
|
public void testEquality() throws Exception {... |
| 25 |
1
|
BooleanQuery bq1 = new BooleanQuery(); |
| 26 |
1
|
bq1.add(new TermQuery(new Term("field", "value1")), BooleanClause.Occur.SHOULD); |
| 27 |
1
|
bq1.add(new TermQuery(new Term("field", "value2")), BooleanClause.Occur.SHOULD); |
| 28 |
1
|
BooleanQuery nested1 = new BooleanQuery(); |
| 29 |
1
|
nested1.add(new TermQuery(new Term("field", "nestedvalue1")), BooleanClause.Occur.SHOULD); |
| 30 |
1
|
nested1.add(new TermQuery(new Term("field", "nestedvalue2")), BooleanClause.Occur.SHOULD); |
| 31 |
1
|
bq1.add(nested1, BooleanClause.Occur.SHOULD); |
| 32 |
|
|
| 33 |
1
|
BooleanQuery bq2 = new BooleanQuery(); |
| 34 |
1
|
bq2.add(new TermQuery(new Term("field", "value1")), BooleanClause.Occur.SHOULD); |
| 35 |
1
|
bq2.add(new TermQuery(new Term("field", "value2")), BooleanClause.Occur.SHOULD); |
| 36 |
1
|
BooleanQuery nested2 = new BooleanQuery(); |
| 37 |
1
|
nested2.add(new TermQuery(new Term("field", "nestedvalue1")), BooleanClause.Occur.SHOULD); |
| 38 |
1
|
nested2.add(new TermQuery(new Term("field", "nestedvalue2")), BooleanClause.Occur.SHOULD); |
| 39 |
1
|
bq2.add(nested2, BooleanClause.Occur.SHOULD); |
| 40 |
|
|
| 41 |
1
|
assertEquals(bq1, bq2); |
| 42 |
|
} |
| 43 |
|
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
1
PASS
|
|
| 44 |
1
|
public void testException() {... |
| 45 |
1
|
try { |
| 46 |
1
|
BooleanQuery.setMaxClauseCount(0); |
| 47 |
0
|
fail(); |
| 48 |
|
} catch (IllegalArgumentException e) { |
| 49 |
|
|
| 50 |
|
} |
| 51 |
|
} |
| 52 |
|
|
| 53 |
|
} |