Skip to content

Apache Lucene open-source search software

LUCENE-5969: beef up AssertingLiveDocs more

Robert Muir82a41114a74f
diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingLiveDocsFormat.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingLiveDocsFormat.java
index 378da1503d8..d6d349e12dc 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingLiveDocsFormat.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingLiveDocsFormat.java
@@ -39,6 +39,10 @@ public class AssertingLiveDocsFormat extends LiveDocsFormat {
assert size >= 0;
MutableBits raw = in.newLiveDocs(size);
assert raw != null;
+ assert raw.length() == size;
+ for (int i = 0; i < raw.length(); i++) {
+ assert raw.get(i);
+ }
return new AssertingMutableBits(raw);
}
@@ -48,6 +52,10 @@ public class AssertingLiveDocsFormat extends LiveDocsFormat {
Bits rawExisting = ((AssertingBits)existing).in;
MutableBits raw = in.newLiveDocs(rawExisting);
assert raw != null;
+ assert raw.length() == rawExisting.length();
+ for (int i = 0; i < raw.length(); i++) {
+ assert rawExisting.get(i) == raw.get(i);
+ }
return new AssertingMutableBits(raw);
}