allow -1 from Fields.size()

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1508418 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2013-07-30 12:34:16 +00:00
parent 1a84b76403
commit 3bff59a588
1 changed files with 6 additions and 2 deletions

View File

@ -1151,7 +1151,9 @@ public abstract class BasePostingsFormatTestCase extends LuceneTestCase {
DirectoryReader ir = iw.getReader();
AtomicReader ar = getOnlySegmentReader(ir);
Fields fields = ar.fields();
assertTrue(fields.size() == 1);
int fieldCount = fields.size();
// -1 is allowed, if the codec doesn't implement fields.size():
assertTrue(fieldCount == 1 || fieldCount == -1);
Terms terms = ar.terms("");
assertNotNull(terms);
TermsEnum termsEnum = terms.iterator(null);
@ -1174,7 +1176,9 @@ public abstract class BasePostingsFormatTestCase extends LuceneTestCase {
DirectoryReader ir = iw.getReader();
AtomicReader ar = getOnlySegmentReader(ir);
Fields fields = ar.fields();
assertTrue(fields.size() == 1);
int fieldCount = fields.size();
// -1 is allowed, if the codec doesn't implement fields.size():
assertTrue(fieldCount == 1 || fieldCount == -1);
Terms terms = ar.terms("");
assertNotNull(terms);
TermsEnum termsEnum = terms.iterator(null);