I wrote a test that requires DocValues. It failed on me once because of the Codec randomization chose Lucene3x which doesn’t support DocValues. What’s the best way to adjust my test to assure this doesn’t happen?
What I ended up doing was this: indexWriterConfig.setCodec( _TestUtil.alwaysDocValuesFormat(new Lucene45DocValuesFormat())); But I don’t like that I hard-coded a particular format. (FYI the source file is an abstract base test class: SpatialTestCase, method newIndexWriterConfig ) Another approach might be to call: assumeTrue(defaultCodecSupportsDocValues()) Although sometimes the test of course won’t be run at all instead of it preferably forcing a compatible format. Thoughts? ~ David