Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

remove System.out.printlns from tests

Erik Hatcher7d0398069757
diff --git a/src/test/org/apache/lucene/TestSearch.java b/src/test/org/apache/lucene/TestSearch.java
index 53dc4dd1aff..abbd8e16b4d 100644
--- a/src/test/org/apache/lucene/TestSearch.java
+++ b/src/test/org/apache/lucene/TestSearch.java
@@ -82,13 +82,13 @@ public class TestSearch extends TestCase {
/** This test performs a number of searches. It also compares output
* of searches using multi-file index segments with single-file
- * index segments.
- *
+ * index segments.
+ *
* TODO: someone should check that the results of the searches are
* still correct by adding assert statements. Right now, the test
* passes if the results are the same between multi-file and
* single-file formats, even if the results are wrong.
- */
+ */
public void testSearch() throws Exception {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw, true);
@@ -96,28 +96,28 @@ public class TestSearch extends TestCase {
pw.close();
sw.close();
String multiFileOutput = sw.getBuffer().toString();
- System.out.println(multiFileOutput);
-
+ //System.out.println(multiFileOutput);
+
sw = new StringWriter();
pw = new PrintWriter(sw, true);
doTestSearch(pw, true);
pw.close();
sw.close();
String singleFileOutput = sw.getBuffer().toString();
-
+
assertEquals(multiFileOutput, singleFileOutput);
}
-
-
+
+
private void doTestSearch(PrintWriter out, boolean useCompoundFile)
throws Exception
{
- Directory directory = new RAMDirectory();
+ Directory directory = new RAMDirectory();
Analyzer analyzer = new SimpleAnalyzer();
IndexWriter writer = new IndexWriter(directory, analyzer, true);
writer.setUseCompoundFile(useCompoundFile);
-
+
String[] docs = {
"a b c d e",
"a b c d e a b c d e",
@@ -135,7 +135,7 @@ public class TestSearch extends TestCase {
writer.close();
Searcher searcher = new IndexSearcher(directory);
-
+
String[] queries = {
"a b",
"\"a b\"",
diff --git a/src/test/org/apache/lucene/TestSearchForDuplicates.java b/src/test/org/apache/lucene/TestSearchForDuplicates.java
index bc6d3b61d68..949b5613d58 100644
--- a/src/test/org/apache/lucene/TestSearchForDuplicates.java
+++ b/src/test/org/apache/lucene/TestSearchForDuplicates.java
@@ -80,7 +80,7 @@ public class TestSearchForDuplicates extends TestCase {
public static void main(String args[]) {
TestRunner.run (new TestSuite(TestSearchForDuplicates.class));
}
-
+
static final String PRIORITY_FIELD ="priority";
@@ -89,10 +89,10 @@ public class TestSearchForDuplicates extends TestCase {
static final String MED_PRIORITY ="medium";
static final String LOW_PRIORITY ="low";
-
+
/** This test compares search results when using and not using compound
- * files.
- *
+ * files.
+ *
* TODO: There is rudimentary search result validation as well, but it is
* simply based on asserting the output observed in the old test case,
* without really knowing if the output is correct. Someone needs to
@@ -105,26 +105,26 @@ public class TestSearchForDuplicates extends TestCase {
pw.close();
sw.close();
String multiFileOutput = sw.getBuffer().toString();
- System.out.println(multiFileOutput);
-
+ //System.out.println(multiFileOutput);
+
sw = new StringWriter();
pw = new PrintWriter(sw, true);
doTest(pw, true);
pw.close();
sw.close();
String singleFileOutput = sw.getBuffer().toString();
-
+
assertEquals(multiFileOutput, singleFileOutput);
}
-
-
+
+
private void doTest(PrintWriter out, boolean useCompoundFiles) throws Exception {
Directory directory = new RAMDirectory();
Analyzer analyzer = new SimpleAnalyzer();
IndexWriter writer = new IndexWriter(directory, analyzer, true);
writer.setUseCompoundFile(useCompoundFiles);
-
+
final int MAX_DOCS = 225;
for (int j = 0; j < MAX_DOCS; j++) {
@@ -166,7 +166,7 @@ public class TestSearchForDuplicates extends TestCase {
searcher.close();
}
-
+
private void printHits(PrintWriter out, Hits hits ) throws IOException {
out.println(hits.length() + " total results\n");
for (int i = 0 ; i < hits.length(); i++) {
@@ -176,7 +176,7 @@ public class TestSearchForDuplicates extends TestCase {
}
}
}
-
+
private void checkHits(Hits hits, int expectedCount) throws IOException {
assertEquals("total results", expectedCount, hits.length());
for (int i = 0 ; i < hits.length(); i++) {
diff --git a/src/test/org/apache/lucene/index/TestDoc.java b/src/test/org/apache/lucene/index/TestDoc.java
index 3b94ffe0033..b86b7056e64 100644
--- a/src/test/org/apache/lucene/index/TestDoc.java
+++ b/src/test/org/apache/lucene/index/TestDoc.java
@@ -163,7 +163,7 @@ public class TestDoc extends TestCase {
out.close();
sw.close();
String multiFileOutput = sw.getBuffer().toString();
- System.out.println(multiFileOutput);
+ //System.out.println(multiFileOutput);
sw = new StringWriter();
out = new PrintWriter(sw, true);
diff --git a/src/test/org/apache/lucene/search/TestNot.java b/src/test/org/apache/lucene/search/TestNot.java
index 712f286a53e..97790a9ad0e 100644
--- a/src/test/org/apache/lucene/search/TestNot.java
+++ b/src/test/org/apache/lucene/search/TestNot.java
@@ -79,18 +79,18 @@ public class TestNot extends TestCase {
public void testNot() throws Exception {
RAMDirectory store = new RAMDirectory();
IndexWriter writer = new IndexWriter(store, new SimpleAnalyzer(), true);
-
+
Document d1 = new Document();
d1.add(Field.Text("field", "a b"));
-
+
writer.addDocument(d1);
writer.optimize();
writer.close();
Searcher searcher = new IndexSearcher(store);
Query query = QueryParser.parse("a NOT b", "field", new SimpleAnalyzer());
- System.out.println(query);
- Hits hits = searcher.search(query);
+ //System.out.println(query);
+ Hits hits = searcher.search(query);
assertEquals(0, hits.length());
}
}