Buggy code:
checkClearAtt . getAndResetClearCalled ( ) ; assertTrue ( ( ( "token<seq2seq4repair_space>" + i ) + "<seq2seq4repair_space>does<seq2seq4repair_space>not<seq2seq4repair_space>exist" ) , ts . incrementToken ( ) ) ; assertTrue ( "clearAttributes()<seq2seq4repair_space>was<seq2seq4repair_space>not<seq2seq4repair_space>called<seq2seq4repair_space>correctly<seq2seq4repair_space>in<seq2seq4repair_space>TokenStream<seq2seq4repair_space>chain" , checkClearAtt . getAndResetClearCalled ( ) ) ; assertEquals ( ( "term<seq2seq4repair_space>" + i ) , output [ i ] , termAtt . toString ( ) ) ; if ( startOffsets != null ) assertEquals ( ( "startOffset<seq2seq4repair_space>" + i ) , startOffsets [ i ] , offsetAtt . startOffset ( ) ) ; if ( endOffsets != null ) assertEquals ( ( "endOffset<seq2seq4repair_space>" + i ) , endOffsets [ i ] , offsetAtt . endOffset ( ) ) ; if ( types != null ) assertEquals ( ( "type<seq2seq4repair_space>" + i ) , types [ i ] , typeAtt . type ( ) ) ; if ( posIncrements != null ) assertEquals ( ( "posIncrement<seq2seq4repair_space>" + i ) , posIncrements [ i ] , posIncrAtt . getPositionIncrement ( ) ) ; if ( posLengths != null ) assertEquals ( ( "posLength<seq2seq4repair_space>" + i ) , posLengths [ i ] , posLengthAtt . getPositionLength ( ) ) ; if ( offsetAtt != null ) { final int startOffset = offsetAtt . startOffset ( ) ; final int endOffset = offsetAtt . endOffset ( ) ; assertTrue ( "startOffset<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>>=<seq2seq4repair_space>0" , ( startOffset >= 0 ) ) ; assertTrue ( "endOffset<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>>=<seq2seq4repair_space>0" , ( endOffset >= 0 ) ) ; assertTrue ( ( ( ( "endOffset<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>>=<seq2seq4repair_space>startOffset,<seq2seq4repair_space>got<seq2seq4repair_space>startOffset=" + startOffset ) + ",endOffset=" ) + endOffset ) , ( endOffset >= startOffset ) ) ; if ( finalOffset != null ) { assertTrue ( "startOffset<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space><=<seq2seq4repair_space>finalOffset" , ( startOffset <= ( finalOffset . intValue ( ) ) ) ) ; assertTrue ( ( ( ( "endOffset<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space><=<seq2seq4repair_space>finalOffset:<seq2seq4repair_space>got<seq2seq4repair_space>endOffset=" + endOffset ) + "<seq2seq4repair_space>vs<seq2seq4repair_space>finalOffset=" ) + ( finalOffset . intValue ( ) ) ) , ( endOffset <= ( finalOffset . intValue ( ) ) ) ) ; } if ( ( posLengthAtt != null ) && ( posIncrAtt != null ) ) { final int posInc = posIncrAtt . getPositionIncrement ( ) ; pos += posInc ; final int posLength = posLengthAtt . getPositionLength ( ) ; if ( ! ( posToStartOffset . containsKey ( pos ) ) ) { posToStartOffset . put ( pos , startOffset ) ; } else { assertEquals ( posToStartOffset . get ( pos ) . intValue ( ) , startOffset ) ; } final int endPos = pos + posLength ; if ( ! ( posToEndOffset . containsKey ( endPos ) ) ) { posToEndOffset . put ( endPos , endOffset ) ; } else { assertEquals ( posToEndOffset . get ( endPos ) . intValue ( ) , endOffset ) ; } } } if ( posIncrAtt != null ) { if ( i == 0 ) { assertTrue ( "first<seq2seq4repair_space>posIncrement<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>>=<seq2seq4repair_space>1" , ( ( posIncrAtt . getPositionIncrement ( ) ) >= 1 ) ) ; } else { assertTrue ( "posIncrement<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>>=<seq2seq4repair_space>0" , ( ( posIncrAtt . getPositionIncrement ( ) ) >= 0 ) ) ; } } if ( posLengthAtt != null ) { assertTrue ( "posLength<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>>=<seq2seq4repair_space>1" , ( ( posLengthAtt . getPositionLength ( ) ) >= 1 ) ) ; } } <START_BUG> assertFalse ( "TokenStream<seq2seq4repair_space>has<seq2seq4repair_space>more<seq2seq4repair_space>tokens<seq2seq4repair_space>than<seq2seq4repair_space>expected" , ts . incrementToken ( ) ) ; <END_BUG> ts . end ( ) ; if ( finalOffset != null ) { assertEquals ( "finalOffset<seq2seq4repair_space>" , finalOffset . intValue ( ) , offsetAtt . endOffset ( ) ) ; } if ( offsetAtt != null ) { assertTrue ( "finalOffset<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>>=<seq2seq4repair_space>0" , ( ( offsetAtt . endOffset ( ) ) >= 0 ) ) ; } ts . close ( ) ; } public static void assertTokenStreamContents ( TokenStream ts , String [ ] output , int [ ] startOffsets , int [ ] endOffsets , String [ ] types , int [ ] posIncrements , Integer finalOffset ) throws IOException { } public static void assertTokenStreamContents ( TokenStream ts , String [ ] output , int [ ] startOffsets , int [ ] endOffsets , String [ ] types , int [ ] posIncrements ) throws IOException { } public static void assertTokenStreamContents ( TokenStream ts , String [ ] output ) throws IOException { } public static void assertTokenStreamContents ( TokenStream ts , String [ ] output , String [ ] types ) throws IOException { } public static void assertTokenStreamContents ( TokenStream ts , String [ ] output , int [ ] posIncrements ) throws IOException { } public static void assertTokenStreamContents ( TokenStream ts , String [ ] output , int [ ] startOffsets , int [ ] endOffsets ) throws IOException { } public static void assertTokenStreamContents ( TokenStream ts , String [ ] output , int [ ] startOffsets , int [ ] endOffsets , Integer finalOffset ) throws IOException { } public static void assertTokenStreamContents ( TokenStream ts , String [ ] output , int [ ] startOffsets , int [ ] endOffsets , int [ ] posIncrements ) throws IOException { } public static void assertTokenStreamContents ( TokenStream ts , String [ ] output , int [ ] startOffsets , int [ ] endOffsets , int [ ] posIncrements , Integer finalOffset ) throws IOException { } public static void assertTokenStreamContents ( TokenStream ts , String [ ] output , int [ ] startOffsets , int [ ] endOffsets , int [ ] posIncrements , int [ ] posLengths , Integer finalOffset ) throws IOException { } public static void assertAnalyzesTo ( Analyzer a , String input , String [ ] output , int [ ] startOffsets , int [ ] endOffsets , String [ ] types , int [ ] posIncrements ) throws IOException { } public static void assertAnalyzesTo ( Analyzer a , String input , String [ ] output , int [ ] startOffsets , int [ ] endOffsets , String [ ] types , int [ ] posIncrements , int [ ] posLengths ) throws IOException { }

Fix:
assertFalse ( ( ( "TokenStream<seq2seq4repair_space>has<seq2seq4repair_space>more<seq2seq4repair_space>tokens<seq2seq4repair_space>than<seq2seq4repair_space>expected<seq2seq4repair_space>(expected<seq2seq4repair_space>count=" + ( output . length ) ) + ")" ) , ts . incrementToken ( ) ) ;