From 863c2191226ce9a791ee693795e0d211f9d7419d Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Mon, 19 Aug 2013 21:08:42 +0000 Subject: [PATCH] add checks git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene5178@1515605 13f79535-47bb-0310-9956-ffa450edef68 --- .../lucene/index/AssertingAtomicReader.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/AssertingAtomicReader.java b/lucene/test-framework/src/java/org/apache/lucene/index/AssertingAtomicReader.java index eb6b20df5eb..1bdb14cf574 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/index/AssertingAtomicReader.java +++ b/lucene/test-framework/src/java/org/apache/lucene/index/AssertingAtomicReader.java @@ -608,6 +608,32 @@ public class AssertingAtomicReader extends FilterAtomicReader { } } + @Override + public Bits getLiveDocs() { + Bits liveDocs = super.getLiveDocs(); + if (liveDocs != null) { + assert maxDoc() == liveDocs.length(); + } else { + assert maxDoc() == numDocs(); + assert !hasDeletions(); + } + return liveDocs; + } + + @Override + public Bits getDocsWithField(String field) throws IOException { + Bits docsWithField = super.getDocsWithField(field); + FieldInfo fi = getFieldInfos().fieldInfo(field); + if (docsWithField != null) { + assert fi != null; + assert fi.hasDocValues(); + assert maxDoc() == docsWithField.length(); + } else { + assert fi == null || fi.hasDocValues() == false; + } + return docsWithField; + } + // this is the same hack as FCInvisible @Override public Object getCoreCacheKey() {