Skip to content

Apache Lucene open-source search software

make tests work again with bug fix in Reader getFieldNames

Bernhard Messer785e50ba82ad
diff --git a/src/test/org/apache/lucene/index/TestFieldInfos.java b/src/test/org/apache/lucene/index/TestFieldInfos.java
index ebad5d2d531..22ffe9c127c 100644
--- a/src/test/org/apache/lucene/index/TestFieldInfos.java
+++ b/src/test/org/apache/lucene/index/TestFieldInfos.java
@@ -31,7 +31,7 @@ public class TestFieldInfos extends TestCase {
FieldInfos fieldInfos = new FieldInfos();
fieldInfos.add(testDoc);
//Since the complement is stored as well in the fields map
- assertTrue(fieldInfos.size() == 7); //this is 7 b/c we are using the no-arg constructor
+ assertTrue(fieldInfos.size() == 6); //this is 6 b/c we are using the no-arg constructor
RAMDirectory dir = new RAMDirectory();
String name = "testFile";
IndexOutput output = dir.createOutput(name);
diff --git a/src/test/org/apache/lucene/index/TestIndexReader.java b/src/test/org/apache/lucene/index/TestIndexReader.java
index ff77f8af58f..b28f7679747 100644
--- a/src/test/org/apache/lucene/index/TestIndexReader.java
+++ b/src/test/org/apache/lucene/index/TestIndexReader.java
@@ -83,7 +83,7 @@ public class TestIndexReader extends TestCase
// verify fields again
reader = IndexReader.open(d);
fieldNames = reader.getFieldNames();
- assertEquals(9, fieldNames.size()); // the following fields + an empty one (bug?!)
+ assertEquals(8, fieldNames.size()); // the following fields
assertTrue(fieldNames.contains("keyword"));
assertTrue(fieldNames.contains("text"));
assertTrue(fieldNames.contains("unindexed"));
@@ -105,7 +105,7 @@ public class TestIndexReader extends TestCase
// verify that only unindexed fields were returned
Collection unindexedFieldNames = reader.getFieldNames(false);
- assertEquals(3, unindexedFieldNames.size()); // the following fields + an empty one
+ assertEquals(2, unindexedFieldNames.size()); // the following fields
assertTrue(unindexedFieldNames.contains("unindexed"));
assertTrue(unindexedFieldNames.contains("unindexed2"));
}
diff --git a/src/test/org/apache/lucene/index/TestSegmentReader.java b/src/test/org/apache/lucene/index/TestSegmentReader.java
index 507ac3cddab..86369cc3a32 100644
--- a/src/test/org/apache/lucene/index/TestSegmentReader.java
+++ b/src/test/org/apache/lucene/index/TestSegmentReader.java
@@ -106,7 +106,7 @@ public class TestSegmentReader extends TestCase {
public void testGetFieldNameVariations() {
Collection result = reader.getFieldNames();
assertTrue(result != null);
- assertTrue(result.size() == 7);
+ assertTrue(result.size() == 6);
for (Iterator iter = result.iterator(); iter.hasNext();) {
String s = (String) iter.next();
//System.out.println("Name: " + s);
@@ -122,7 +122,7 @@ public class TestSegmentReader extends TestCase {
result = reader.getFieldNames(false);
assertTrue(result != null);
- assertTrue(result.size() == 2);
+ assertTrue(result.size() == 1);
//Get all indexed fields that are storing term vectors
result = reader.getIndexedFieldNames(true);
assertTrue(result != null);