| 1 |
|
package org.apache.lucene.analysis; |
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
import java.io.IOException; |
| 20 |
|
import java.io.StringReader; |
| 21 |
|
|
| 22 |
|
import junit.framework.TestCase; |
| 23 |
|
|
| 24 |
|
|
| 25 |
|
@author |
| 26 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 2 |
Complexity Density: 0.18 |
|
| 27 |
|
public class TestStopFilter extends TestCase { |
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1
PASS
|
|
| 31 |
1
|
public void testExactCase() throws IOException {... |
| 32 |
1
|
StringReader reader = new StringReader("Now is The Time"); |
| 33 |
1
|
String[] stopWords = new String[] { "is", "the", "Time" }; |
| 34 |
1
|
TokenStream stream = new StopFilter(new WhitespaceTokenizer(reader), stopWords); |
| 35 |
1
|
assertEquals("Now", stream.next().termText()); |
| 36 |
1
|
assertEquals("The", stream.next().termText()); |
| 37 |
1
|
assertEquals(null, stream.next()); |
| 38 |
|
} |
| 39 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1
PASS
|
|
| 40 |
1
|
public void testIgnoreCase() throws IOException {... |
| 41 |
1
|
StringReader reader = new StringReader("Now is The Time"); |
| 42 |
1
|
String[] stopWords = new String[] { "is", "the", "Time" }; |
| 43 |
1
|
TokenStream stream = new StopFilter(new WhitespaceTokenizer(reader), stopWords, true); |
| 44 |
1
|
assertEquals("Now", stream.next().termText()); |
| 45 |
1
|
assertEquals(null,stream.next()); |
| 46 |
|
} |
| 47 |
|
|
| 48 |
|
} |