small cleanup only: imports; no need for try...catch(...) { fail(); } in a test case

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@543216 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Naber 2007-05-31 19:00:30 +00:00
parent 11dfdad8ab
commit 42c3d11f07
1 changed files with 46 additions and 50 deletions

View File

@ -1,22 +1,23 @@
package org.apache.lucene.search.spell; package org.apache.lucene.search.spell;
import junit.framework.*;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.analysis.SimpleAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.util.English;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexReader;
import java.io.IOException; import java.io.IOException;
import junit.framework.TestCase;
import org.apache.lucene.analysis.SimpleAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.store.Directory; import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.English;
/** /**
* Test case * Spell checker test case
* *
* @author Nicolas Maisonneuve * @author Nicolas Maisonneuve
*/ */
@ -45,8 +46,7 @@ public class TestSpellChecker extends TestCase {
} }
public void testBuild() { public void testBuild() throws CorruptIndexException, IOException {
try {
IndexReader r = IndexReader.open(userindex); IndexReader r = IndexReader.open(userindex);
spellChecker.clearIndex(); spellChecker.clearIndex();
@ -93,12 +93,7 @@ public class TestSpellChecker extends TestCase {
similar = spellChecker.suggestSimilar("tousand", 10, r, "field2", false); similar = spellChecker.suggestSimilar("tousand", 10, r, "field2", false);
assertEquals(1, similar.length); // there is the term thousand in the field field2 assertEquals(1, similar.length); // there is the term thousand in the field field2
} catch (IOException e) {
e.printStackTrace();
fail();
} }
}
private void addwords(IndexReader r, String field) throws IOException { private void addwords(IndexReader r, String field) throws IOException {
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
@ -115,4 +110,5 @@ public class TestSpellChecker extends TestCase {
rs.close(); rs.close();
return num; return num;
} }
} }