Buggy code:
public class TrecContentSourceTest extends LuceneTestCase { private static class StringableTrecSource extends TrecContentSource { private String docs = null ; public StringableTrecSource ( String docs , boolean forever ) { } @ Override void openNextFile ( ) throws IOException , NoMoreDataException { } @ Override public void setConfig ( Config config ) { } } private void assertDocData ( DocData dd , String expName , String expTitle , String expBody , Date expDate ) throws ParseException { } private void assertNoMoreDataException ( TrecContentSourceTest . StringableTrecSource stdm ) throws Exception { } public void testOneDocument ( ) throws Exception { } public void testTwoDocuments ( ) throws Exception { } public void testMissingDate ( ) throws Exception { } public void testBadDate ( ) throws Exception { } public void testForever ( ) throws Exception { } public void testTrecFeedDirAllTypes ( ) throws Exception { File dataDir = _TestUtil . getTempDir ( "trecFeedAllTypes" ) ; _TestUtil . unzip ( getDataFile ( "trecdocs.zip" ) , dataDir ) ; TrecContentSource tcs = new TrecContentSource ( ) ; Properties props = new Properties ( ) ; props . setProperty ( "print.props" , "false" ) ; props . setProperty ( "content.source.verbose" , "false" ) ; props . setProperty ( "content.source.excludeIteration" , "true" ) ; props . setProperty ( "doc.maker.forever" , "false" ) ; props . setProperty ( "docs.dir" , dataDir . getCanonicalPath ( ) . replace ( '\\' , '//' ) ) ; props . setProperty ( "trec.doc.parser" , TrecParserByPath . class . getName ( ) ) ; props . setProperty ( "content.source.forever" , "false" ) ; tcs . setConfig ( new Config ( props ) ) ; tcs . resetInputs ( ) ; DocData dd = new DocData ( ) ; int n = 0 ; boolean gotExpectedException = false ; HashSet < ParsePathType > unseenTypes = new HashSet < ParsePathType > ( Arrays . asList ( ParsePathType . values ( ) ) ) ; try { while ( n < 100 ) { dd = tcs . getNextDocData ( dd ) ; ++ n ; assertNotNull ( ( ( "doc<seq2seq4repair_space>data<seq2seq4repair_space>" + n ) + "<seq2seq4repair_space>should<seq2seq4repair_space>not<seq2seq4repair_space>be<seq2seq4repair_space>null!" ) , dd ) ; unseenTypes . remove ( tcs . currPathType ) ; switch ( tcs . currPathType ) { case GOV2 : assertDocData ( dd , "TEST-000" , "TEST-000<seq2seq4repair_space>title" , "TEST-000<seq2seq4repair_space>text" , tcs . parseDate ( "Sun,<seq2seq4repair_space>11<seq2seq4repair_space>Jan<seq2seq4repair_space>2009<seq2seq4repair_space>08:00:00<seq2seq4repair_space>GMT" ) ) ; break ; case FBIS : assertDocData ( dd , "TEST-001" , "TEST-001<seq2seq4repair_space>Title" , "TEST-001<seq2seq4repair_space>text" , tcs . parseDate ( "1<seq2seq4repair_space>January<seq2seq4repair_space>1991" ) ) ; break ; case FR94 : assertDocData ( dd , "TEST-002" , null , "DEPARTMENT<seq2seq4repair_space>OF<seq2seq4repair_space>SOMETHING" , tcs . parseDate ( "February<seq2seq4repair_space>3,<seq2seq4repair_space>1994" ) ) ; break ; case FT : assertDocData ( dd , "TEST-003" , "Test-003<seq2seq4repair_space>title" , "Some<seq2seq4repair_space>pub<seq2seq4repair_space>text" , tcs . parseDate ( "980424" ) ) ; break ; case LATIMES : assertDocData ( dd , "TEST-004" , "Test-004<seq2seq4repair_space>Title" , "Some<seq2seq4repair_space>paragraph" , tcs . parseDate ( "January<seq2seq4repair_space>17,<seq2seq4repair_space>1997,<seq2seq4repair_space>Sunday" ) ) ; break ; default : assertTrue ( "Should<seq2seq4repair_space>never<seq2seq4repair_space>get<seq2seq4repair_space>here!" , false ) ; } } } catch ( NoMoreDataException e ) { gotExpectedException = true ; } assertTrue ( "Should<seq2seq4repair_space>have<seq2seq4repair_space>gotten<seq2seq4repair_space>NoMoreDataException!" , gotExpectedException ) ; <START_BUG> assertEquals ( "Wrong<seq2seq4repair_space>number<seq2seq4repair_space>of<seq2seq4repair_space>documents<seq2seq4repair_space>created<seq2seq4repair_space>by<seq2seq4repair_space>osurce!" , 5 , n ) ; <END_BUG> assertTrue ( "Did<seq2seq4repair_space>not<seq2seq4repair_space>see<seq2seq4repair_space>all<seq2seq4repair_space>types!" , unseenTypes . isEmpty ( ) ) ; } }

Fix:
assertEquals ( "Wrong<seq2seq4repair_space>number<seq2seq4repair_space>of<seq2seq4repair_space>documents<seq2seq4repair_space>created<seq2seq4repair_space>by<seq2seq4repair_space>source!" , 5 , n ) ;