Buggy code:
public class TestAddIndexes extends LuceneTestCase { public void testSimpleCase ( ) throws IOException { } public void testWithPendingDeletes ( ) throws IOException { } public void testWithPendingDeletes2 ( ) throws IOException { } public void testWithPendingDeletes3 ( ) throws IOException { } public void testAddSelf ( ) throws IOException { } public void testNoTailSegments ( ) throws IOException { } public void testNoCopySegments ( ) throws IOException { } public void testNoMergeAfterCopy ( ) throws IOException { } public void testMergeAfterCopy ( ) throws IOException { } public void testMoreMerges ( ) throws IOException { } private IndexWriter newWriter ( Directory dir , IndexWriterConfig conf ) throws IOException { } private void addDocs ( IndexWriter writer , int numDocs ) throws IOException { } private void addDocs2 ( IndexWriter writer , int numDocs ) throws IOException { } private void verifyNumDocs ( Directory dir , int numDocs ) throws IOException { } private void verifyTermDocs ( Directory dir , Term term , int numDocs ) throws IOException { IndexReader reader = DirectoryReader . open ( dir ) ; <START_BUG> DocsEnum docsEnum = _TestUtil . docs ( random ( ) , reader , term . field , term . bytes , null , null , 0 ) ; <END_BUG> int count = 0 ; while ( ( docsEnum . nextDoc ( ) ) != ( DocIdSetIterator . NO_MORE_DOCS ) ) count ++ ; assertEquals ( numDocs , count ) ; reader . close ( ) ; } private void setUpDirs ( Directory dir , Directory aux ) throws IOException { } private void setUpDirs ( Directory dir , Directory aux , boolean withID ) throws IOException { } public void testHangOnClose ( ) throws IOException { } private void addDoc ( IndexWriter writer ) throws IOException { } private abstract class RunAddIndexesThreads { Directory dir ; Directory dir2 ; static final int NUM_INIT_DOCS = 17 ; IndexWriter writer2 ; final List < Throwable > failures = new ArrayList < Throwable > ( ) ; volatile boolean didClose ; final IndexReader [ ] readers ; final int NUM_COPY ; static final int NUM_THREADS = 5 ; final Thread [ ] threads = new Thread [ TestAddIndexes . RunAddIndexesThreads . NUM_THREADS ] ; public RunAddIndexesThreads ( int numCopy ) throws Throwable { } void launchThreads ( final int numIter ) { } void joinThreads ( ) throws Exception { } void close ( boolean doWait ) throws Throwable { } void closeDir ( ) throws Throwable { } abstract void doBody ( int j , Directory [ ] dirs ) throws Throwable { } abstract void handle ( Throwable t ) { } } private class CommitAndAddIndexes extends TestAddIndexes . RunAddIndexesThreads { public CommitAndAddIndexes ( int numCopy ) throws Throwable { } @ Override void handle ( Throwable t ) { } @ Override void doBody ( int j , Directory [ ] dirs ) throws Throwable { } } public void testAddIndexesWithThreads ( ) throws Throwable { } private class CommitAndAddIndexes2 extends TestAddIndexes . CommitAndAddIndexes { public CommitAndAddIndexes2 ( int numCopy ) throws Throwable { } @ Override void handle ( Throwable t ) { } } public void testAddIndexesWithClose ( ) throws Throwable { } private class CommitAndAddIndexes3 extends TestAddIndexes . RunAddIndexesThreads { public CommitAndAddIndexes3 ( int numCopy ) throws Throwable { } @ Override void doBody ( int j , Directory [ ] dirs ) throws Throwable { } @ Override void handle ( Throwable t ) { } } public void testAddIndexesWithCloseNoWait ( ) throws Throwable { } public void testAddIndexesWithRollback ( ) throws Throwable { } public void testExistingDeletes ( ) throws Exception { } private void addDocsWithID ( IndexWriter writer , int numDocs , int docStart ) throws IOException { } public void testSimpleCaseCustomCodec ( ) throws IOException { } private static final class CustomPerFieldCodec extends Lucene40Codec { private final PostingsFormat simpleTextFormat = PostingsFormat . forName ( "SimpleText" ) ; private final PostingsFormat defaultFormat = PostingsFormat . forName ( "Lucene40" ) ; private final PostingsFormat mockSepFormat = PostingsFormat . forName ( "MockSep" ) ; @ Override public PostingsFormat getPostingsFormatForField ( String field ) { } } public void testNonCFSLeftovers ( ) throws Exception { } private static class UnRegisteredCodec extends Codec { public UnRegisteredCodec ( ) { } @ Override public PostingsFormat postingsFormat ( ) { } @ Override public DocValuesFormat docValuesFormat ( ) { } @ Override public StoredFieldsFormat storedFieldsFormat ( ) { } @ Override public TermVectorsFormat termVectorsFormat ( ) { } @ Override public FieldInfosFormat fieldInfosFormat ( ) { } @ Override public SegmentInfoFormat segmentInfoFormat ( ) { } @ Override public NormsFormat normsFormat ( ) { } @ Override public LiveDocsFormat liveDocsFormat ( ) { } } public void testAddIndexMissingCodec ( ) throws IOException { } public void testFieldNamesChanged ( ) throws IOException { } }

Fix:
DocsEnum docsEnum = _TestUtil . docs ( random ( ) , reader , term . field , term . bytes , null , null , false ) ;