Skip to content

Apache Lucene open-source search software

LUCENE-6559: Fix test, last collected doc can now be unknown

Simon Willnauera8649703310f
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestTimeLimitingCollector.java b/lucene/core/src/test/org/apache/lucene/search/TestTimeLimitingCollector.java
index 33c1901a903..8cad4ec229b 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestTimeLimitingCollector.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestTimeLimitingCollector.java
@@ -197,7 +197,7 @@ public class TestTimeLimitingCollector extends LuceneTestCase {
// greediness affect last doc collected
int exceptionDoc = timoutException.getLastDocCollected();
int lastCollected = myHc.getLastDocCollected();
- assertTrue( "doc collected at timeout must be > 0!", exceptionDoc > 0 );
+ assertTrue( "doc collected at timeout must be > 0! or == -1 but was: " + exceptionDoc, exceptionDoc == -1 || exceptionDoc > 0);
if (greedy) {
assertTrue("greedy="+greedy+" exceptionDoc="+exceptionDoc+" != lastCollected="+lastCollected, exceptionDoc==lastCollected);
assertTrue("greedy, but no hits found!", myHc.hitCount() > 0 );