LUCENE-7414: TestUtil.checkIterator can make tests very slow

This commit is contained in:
Robert Muir 2016-08-16 16:12:55 -04:00
parent dd927dba2a
commit 7c6ea8e1e8
1 changed files with 8 additions and 5 deletions

View File

@ -177,6 +177,8 @@ public final class TestUtil {
assert hasNext;
T v = iterator.next();
assert allowNull || v != null;
// for the first element, check that remove is not supported
if (i == 0) {
try {
iterator.remove();
throw new AssertionError("broken iterator (supports remove): " + iterator);
@ -184,6 +186,7 @@ public final class TestUtil {
// ok
}
}
}
assert !iterator.hasNext();
try {
iterator.next();