use _TestUtil helper instead of lots of coe

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1399923 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2012-10-18 23:29:29 +00:00
parent 03b98ef455
commit d80c59b48a
1 changed files with 1 additions and 14 deletions

View File

@ -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)