Buggy code:
public class TestValueSources extends LuceneTestCase { static Directory dir ; static IndexReader reader ; static IndexSearcher searcher ; static final List < String [ ] > documents = Arrays . asList ( new String [ ] [ ] { new String [ ] { "0" , "3.63" , "5.2" , "35" , "4343" , "test" , "this<seq2seq4repair_space>is<seq2seq4repair_space>a<seq2seq4repair_space>test<seq2seq4repair_space>test<seq2seq4repair_space>test" } , new String [ ] { "1" , "5.65" , "9.3" , "54" , "1954" , "bar" , "second<seq2seq4repair_space>test" } } ) ; @ BeforeClass public static void beforeClass ( ) throws Exception { TestValueSources . dir = newDirectory ( ) ; IndexWriterConfig iwConfig = newIndexWriterConfig ( TEST_VERSION_CURRENT , new org . apache . lucene . analysis . MockAnalyzer ( random ( ) ) ) ; iwConfig . setMergePolicy ( newLogMergePolicy ( ) ) ; RandomIndexWriter iw = new RandomIndexWriter ( random ( ) , TestValueSources . dir , iwConfig ) ; Document document = new Document ( ) ; Field idField = new org . apache . lucene . document . StringField ( "id" , "" , Store . NO ) ; document . add ( idField ) ; Field doubleField = new org . apache . lucene . document . DoubleField ( "double" , 0.0 , Store . NO ) ; document . add ( doubleField ) ; Field floatField = new org . apache . lucene . document . FloatField ( "float" , 0.0F , Store . NO ) ; document . add ( floatField ) ; Field intField = new org . apache . lucene . document . IntField ( "int" , 0 , Store . NO ) ; document . add ( intField ) ; Field longField = new org . apache . lucene . document . LongField ( "long" , 0L , Store . NO ) ; document . add ( longField ) ; Field stringField = new org . apache . lucene . document . StringField ( "string" , "" , Store . NO ) ; document . add ( stringField ) ; Field textField = new org . apache . lucene . document . TextField ( "text" , "" , Store . NO ) ; document . add ( textField ) ; for ( String [ ] doc : TestValueSources . documents ) { idField . setStringValue ( doc [ 0 ] ) ; doubleField . setDoubleValue ( Double . valueOf ( doc [ 1 ] ) ) ; floatField . setFloatValue ( Float . valueOf ( doc [ 2 ] ) ) ; intField . setIntValue ( Integer . valueOf ( doc [ 3 ] ) ) ; longField . setLongValue ( Long . valueOf ( doc [ 4 ] ) ) ; stringField . setStringValue ( doc [ 5 ] ) ; textField . setStringValue ( doc [ 6 ] ) ; iw . addDocument ( document ) ; } TestValueSources . reader = iw . getReader ( ) ; TestValueSources . searcher = newSearcher ( TestValueSources . reader ) ; <START_BUG> iw . close ( ) ; <END_BUG> } @ AfterClass public static void afterClass ( ) throws Exception { } public void testConst ( ) throws Exception { } public void testDiv ( ) throws Exception { } public void testDocFreq ( ) throws Exception { } public void testDoubleConst ( ) throws Exception { } public void testDouble ( ) throws Exception { } public void testFloat ( ) throws Exception { } public void testIDF ( ) throws Exception { } public void testIf ( ) throws Exception { } public void testInt ( ) throws Exception { } public void testJoinDocFreq ( ) throws Exception { } public void testLinearFloat ( ) throws Exception { } public void testLong ( ) throws Exception { } public void testMaxDoc ( ) throws Exception { } public void testMaxFloat ( ) throws Exception { } public void testMinFloat ( ) throws Exception { } public void testNorm ( ) throws Exception { } public void testNumDocs ( ) throws Exception { } public void testPow ( ) throws Exception { } public void testProduct ( ) throws Exception { } public void testQuery ( ) throws Exception { } public void testRangeMap ( ) throws Exception { } public void testReciprocal ( ) throws Exception { } public void testScale ( ) throws Exception { } public void testSumFloat ( ) throws Exception { } public void testSumTotalTermFreq ( ) throws Exception { } public void testTermFreq ( ) throws Exception { } public void testTF ( ) throws Exception { } public void testTotalTermFreq ( ) throws Exception { } void assertHits ( Query q , float [ ] scores ) throws Exception { } }

Fix:
iw . shutdown ( ) ;