Buggy code:
public class CheckHits { public static float EXPLAIN_SCORE_TOLERANCE_DELTA = 5.0E-5F ; public static void checkNoMatchExplanations ( Query q , String defaultFieldName , Searcher searcher , int [ ] results ) throws IOException { } public static void checkHitCollector ( Query query , String defaultFieldName , Searcher searcher , int [ ] results ) throws IOException { } public static void checkHits ( Query query , String defaultFieldName , Searcher searcher , int [ ] results ) throws IOException { } public static void checkDocIds ( String mes , int [ ] results , Hits hits ) throws IOException { } public static void checkHitsQuery ( Query query , Hits hits1 , Hits hits2 , int [ ] results ) throws IOException { } public static void checkEqual ( Query query , Hits hits1 , Hits hits2 ) throws IOException { } public static String hits2str ( Hits hits1 , Hits hits2 , int start , int end ) throws IOException { } public static String topdocsString ( TopDocs docs , int start , int end ) { } public static void checkExplanations ( Query query , String defaultFieldName , Searcher searcher ) throws IOException { } public static void checkExplanations ( Query query , String defaultFieldName , Searcher searcher , boolean deep ) throws IOException { } public static void verifyExplanation ( String q , int doc , float score , boolean deep , Explanation expl ) { float value = expl . getValue ( ) ; TestCase . assertEquals ( ( ( ( ( ( ( ( ( q + ":<seq2seq4repair_space>score(doc=" ) + doc ) + ")=" ) + score ) + "<seq2seq4repair_space>!=<seq2seq4repair_space>explanationScore=" ) + value ) + "<seq2seq4repair_space>Explanation:<seq2seq4repair_space>" ) + expl ) , score , value , CheckHits . EXPLAIN_SCORE_TOLERANCE_DELTA ) ; if ( ! deep ) return ; Explanation [ ] detail = expl . getDetails ( ) ; if ( detail != null ) { if ( ( detail . length ) == 1 ) { CheckHits . verifyExplanation ( q , doc , score , deep , detail [ 0 ] ) ; } else { float x = 0 ; String descr = expl . getDescription ( ) . toLowerCase ( ) ; boolean productOf = descr . endsWith ( "product<seq2seq4repair_space>of:" ) ; boolean sumOf = descr . endsWith ( "sum<seq2seq4repair_space>of:" ) ; boolean maxOf = descr . endsWith ( "max<seq2seq4repair_space>of:" ) ; boolean maxTimesOthers = false ; if ( ! ( ( productOf || sumOf ) || maxOf ) ) { int k1 = descr . indexOf ( "max<seq2seq4repair_space>plus<seq2seq4repair_space>" ) ; if ( k1 >= 0 ) { k1 += "max<seq2seq4repair_space>plus<seq2seq4repair_space>" . length ( ) ; int k2 = descr . indexOf ( "<seq2seq4repair_space>" , k1 ) ; try { x = Float . parseFloat ( descr . substring ( k1 , k2 ) . trim ( ) ) ; if ( descr . substring ( k2 ) . trim ( ) . equals ( "times<seq2seq4repair_space>others<seq2seq4repair_space>of:" ) ) { maxTimesOthers = true ; } } catch ( NumberFormatException e ) { } } } <START_BUG> TestCase . assertTrue ( ( ( ( ( ( q + ":<seq2seq4repair_space>multi<seq2seq4repair_space>valued<seq2seq4repair_space>explanation<seq2seq4repair_space>description=\"" ) + descr ) + "\"<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>\'max<seq2seq4repair_space>of<seq2seq4repair_space>plus<seq2seq4repair_space>x<seq2seq4repair_space>times<seq2seq4repair_space>others\'<seq2seq4repair_space>or<seq2seq4repair_space>end<seq2seq4repair_space>with<seq2seq4repair_space>\'prodoct<seq2seq4repair_space>of\'" ) + "<seq2seq4repair_space>or<seq2seq4repair_space>'sum<seq2seq4repair_space>of:'<seq2seq4repair_space>or<seq2seq4repair_space>'max<seq2seq4repair_space>of:'<seq2seq4repair_space>-<seq2seq4repair_space>" ) + expl ) , ( ( ( productOf || sumOf ) || maxOf ) || maxTimesOthers ) ) ; <END_BUG> float sum = 0 ; float product = 1 ; float max = 0 ; for ( int i = 0 ; i < ( detail . length ) ; i ++ ) { float dval = detail [ i ] . getValue ( ) ; CheckHits . verifyExplanation ( q , doc , dval , deep , detail [ i ] ) ; product *= dval ; sum += dval ; max = Math . max ( max , dval ) ; } float combined = 0 ; if ( productOf ) { combined = product ; } else if ( sumOf ) { combined = sum ; } else if ( maxOf ) { combined = max ; } else if ( maxTimesOthers ) { combined = max + ( x * ( sum - max ) ) ; } else { TestCase . assertTrue ( "should<seq2seq4repair_space>never<seq2seq4repair_space>get<seq2seq4repair_space>here!" , false ) ; } TestCase . assertEquals ( ( ( ( ( ( ( q + ":<seq2seq4repair_space>actual<seq2seq4repair_space>subDetails<seq2seq4repair_space>combined==" ) + combined ) + "<seq2seq4repair_space>!=<seq2seq4repair_space>value=" ) + value ) + "<seq2seq4repair_space>Explanation:<seq2seq4repair_space>" ) + expl ) , combined , value , CheckHits . EXPLAIN_SCORE_TOLERANCE_DELTA ) ; } } } public static class ExplanationAssertingSearcher extends IndexSearcher { public ExplanationAssertingSearcher ( Directory d ) throws IOException { } public ExplanationAssertingSearcher ( IndexReader r ) throws IOException { } protected void checkExplanations ( Query q ) throws IOException { } public Hits search ( Query query , Filter filter ) throws IOException { } public Hits search ( Query query , Sort sort ) throws IOException { } public Hits search ( Query query , Filter filter , Sort sort ) throws IOException { } public TopFieldDocs search ( Query query , Filter filter , int n , Sort sort ) throws IOException { } public void search ( Query query , HitCollector results ) throws IOException { } public void search ( Query query , Filter filter , HitCollector results ) throws IOException { } public TopDocs search ( Query query , Filter filter , int n ) throws IOException { } } public static class ExplanationAsserter extends HitCollector { public static float SCORE_TOLERANCE_DELTA = 5.0E-5F ; Query q ; Searcher s ; String d ; boolean deep ; public ExplanationAsserter ( Query q , String defaultFieldName , Searcher s ) { } public ExplanationAsserter ( Query q , String defaultFieldName , Searcher s , boolean deep ) { } public void collect ( int doc , float score ) { } } }

Fix:
TestCase . assertTrue ( ( ( ( ( ( q + ":<seq2seq4repair_space>multi<seq2seq4repair_space>valued<seq2seq4repair_space>explanation<seq2seq4repair_space>description=\"" ) + descr ) + "\"<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>\'max<seq2seq4repair_space>of<seq2seq4repair_space>plus<seq2seq4repair_space>x<seq2seq4repair_space>times<seq2seq4repair_space>others\'<seq2seq4repair_space>or<seq2seq4repair_space>end<seq2seq4repair_space>with<seq2seq4repair_space>\'product<seq2seq4repair_space>of\'" ) + "<seq2seq4repair_space>or<seq2seq4repair_space>'sum<seq2seq4repair_space>of:'<seq2seq4repair_space>or<seq2seq4repair_space>'max<seq2seq4repair_space>of:'<seq2seq4repair_space>-<seq2seq4repair_space>" ) + expl ) , ( ( ( productOf || sumOf ) || maxOf ) || maxTimesOthers ) ) ;