Buggy code:
public class UIMABaseAnalyzerTest extends BaseTokenStreamTestCase { private UIMABaseAnalyzer analyzer ; @ Override @ Before public void setUp ( ) throws Exception { } @ Override @ After public void tearDown ( ) throws Exception { } @ Test public void baseUIMAAnalyzerStreamTest ( ) throws Exception { } @ Test public void baseUIMAAnalyzerIntegrationTest ( ) throws Exception { Directory dir = new RAMDirectory ( ) ; IndexWriter writer = new IndexWriter ( dir , new org . apache . lucene . index . IndexWriterConfig ( TEST_VERSION_CURRENT , analyzer ) ) ; Document doc = new Document ( ) ; String dummyTitle = "this<seq2seq4repair_space>is<seq2seq4repair_space>a<seq2seq4repair_space>dummy<seq2seq4repair_space>title<seq2seq4repair_space>" ; doc . add ( new org . apache . lucene . document . TextField ( "title" , dummyTitle , Store . YES ) ) ; String dummyContent = "there<seq2seq4repair_space>is<seq2seq4repair_space>some<seq2seq4repair_space>content<seq2seq4repair_space>written<seq2seq4repair_space>here" ; doc . add ( new org . apache . lucene . document . TextField ( "contents" , dummyContent , Store . YES ) ) ; writer . addDocument ( doc , analyzer ) ; writer . commit ( ) ; DirectoryReader directoryReader = DirectoryReader . open ( dir ) ; IndexSearcher indexSearcher = newSearcher ( directoryReader ) ; TopDocs result = indexSearcher . search ( new MatchAllDocsQuery ( ) , 1 ) ; assertTrue ( ( ( result . totalHits ) > 0 ) ) ; StoredDocument d = indexSearcher . doc ( result . scoreDocs [ 0 ] . doc ) ; assertNotNull ( d ) ; assertNotNull ( d . getField ( "title" ) ) ; assertEquals ( dummyTitle , d . getField ( "title" ) . stringValue ( ) ) ; assertNotNull ( d . getField ( "contents" ) ) ; assertEquals ( dummyContent , d . getField ( "contents" ) . stringValue ( ) ) ; doc = new Document ( ) ; String dogmasTitle = "dogmas" ; doc . add ( new org . apache . lucene . document . TextField ( "title" , dogmasTitle , Store . YES ) ) ; String dogmasContents = "white<seq2seq4repair_space>men<seq2seq4repair_space>can't<seq2seq4repair_space>jump" ; doc . add ( new org . apache . lucene . document . TextField ( "contents" , dogmasContents , Store . YES ) ) ; writer . addDocument ( doc , analyzer ) ; writer . commit ( ) ; directoryReader . close ( ) ; directoryReader = DirectoryReader . open ( dir ) ; indexSearcher = newSearcher ( directoryReader ) ; result = indexSearcher . search ( new MatchAllDocsQuery ( ) , 2 ) ; StoredDocument d1 = indexSearcher . doc ( result . scoreDocs [ 1 ] . doc ) ; assertNotNull ( d1 ) ; assertNotNull ( d1 . getField ( "title" ) ) ; assertEquals ( dogmasTitle , d1 . getField ( "title" ) . stringValue ( ) ) ; assertNotNull ( d1 . getField ( "contents" ) ) ; assertEquals ( dogmasContents , d1 . getField ( "contents" ) . stringValue ( ) ) ; indexSearcher = newSearcher ( directoryReader ) ; result = indexSearcher . search ( new MatchAllDocsQuery ( ) , 2 ) ; assertEquals ( 2 , result . totalHits ) ; <START_BUG> writer . close ( ) ; <END_BUG> indexSearcher . getIndexReader ( ) . close ( ) ; dir . close ( ) ; } @ Test public void testRandomStrings ( ) throws Exception { } @ Test public void testRandomStringsWithConfigurationParameters ( ) throws Exception { } }

Fix:
writer . shutdown ( ) ;