Buggy code:
public class TestFSTs extends LuceneTestCase { private MockDirectoryWrapper dir ; @ Override public void setUp ( ) throws Exception { } @ Override public void tearDown ( ) throws Exception { } private static BytesRef toBytesRef ( IntsRef ir ) { } private static IntsRef toIntsRef ( String s , int inputMode ) { } private static IntsRef toIntsRef ( String s , int inputMode , IntsRef ir ) { } private static IntsRef toIntsRefUTF32 ( String s , IntsRef ir ) { } private static IntsRef toIntsRef ( BytesRef br , IntsRef ir ) { } public void testBasicFSA ( ) throws IOException { } private static String simpleRandomString ( Random r ) { } private void doTest ( int inputMode , IntsRef [ ] terms ) throws IOException { } private static class FSTTester < T > { final Random random ; final List < TestFSTs . FSTTester . InputOutput < T > > pairs ; final int inputMode ; final Outputs < T > outputs ; final Directory dir ; public FSTTester ( Random random , Directory dir , int inputMode , List < TestFSTs . FSTTester . InputOutput < T > > pairs , Outputs < T > outputs ) { } private static class InputOutput < T > implements Comparable < TestFSTs . FSTTester . InputOutput < T > > { public final IntsRef input ; public final T output ; public InputOutput ( IntsRef input , T output ) { } public int compareTo ( TestFSTs . FSTTester . InputOutput < T > other ) { } } public void doTest ( ) throws IOException { } private T run ( FST < T > fst , IntsRef term , int [ ] prefixLength ) throws IOException { } private T randomAcceptedWord ( FST < T > fst , IntsRef in ) throws IOException { } FST < T > doTest ( int prune1 , int prune2 ) throws IOException { } private void verifyUnPruned ( int inputMode , FST < T > fst ) throws IOException { if ( ( pairs . size ( ) ) == 0 ) { assertNull ( fst ) ; return ; } if ( VERBOSE ) { System . out . println ( ( ( "TEST:<seq2seq4repair_space>now<seq2seq4repair_space>verify<seq2seq4repair_space>" + ( pairs . size ( ) ) ) + "<seq2seq4repair_space>terms" ) ) ; for ( TestFSTs . FSTTester . InputOutput < T > pair : pairs ) { TestFSTs . FSTTester . assertNotNull ( pair ) ; assertNotNull ( pair . input ) ; TestFSTs . FSTTester . assertNotNull ( pair . output ) ; System . out . println ( ( ( ( "<seq2seq4repair_space>" + ( TestFSTs . inputToString ( inputMode , pair . input ) ) ) + ":<seq2seq4repair_space>" ) + ( outputs . outputToString ( pair . output ) ) ) ) ; } } assertNotNull ( fst ) ; if ( VERBOSE ) { System . out . println ( "TEST:<seq2seq4repair_space>check<seq2seq4repair_space>valid<seq2seq4repair_space>terms//next()" ) ; } { IntsRefFSTEnum < T > fstEnum = new IntsRefFSTEnum < T > ( fst ) ; for ( TestFSTs . FSTTester . InputOutput < T > pair : pairs ) { IntsRef term = pair . input ; if ( VERBOSE ) { System . out . println ( ( ( ( "TEST:<seq2seq4repair_space>check<seq2seq4repair_space>term=" + ( TestFSTs . inputToString ( inputMode , term ) ) ) + "<seq2seq4repair_space>output=" ) + ( fst . outputs . outputToString ( pair . output ) ) ) ) ; } Object output = run ( fst , term , null ) ; assertNotNull ( ( ( "term<seq2seq4repair_space>" + ( TestFSTs . inputToString ( inputMode , term ) ) ) + "<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>accepted" ) , output ) ; <START_BUG> TestFSTs . FSTTester . assertEquals ( output , pair . output ) ; <END_BUG> IntsRefFSTEnum . InputOutput < T > t = fstEnum . next ( ) ; assertNotNull ( t ) ; assertEquals ( ( ( ( "expected<seq2seq4repair_space>input=" + ( TestFSTs . inputToString ( inputMode , term ) ) ) + "<seq2seq4repair_space>but<seq2seq4repair_space>fstEnum<seq2seq4repair_space>returned<seq2seq4repair_space>" ) + ( TestFSTs . inputToString ( inputMode , t . input ) ) ) , term , t . input ) ; assertEquals ( pair . output , t . output ) ; } assertNull ( fstEnum . next ( ) ) ; } final Map < IntsRef , T > termsMap = new HashMap < IntsRef , T > ( ) ; for ( TestFSTs . FSTTester . InputOutput < T > pair : pairs ) { termsMap . put ( pair . input , pair . output ) ; } if ( VERBOSE ) { System . out . println ( "TEST:<seq2seq4repair_space>verify<seq2seq4repair_space>random<seq2seq4repair_space>accepted<seq2seq4repair_space>terms" ) ; } final IntsRef scratch = new IntsRef ( 10 ) ; for ( int iter = 0 ; iter < ( 500 * ( RANDOM_MULTIPLIER ) ) ; iter ++ ) { T output = randomAcceptedWord ( fst , scratch ) ; assertTrue ( ( ( "accepted<seq2seq4repair_space>word<seq2seq4repair_space>" + ( TestFSTs . inputToString ( inputMode , scratch ) ) ) + "<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>valid" ) , termsMap . containsKey ( scratch ) ) ; assertEquals ( termsMap . get ( scratch ) , output ) ; } if ( VERBOSE ) { System . out . println ( "TEST:<seq2seq4repair_space>verify<seq2seq4repair_space>seek" ) ; } IntsRefFSTEnum < T > fstEnum = new IntsRefFSTEnum < T > ( fst ) ; for ( int iter = 0 ; iter < ( 100 * ( RANDOM_MULTIPLIER ) ) ; iter ++ ) { if ( VERBOSE ) { System . out . println ( ( "TEST:<seq2seq4repair_space>iter=" + iter ) ) ; } if ( random . nextBoolean ( ) ) { while ( true ) { final IntsRef term = TestFSTs . toIntsRef ( TestFSTs . getRandomString ( ) , inputMode ) ; int pos = Collections . binarySearch ( pairs , new TestFSTs . FSTTester . InputOutput < T > ( term , null ) ) ;

Fix:
TestFSTs . FSTTester . assertEquals ( pair . output , output ) ;