}
assertEquals("invalid maxDoc: " + doc, maxDoc, doc);
DocIdSet docIDs = all.getDocIDs();
assertTrue("should be cacheable", docIDs.isCacheable());
DocIdSetIterator docIDsIter = docIDs.iterator();
assertEquals("nextDoc() hasn't been called yet", -1, docIDsIter.docID());
assertEquals(0, docIDsIter.nextDoc());
assertEquals(1, docIDsIter.advance(1));
// if advance is smaller than current doc, advance to cur+1.
assertEquals(2, docIDsIter.advance(0));
} finally {
reader.close();
dir.close();
}
}