From aa871242058ec17018aa76ac5485b0fd96f7a6b3 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Wed, 11 Jul 2012 14:36:06 +0000 Subject: [PATCH] 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 --- .../core/src/test/org/apache/lucene/index/TestCodecs.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java b/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java index 3f55f237d5d..7f50fa8ed08 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java @@ -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++;