avoid compiler/Eclipse warnings

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@344468 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Naber 2005-11-15 23:15:53 +00:00
parent 292c9dfa72
commit 7e079d2950
3 changed files with 7 additions and 16 deletions

View File

@ -46,8 +46,8 @@ public class BooleanQueryTest {
public void collect(int docNr, float score) { public void collect(int docNr, float score) {
/* System.out.println(docNr + " '" + dBase.getDocs()[docNr] + "': " + score); */ /* System.out.println(docNr + " '" + dBase.getDocs()[docNr] + "': " + score); */
testCase.assertTrue(queryText + ": positive score", score > 0.0); TestCase.assertTrue(queryText + ": positive score", score > 0.0);
testCase.assertTrue(queryText + ": too many hits", totalMatched < expectedDocNrs.length); TestCase.assertTrue(queryText + ": too many hits", totalMatched < expectedDocNrs.length);
int i; int i;
for (i = 0; i < expectedDocNrs.length; i++) { for (i = 0; i < expectedDocNrs.length; i++) {
if ((! encountered[i]) && (expectedDocNrs[i] == docNr)) { if ((! encountered[i]) && (expectedDocNrs[i] == docNr)) {
@ -56,25 +56,24 @@ public class BooleanQueryTest {
} }
} }
if (i == expectedDocNrs.length) { if (i == expectedDocNrs.length) {
testCase.assertTrue(queryText + ": doc nr for hit not expected: " + docNr, false); TestCase.assertTrue(queryText + ": doc nr for hit not expected: " + docNr, false);
} }
totalMatched++; totalMatched++;
} }
void checkNrHits() { void checkNrHits() {
testCase.assertEquals(queryText + ": nr of hits", expectedDocNrs.length, totalMatched); TestCase.assertEquals(queryText + ": nr of hits", expectedDocNrs.length, totalMatched);
} }
} }
public void doTest() throws Exception { public void doTest() throws Exception {
QueryParser parser = new QueryParser();
if (verbose) { if (verbose) {
System.out.println(""); System.out.println("");
System.out.println("Query: " + queryText); System.out.println("Query: " + queryText);
} }
SrndQuery lq = parser.parse(queryText); SrndQuery lq = QueryParser.parse(queryText);
/* if (verbose) System.out.println("Srnd: " + lq.toString()); */ /* if (verbose) System.out.println("Srnd: " + lq.toString()); */

View File

@ -1,30 +1,23 @@
package org.apache.lucene.queryParser.surround.query; package org.apache.lucene.queryParser.surround.query;
import org.apache.lucene.search.Query;
import org.apache.lucene.queryParser.surround.parser.QueryParser;
import org.apache.lucene.queryParser.surround.parser.ParseException; import org.apache.lucene.queryParser.surround.parser.ParseException;
import org.apache.lucene.queryParser.surround.parser.QueryParser;
import junit.framework.TestCase;
public class ExceptionQueryTest { public class ExceptionQueryTest {
private String queryText; private String queryText;
private boolean verbose; private boolean verbose;
private TestCase testCase;
public ExceptionQueryTest(String queryText, boolean verbose) { public ExceptionQueryTest(String queryText, boolean verbose) {
this.queryText = queryText; this.queryText = queryText;
this.verbose = verbose; this.verbose = verbose;
this.testCase = testCase;
} }
public void doTest(StringBuffer failQueries) { public void doTest(StringBuffer failQueries) {
QueryParser parser = new QueryParser();
boolean pass = false; boolean pass = false;
SrndQuery lq = null; SrndQuery lq = null;
try { try {
lq = parser.parse(queryText); lq = QueryParser.parse(queryText);
if (verbose) { if (verbose) {
System.out.println("Query: " + queryText + "\nParsed as: " + lq.toString()); System.out.println("Query: " + queryText + "\nParsed as: " + lq.toString());
} }

View File

@ -12,7 +12,6 @@ public class SingleFieldTestDb {
private Directory db; private Directory db;
private String[] docs; private String[] docs;
private String fieldName; private String fieldName;
private String dbName = "testdb";
public SingleFieldTestDb(String[] documents, String fName) { public SingleFieldTestDb(String[] documents, String fName) {
try { try {