package Ġfi . th ak ki . s ud ok us olver . engine . service . analyzer Ċ Ċ import Ġassert k . assertThat Ċ import Ġassert k . assertions . does Not Contain Ċ import Ġassert k . assertions . isEqualTo Ċ import Ġfi . th ak ki . s ud ok us olver . engine . service . builder . Standard S udoku Builder Ċ import Ġfi . th ak ki . s ud ok us olver . engine . service . message . Discard ing Message Broker Ċ import Ġorg . junit . jupiter . api . Test Ċ Ċ internal Ġclass ĠC andidate Based Candidate Elimin ator Test Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġmessage Broker Ġ= ĠDis card ing Message Broker ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` elim inate Band Or Stack Candidates Only In Region () Ġ- Ġhappy Ġcase `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġs udoku Ġ= ĠStandard S udoku Builder ( Standard S udoku Builder . Standard Layout . STANDARD _ 9 X 9 , Ġmessage Broker ). build () ĊĠĠĠĠĠĠĠ Ġval Ġcandidate To Elimin ate Ġ= Ġ' 9 ' ĊĠĠĠĠĠĠĠ Ġval Ġregion Ġ= Ġs udoku . regions . first () ĊĠĠĠĠĠĠĠ Ġval Ġfirst Band Ġ= Ġs udoku . bands [ 0 ] ĊĠĠĠĠĠĠĠ Ġval Ġregion Cells In First Band Ġ= Ġregion . cells . intersect ( first Band ) ĊĊĠĠĠĠĠĠĠ Ġregion . cells . forEach Ġ{ Ġit . analysis . candidates Ġ-= Ġcandidate To Elimin ate Ġ} ĊĠĠĠĠĠĠĠ Ġregion Cells In First Band . forEach Ġ{ Ġit . analysis . candidates Ġ+= Ġcandidate To Elimin ate Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠC andidate Based Candidate Elimin ator ( s udoku , Ġmessage Broker ). elim inate Band Or Stack Candidates Only In Region () ĊĊĠĠĠĠĠĠĠ ĠassertThat ( result ). isEqualTo ( Analyze Result . Candidates Elimin ated ) ĊĠĠĠĠĠĠĠ Ġfirst Band . cells . subtract ( region . cells ). let Ġ{ Ġfirst Band Cells NotIn Region Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfirst Band Cells NotIn Region . forEach Ġ{ Ġcell Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( cell . analysis . candidates ). does Not Contain ( candidate To Elimin ate ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` elim inate Region Candidates Only In Band Or Stack () Ġ- Ġhappy Ġcase `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġs udoku Ġ= ĠStandard S udoku Builder ( Standard S udoku Builder . Standard Layout . STANDARD _ 9 X 9 , Ġmessage Broker ). build () ĊĠĠĠĠĠĠĠ Ġval Ġcandidate To Elimin ate Ġ= Ġ' 1 ' ĊĠĠĠĠĠĠĠ Ġval Ġregion Ġ= Ġs udoku . regions . first () ĊĠĠĠĠĠĠĠ Ġval Ġfirst Band Ġ= Ġs udoku . bands [ 0 ] ĊĠĠĠĠĠĠĠ Ġval Ġregion Cells In First Band Ġ= Ġregion . cells . intersect ( first Band ) ĊĊĠĠĠĠĠĠĠ Ġfirst Band . cells . forEach Ġ{ Ġit . analysis . candidates Ġ-= Ġcandidate To Elimin ate Ġ} ĊĠĠĠĠĠĠĠ Ġregion Cells In First Band . forEach Ġ{ Ġit . analysis . candidates Ġ+= Ġcandidate To Elimin ate Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠC andidate Based Candidate Elimin ator ( s udoku , Ġmessage Broker ). elim inate Region Candidates Only In Band Or Stack () ĊĊĠĠĠĠĠĠĠ ĠassertThat ( result ). isEqualTo ( Analyze Result . Candidates Elimin ated ) ĊĠĠĠĠĠĠĠ Ġregion . cells . subtract ( first Band . cells ). let Ġ{ Ġregion Cells NotIn First Band Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġregion Cells NotIn First Band . forEach Ġ{ Ġcell Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( cell . analysis . candidates ). does Not Contain ( candidate To Elimin ate ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ