fix test: don't call .nextDoc() if the enum had already returned NO_MORE_DOCS

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1360205 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2012-07-11 14:36:06 +00:00
parent 04bc7ee821
commit aa87124205
1 changed files with 5 additions and 1 deletions
lucene/core/src/test/org/apache/lucene/index

View File

@ -559,6 +559,7 @@ public class TestCodecs extends LuceneTestCase {
}
assertNotNull(docs);
int upto2 = -1;
boolean ended = false;
while(upto2 < term.docs.length-1) {
// Maybe skip:
final int left = term.docs.length-upto2;
@ -574,6 +575,7 @@ public class TestCodecs extends LuceneTestCase {
if (doc == DocIdSetIterator.NO_MORE_DOCS) {
// skipped past last doc
assert upto2 == term.docs.length-1;
ended = true;
break;
} else {
// skipped to next doc
@ -597,7 +599,9 @@ public class TestCodecs extends LuceneTestCase {
}
}
assertEquals(DocIdSetIterator.NO_MORE_DOCS, docs.nextDoc());
if (!ended) {
assertEquals(DocIdSetIterator.NO_MORE_DOCS, docs.nextDoc());
}
}
upto++;