Buggy code:
public class TestSpellCheckResponse extends SolrJettyTestBase { @ BeforeClass public static void beforeTest ( ) throws Exception { } static String field = "name" ; @ Test public void testSpellCheckResponse ( ) throws Exception { } @ Test public void testSpellCheckResponse_Extended ( ) throws Exception { } @ Test public void testSpellCheckCollationResponse ( ) throws Exception { getSolrServer ( ) ; SolrInputDocument doc = new SolrInputDocument ( ) ; doc . setField ( "id" , "0" ) ; doc . setField ( "name" , "faith<seq2seq4repair_space>hope<seq2seq4repair_space>and<seq2seq4repair_space>love" ) ; server . add ( doc ) ; doc = new SolrInputDocument ( ) ; doc . setField ( "id" , "1" ) ; doc . setField ( "name" , "faith<seq2seq4repair_space>hope<seq2seq4repair_space>and<seq2seq4repair_space>loaves" ) ; server . add ( doc ) ; doc = new SolrInputDocument ( ) ; doc . setField ( "id" , "2" ) ; doc . setField ( "name" , "fat<seq2seq4repair_space>hops<seq2seq4repair_space>and<seq2seq4repair_space>loaves" ) ; server . add ( doc ) ; doc = new SolrInputDocument ( ) ; doc . setField ( "id" , "3" ) ; doc . setField ( "name" , "faith<seq2seq4repair_space>of<seq2seq4repair_space>homer" ) ; server . add ( doc ) ; doc = new SolrInputDocument ( ) ; doc . setField ( "id" , "4" ) ; doc . setField ( "name" , "fat<seq2seq4repair_space>of<seq2seq4repair_space>homer" ) ; server . add ( doc ) ; server . commit ( true , true ) ; SolrQuery query = new SolrQuery ( "name:(+fauth<seq2seq4repair_space>+home<seq2seq4repair_space>+loane)" ) ; query . set ( QT , "//spell" ) ; query . set ( "spellcheck" , true ) ; query . set ( SPELLCHECK_BUILD , true ) ; query . set ( SPELLCHECK_COUNT , 10 ) ; query . set ( SPELLCHECK_COLLATE , true ) ; QueryRequest request = new QueryRequest ( query ) ; SpellCheckResponse response = request . process ( server ) . getSpellCheckResponse ( ) ; response = request . process ( server ) . getSpellCheckResponse ( ) ; assertTrue ( "name:(+faith<seq2seq4repair_space>+homer<seq2seq4repair_space>+loaves)" . equals ( response . getCollatedResult ( ) ) ) ; query . set ( SPELLCHECK_COLLATE_EXTENDED_RESULTS , true ) ; <START_BUG> query . set ( SPELLCHECK_MAX_COLLATION_TRIES , 5 ) ; <END_BUG> query . set ( SPELLCHECK_MAX_COLLATIONS , 2 ) ; request = new QueryRequest ( query ) ; response = request . process ( server ) . getSpellCheckResponse ( ) ; assertTrue ( ( ( "name:(+faith<seq2seq4repair_space>+hope<seq2seq4repair_space>+love)" . equals ( response . getCollatedResult ( ) ) ) || ( "name:(+faith<seq2seq4repair_space>+hope<seq2seq4repair_space>+loaves)" . equals ( response . getCollatedResult ( ) ) ) ) ) ; List < Collation > collations = response . getCollatedResults ( ) ; assertTrue ( ( ( collations . size ( ) ) == 2 ) ) ; for ( Collation collation : collations ) { assertTrue ( ( ( "name:(+faith<seq2seq4repair_space>+hope<seq2seq4repair_space>+love)" . equals ( collation . getCollationQueryString ( ) ) ) || ( "name:(+faith<seq2seq4repair_space>+hope<seq2seq4repair_space>+loaves)" . equals ( collation . getCollationQueryString ( ) ) ) ) ) ; assertTrue ( ( ( collation . getNumberOfHits ( ) ) == 1 ) ) ; List < Correction > misspellingsAndCorrections = collation . getMisspellingsAndCorrections ( ) ; assertTrue ( ( ( misspellingsAndCorrections . size ( ) ) == 3 ) ) ; for ( Correction correction : misspellingsAndCorrections ) { if ( "fauth" . equals ( correction . getOriginal ( ) ) ) { assertTrue ( "faith" . equals ( correction . getCorrection ( ) ) ) ; } else if ( "home" . equals ( correction . getOriginal ( ) ) ) { assertTrue ( "hope" . equals ( correction . getCorrection ( ) ) ) ; } else if ( "loane" . equals ( correction . getOriginal ( ) ) ) { assertTrue ( ( ( "love" . equals ( correction . getCorrection ( ) ) ) || ( "loaves" . equals ( correction . getCorrection ( ) ) ) ) ) ; } else { fail ( "Original<seq2seq4repair_space>Word<seq2seq4repair_space>Should<seq2seq4repair_space>have<seq2seq4repair_space>been<seq2seq4repair_space>either<seq2seq4repair_space>fauth,<seq2seq4repair_space>home<seq2seq4repair_space>or<seq2seq4repair_space>loane." ) ; } } } } }

Fix:
query . set ( SPELLCHECK_MAX_COLLATION_TRIES , 10 ) ;