Buggy code:
public class TestBackwardsCompatibility extends LuceneTestCase { public void unzip ( String zipName , String destDirName ) throws IOException { } public void testCreateCFS ( ) throws IOException { } public void testCreateNoCFS ( ) throws IOException { } final String [ ] oldNames = new String [ ] { "19.cfs" , "19.nocfs" , "20.cfs" , "20.nocfs" , "21.cfs" , "21.nocfs" , "22.cfs" , "22.nocfs" , "23.cfs" , "23.nocfs" , "24.cfs" , "24.nocfs" , "29.cfs" , "29.nocfs" } ; private void assertCompressedFields29 ( Directory dir , boolean shouldStillBeCompressed ) throws IOException { } public void testOptimizeOldIndex ( ) throws IOException { } public void testSearchOldIndex ( ) throws IOException { } public void testIndexOldIndexNoAdds ( ) throws IOException { } public void testIndexOldIndex ( ) throws IOException { } private void testHits ( ScoreDoc [ ] hits , int expectedCount , IndexReader reader ) throws IOException { } public void searchIndex ( String dirName , String oldName ) throws IOException { } private int compare ( String name , String v ) { } public void changeIndexWithAdds ( String dirName ) throws IOException { } public void changeIndexNoAdds ( String dirName ) throws IOException { } public void createIndex ( String dirName , boolean doCFS ) throws IOException { } public void testExactFileNames ( ) throws IOException { String outputDir = "lucene.backwardscompat0.index" ; rmDir ( outputDir ) ; try { Directory dir = FSDirectory . open ( new File ( TestBackwardsCompatibility . fullDir ( outputDir ) ) ) ; IndexWriter writer = new IndexWriter ( dir , new WhitespaceAnalyzer ( ) , true , MaxFieldLength . UNLIMITED ) ; writer . setRAMBufferSizeMB ( 16.0 ) ; for ( int i = 0 ; i < 35 ; i ++ ) { addDoc ( writer , i ) ; } assertEquals ( "wrong<seq2seq4repair_space>doc<seq2seq4repair_space>count" , 35 , writer . maxDoc ( ) ) ; writer . close ( ) ; IndexReader reader = IndexReader . open ( dir , false ) ; Term searchTerm = new Term ( "id" , "7" ) ; int delCount = reader . deleteDocuments ( searchTerm ) ; assertEquals ( "didn't<seq2seq4repair_space>delete<seq2seq4repair_space>the<seq2seq4repair_space>right<seq2seq4repair_space>number<seq2seq4repair_space>of<seq2seq4repair_space>documents" , 1 , delCount ) ; reader . setNorm ( 21 , "content" , ( ( float ) ( 1.5 ) ) ) ; reader . close ( ) ; CompoundFileReader cfsReader = new CompoundFileReader ( dir , "_0.cfs" ) ; FieldInfos fieldInfos = new FieldInfos ( cfsReader , "_0.fnm" ) ; int contentFieldIndex = - 1 ; for ( int i = 0 ; i < ( fieldInfos . size ( ) ) ; i ++ ) { FieldInfo fi = fieldInfos . fieldInfo ( i ) ; if ( fi . name . equals ( "content" ) ) { contentFieldIndex = i ; break ; } } cfsReader . close ( ) ; assertTrue ( "could<seq2seq4repair_space>not<seq2seq4repair_space>locate<seq2seq4repair_space>the<seq2seq4repair_space>'content'<seq2seq4repair_space>field<seq2seq4repair_space>number<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>_2.cfs<seq2seq4repair_space>segment" , ( contentFieldIndex != ( - 1 ) ) ) ; String [ ] expected ; <START_BUG> expected = new String [ ] { "_0.cfs" , "_0_1.del" , "_0_1.s" + contentFieldIndex , "segments_3" , "segments.gen" } ; <END_BUG> String [ ] actual = dir . listAll ( ) ; Arrays . sort ( expected ) ; Arrays . sort ( actual ) ; if ( ! ( Arrays . equals ( expected , actual ) ) ) { fail ( ( ( ( "incorrect<seq2seq4repair_space>filenames<seq2seq4repair_space>in<seq2seq4repair_space>index:<seq2seq4repair_space>expected:\n<seq2seq4repair_space>" + ( asString ( expected ) ) ) + "\n<seq2seq4repair_space>actual:\n<seq2seq4repair_space>" ) + ( asString ( actual ) ) ) ) ; } dir . close ( ) ; } finally { rmDir ( outputDir ) ; } } private String asString ( String [ ] l ) { } private void addDoc ( IndexWriter writer , int id ) throws IOException { } private void addNoProxDoc ( IndexWriter writer ) throws IOException { } private void rmDir ( String dir ) throws IOException { } public static String fullDir ( String dirName ) throws IOException { } static final String TEXT_TO_COMPRESS = "this<seq2seq4repair_space>is<seq2seq4repair_space>a<seq2seq4repair_space>compressed<seq2seq4repair_space>field<seq2seq4repair_space>and<seq2seq4repair_space>should<seq2seq4repair_space>appear<seq2seq4repair_space>in<seq2seq4repair_space>3.0<seq2seq4repair_space>as<seq2seq4repair_space>an<seq2seq4repair_space>uncompressed<seq2seq4repair_space>field<seq2seq4repair_space>after<seq2seq4repair_space>merge" ; static final byte [ ] BINARY_TO_COMPRESS = new byte [ ] { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 } ; }

Fix:
expected = new String [ ] { "_0.cfs" , "_0_1.del" , "_0_1.s" + contentFieldIndex , "segments_2" , "segments.gen" } ;