Skip to content

Apache Lucene open-source search software

the test for getFieldNames(boolean) was not correct CVS: ---------------------------------------------------------------------- CVS: PR: CVS: If this change addresses a PR in the problem report tracking CVS: database, then enter the PR number(s) here. CVS: Obtained from: CVS: If this change has been taken from another system, such as NCSA, CVS: then name the system in this line, otherwise delete it. CVS: Submitted by: CVS: If this code has been contributed to Apache by someone else; i.e., CVS: they sent us a patch or a new module, then include their name/email CVS: address here. If this is your work then delete this line. CVS: Reviewed by: CVS: If we are doing pre-commit code reviews and someone else has CVS: reviewed your changes, include their name(s) here. CVS: If you have not had it reviewed then delete this line.

Daniel Naberc5e21fb41828
diff --git a/src/test/org/apache/lucene/index/TestIndexReader.java b/src/test/org/apache/lucene/index/TestIndexReader.java
index b4a1d960eef..5678cef862a 100644
--- a/src/test/org/apache/lucene/index/TestIndexReader.java
+++ b/src/test/org/apache/lucene/index/TestIndexReader.java
@@ -83,6 +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?!)
assertTrue(fieldNames.contains("keyword"));
assertTrue(fieldNames.contains("text"));
assertTrue(fieldNames.contains("unindexed"));
@@ -94,17 +95,19 @@ public class TestIndexReader extends TestCase
// verify that only indexed fields were returned
Collection indexedFieldNames = reader.getFieldNames(true);
- assertTrue(fieldNames.contains("keyword"));
- assertTrue(fieldNames.contains("text"));
- assertTrue(fieldNames.contains("unstored"));
- assertTrue(fieldNames.contains("keyword2"));
- assertTrue(fieldNames.contains("text2"));
- assertTrue(fieldNames.contains("unindexed2"));
- assertTrue(fieldNames.contains("unstored2"));
+ assertEquals(6, indexedFieldNames.size());
+ assertTrue(indexedFieldNames.contains("keyword"));
+ assertTrue(indexedFieldNames.contains("text"));
+ assertTrue(indexedFieldNames.contains("unstored"));
+ assertTrue(indexedFieldNames.contains("keyword2"));
+ assertTrue(indexedFieldNames.contains("text2"));
+ assertTrue(indexedFieldNames.contains("unstored2"));
// verify that only unindexed fields were returned
Collection unindexedFieldNames = reader.getFieldNames(false);
- assertTrue(fieldNames.contains("unindexed"));
+ assertEquals(3, unindexedFieldNames.size()); // the following fields + an empty one
+ assertTrue(unindexedFieldNames.contains("unindexed"));
+ assertTrue(unindexedFieldNames.contains("unindexed2"));
}