package Ġtest Rules Ċ Ċ import Ġcoordinates . Coordinate 2 D Ċ import Ġmoves .* Ċ import Ġgame Types . chess . Standard Che ss Ċ import Ġio . mock k . Mock K Annotations Ċ import Ġio . mock k . spy k Ċ import Ġorg . junit . jupiter . api . Assertions . assertTrue Ċ import Ġorg . junit . jupiter . api . BeforeEach Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġpieces . chess .* Ċ Ċ class ĠCast ling Test Ġ{ ĊĊĠĠĠ Ġval Ġmock Standard Che ss Ġ= Ġspy k < Standard Che ss >() ĊĊĠĠĠ Ġval Ġplayer 1 Ġ= Ġmock Standard Che ss . players [ 0 ] ĊĠĠĠ Ġval Ġplayer 2 Ġ= Ġmock Standard Che ss . players [ 1 ] ĊĊĠĠĠ Ġ@ BeforeEach ĊĠĠĠ Ġfun ĠsetUp () Ġ= ĠMock K Annotations . init ( this ) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcast le Right Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġmock Standard Che ss . init Game () ĊĊĠĠĠĠĠĠĠ Ġval Ġinit Moves : ĠList < Basic Move 2 D > Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠBasic Move 2 D ( Coordinate 2 D ( 4 , Ġ 1 ), ĠCoordinate 2 D ( 4 , Ġ 3 ), ĠStandard White Pawn ( player 1 ), Ġplayer 1 ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠBasic Move 2 D ( Coordinate 2 D ( 0 , Ġ 6 ), ĠCoordinate 2 D ( 0 , Ġ 5 ), ĠStandard Black Pawn ( player 2 ), Ġplayer 2 ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠBasic Move 2 D ( Coordinate 2 D ( 5 , Ġ 0 ), ĠCoordinate 2 D ( 4 , Ġ 1 ), ĠB ish op ( player 1 ), Ġplayer 1 ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠBasic Move 2 D ( Coordinate 2 D ( 1 , Ġ 6 ), ĠCoordinate 2 D ( 1 , Ġ 5 ), ĠStandard Black Pawn ( player 2 ), Ġplayer 2 ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠBasic Move 2 D ( Coordinate 2 D ( 6 , Ġ 0 ), ĠCoordinate 2 D ( 5 , Ġ 2 ), ĠK night ( player 1 ), Ġplayer 1 ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠBasic Move 2 D ( Coordinate 2 D ( 2 , Ġ 6 ), ĠCoordinate 2 D ( 2 , Ġ 5 ), ĠStandard Black Pawn ( player 2 ), Ġplayer 2 ), ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġfor Ġ( move Ġin Ġinit Moves ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmock Standard Che ss . make Move ( move ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġmoves Ġ= Ġmock Standard Che ss . get Valid Moves ( player 1 ) ĊĠĠĠĠĠĠĠ Ġval Ġcast le Move Ġ= ĠComposite Move 2 D ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmoves Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠRemove Piece Move 2 D ( player Ġ= Ġplayer 1 , Ġpiece Ġ= ĠR ook ( player 1 ), Ġcoordinate Ġ= ĠCoordinate 2 D ( 7 , Ġ 0 )), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠBasic Move 2 D ( from Ġ= ĠCoordinate 2 D ( 4 , Ġ 0 ), Ġto Ġ= ĠCoordinate 2 D ( 5 , Ġ 0 ), Ġpiece Moved Ġ= ĠKing ( player Ġ= Ġplayer 1 ), Ġplayer Ġ= Ġplayer 1 , Ġpiece Capt ured Ġ= Ġnull , Ġpiece Prom oted To Ġ= Ġnull , Ġcheck For Check Ġ= Ġtrue ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠBasic Move 2 D ( from Ġ= ĠCoordinate 2 D ( 5 , Ġ 0 ), Ġto Ġ= ĠCoordinate 2 D ( 6 , Ġ 0 ), Ġpiece Moved Ġ= ĠKing ( player Ġ= Ġplayer 1 ), Ġplayer Ġ= Ġplayer 1 , Ġpiece Capt ured Ġ= Ġnull , Ġpiece Prom oted To Ġ= Ġnull , Ġcheck For Check Ġ= Ġtrue ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠAdd Piece Move 2 D ( player Ġ= Ġplayer 1 , Ġpiece Ġ= ĠR ook ( player 1 ), Ġcoordinate Ġ= ĠCoordinate 2 D ( 5 , Ġ 0 )), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġplayer Ġ= Ġplayer 1 ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( moves . contains ( castle Move )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcast le Left Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġmock Standard Che ss . init Game () ĊĊĠĠĠĠĠĠĠ Ġval Ġinit Moves : ĠList < Basic Move 2 D > Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠBasic Move 2 D ( Coordinate 2 D ( 3 , Ġ 1 ), ĠCoordinate 2 D ( 3 , Ġ 3 ), ĠStandard White Pawn ( player 1 ), Ġplayer 1 ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠBasic Move 2 D ( Coordinate 2 D ( 0 , Ġ 6 ), ĠCoordinate 2 D ( 0 , Ġ 5 ), ĠStandard Black Pawn ( player 2 ), Ġplayer 2 ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠBasic Move 2 D ( Coordinate 2 D ( 3 , Ġ 0 ), ĠCoordinate 2 D ( 3 , Ġ 2 ), ĠQue en ( player 1 ), Ġplayer 1 ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠBasic Move 2 D ( Coordinate 2 D ( 1 , Ġ 6 ), ĠCoordinate 2 D ( 1 , Ġ 5 ), ĠStandard Black Pawn ( player 2 ), Ġplayer 2 ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠBasic Move 2 D ( Coordinate 2 D ( 2 , Ġ 0 ), ĠCoordinate 2 D ( 3 , Ġ 1 ), ĠB ish op ( player 1 ), Ġplayer 1 ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠBasic Move 2 D ( Coordinate 2 D ( 2 , Ġ 6 ), ĠCoordinate 2 D ( 2 , Ġ 5 ), ĠStandard Black Pawn ( player 2 ), Ġplayer 2 ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠBasic Move 2 D ( Coordinate 2 D ( 1 , Ġ 0 ), ĠCoordinate 2 D ( 2 , Ġ 2 ), ĠK night ( player 1 ), Ġplayer 1 ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠBasic Move 2 D ( Coordinate 2 D ( 3 , Ġ 6 ), ĠCoordinate 2 D ( 3 , Ġ 5 ), ĠStandard Black Pawn ( player 2 ), Ġplayer 2 ) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġfor Ġ( move Ġin Ġinit Moves ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmock Standard Che ss . make Move ( move ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġmoves Ġ= Ġmock Standard Che ss . get Valid Moves ( player 1 ) ĊĠĠĠĠĠĠĠ Ġval Ġcast le Move Ġ= ĠComposite Move 2 D ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmoves Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠRemove Piece Move 2 D ( player Ġ= Ġplayer 1 , Ġpiece Ġ= ĠR ook ( player 1 ), Ġcoordinate Ġ= ĠCoordinate 2 D ( 0 , Ġ 0 )), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠBasic Move 2 D ( from Ġ= ĠCoordinate 2 D ( 4 , Ġ 0 ), Ġto Ġ= ĠCoordinate 2 D ( 3 , Ġ 0 ), Ġpiece Moved Ġ= ĠKing ( player Ġ= Ġplayer 1 ), Ġplayer Ġ= Ġplayer 1 , Ġpiece Capt ured Ġ= Ġnull , Ġpiece Prom oted To Ġ= Ġnull , Ġcheck For Check Ġ= Ġtrue ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠBasic Move 2 D ( from Ġ= ĠCoordinate 2 D ( 3 , Ġ 0 ), Ġto Ġ= ĠCoordinate 2 D ( 2 , Ġ 0 ), Ġpiece Moved Ġ= ĠKing ( player Ġ= Ġplayer 1 ), Ġplayer Ġ= Ġplayer 1 , Ġpiece Capt ured Ġ= Ġnull , Ġpiece Prom oted To Ġ= Ġnull , Ġcheck For Check Ġ= Ġtrue ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠAdd Piece Move 2 D ( player Ġ= Ġplayer 1 , Ġpiece Ġ= ĠR ook ( player 1 ), Ġcoordinate Ġ= ĠCoordinate 2 D ( 3 , Ġ 0 )), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġplayer Ġ= Ġplayer 1 ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( moves . contains ( castle Move )) ĊĠĠĠ Ġ} Ċ } Ċ