diff --git a/lucene/core/src/test/org/apache/lucene/index/TestDuelingCodecs.java b/lucene/core/src/test/org/apache/lucene/index/TestDuelingCodecs.java index 989eda6559a..ed04eb2f54e 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestDuelingCodecs.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestDuelingCodecs.java @@ -22,6 +22,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Random; import java.util.Set; +import java.util.TreeSet; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.MockAnalyzer; @@ -34,7 +35,6 @@ import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.FixedBitSet; import org.apache.lucene.util.LineFileDocs; import org.apache.lucene.util.LuceneTestCase; -import org.apache.lucene.util.ReaderUtil; import org.apache.lucene.util.automaton.AutomatonTestUtil; import org.apache.lucene.util.automaton.CompiledAutomaton; import org.apache.lucene.util.automaton.RegExp; @@ -140,6 +140,7 @@ public class TestDuelingCodecs extends LuceneTestCase { assertTermVectors(leftReader, rightReader); assertDocValues(leftReader, rightReader); assertDeletedDocs(leftReader, rightReader); + assertFieldInfos(leftReader, rightReader); } /** @@ -614,6 +615,25 @@ public class TestDuelingCodecs extends LuceneTestCase { } } + public void assertFieldInfos(IndexReader leftReader, IndexReader rightReader) throws Exception { + FieldInfos leftInfos = MultiFields.getMergedFieldInfos(leftReader); + FieldInfos rightInfos = MultiFields.getMergedFieldInfos(rightReader); + + // TODO: would be great to verify more than just the names of the fields! + TreeSet left = new TreeSet(); + TreeSet right = new TreeSet(); + + for (FieldInfo fi : leftInfos) { + left.add(fi.name); + } + + for (FieldInfo fi : rightInfos) { + right.add(fi.name); + } + + assertEquals(info, left, right); + } + private static class RandomBits implements Bits { FixedBitSet bits;