Clover Coverage Report
Coverage timestamp: Fri May 9 2008 10:54:27 EST
10   46   2   5
0   23   0.2   2
2     1  
1    
 
  TestWordlistLoader       Line # 28 10 2 100% 1.0
 
  (1)
 
1    package org.apache.lucene.index;
2   
3    /**
4    * Copyright 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 java.io.BufferedReader;
20    import java.io.IOException;
21    import java.io.StringReader;
22    import java.util.HashSet;
23   
24    import junit.framework.TestCase;
25   
26    import org.apache.lucene.analysis.WordlistLoader;
27   
 
28    public class TestWordlistLoader extends TestCase {
29   
 
30  1 toggle public void testWordlistLoading() throws IOException {
31  1 String s = "ONE\n two \nthree";
32  1 HashSet wordSet1 = WordlistLoader.getWordSet(new StringReader(s));
33  1 checkSet(wordSet1);
34  1 HashSet wordSet2 = WordlistLoader.getWordSet(new BufferedReader(new StringReader(s)));
35  1 checkSet(wordSet2);
36    }
37   
 
38  2 toggle private void checkSet(HashSet wordset) {
39  2 assertEquals(3, wordset.size());
40  2 assertTrue(wordset.contains("ONE")); // case is not modified
41  2 assertTrue(wordset.contains("two")); // surrounding whitespace is removed
42  2 assertTrue(wordset.contains("three"));
43  2 assertFalse(wordset.contains("four"));
44    }
45   
46    }