Clover Coverage Report
Coverage timestamp: Fri May 9 2008 10:54:27 EST
18   53   3   9
0   29   0.17   2
2     1.5  
1    
 
  TestBooleanQuery       Line # 22 18 3 95% 0.95
 
  (2)
 
1    package org.apache.lucene.search;
2   
3    /**
4    * Copyright 2004-2005 The Apache Software Foundation
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10    * http://www.apache.org/licenses/LICENSE-2.0
11    *
12    * Unless required by applicable law or agreed to in writing, software
13    * distributed under the License is distributed on an "AS IS" BASIS,
14    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15    * See the License for the specific language governing permissions and
16    * limitations under the License.
17    */
18   
19    import junit.framework.TestCase;
20    import org.apache.lucene.index.Term;
21   
 
22    public class TestBooleanQuery extends TestCase {
23   
 
24  1 toggle 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   
 
44  1 toggle public void testException() {
45  1 try {
46  1 BooleanQuery.setMaxClauseCount(0);
47  0 fail();
48    } catch (IllegalArgumentException e) {
49    // okay
50    }
51    }
52   
53    }