diff --git a/lucene/core/src/test/org/apache/lucene/index/TestBagOfPostings.java b/lucene/core/src/test/org/apache/lucene/index/TestBagOfPostings.java index bf6993da75a..f4e66faea1e 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestBagOfPostings.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestBagOfPostings.java @@ -25,9 +25,6 @@ import java.util.Set; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.CountDownLatch; -import org.apache.lucene.codecs.Codec; -import org.apache.lucene.codecs.PostingsFormat; -import org.apache.lucene.codecs.perfield.PerFieldPostingsFormat; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.store.Directory; @@ -47,17 +44,7 @@ public class TestBagOfPostings extends LuceneTestCase { int numTerms = atLeast(300); final int maxTermsPerDoc = _TestUtil.nextInt(random(), 10, 20); - boolean isSimpleText = false; - Codec defaultCodec = Codec.getDefault(); - - if (defaultCodec.getName().equals("SimpleText")) { - isSimpleText = true; - } else { - PostingsFormat defaultPostingsFormat = defaultCodec.postingsFormat(); - if (defaultPostingsFormat instanceof PerFieldPostingsFormat) { - isSimpleText = ((PerFieldPostingsFormat) defaultPostingsFormat).getPostingsFormatForField("field").getName().equals("SimpleText"); - } - } + boolean isSimpleText = "SimpleText".equals(_TestUtil.getPostingsFormat("field")); if (isSimpleText && TEST_NIGHTLY) { // Otherwise test can take way too long (> 2 hours)