package Ġcom . github . lip in skip aw el . controller Ċ Ċ import Ġcom . github . lip in skip aw el . board . engine . Board s Ċ import Ġcom . github . lip in skip aw el . board . engine . Direction Ċ import Ġcom . github . lip in skip aw el . board . engine . Player Ċ import Ġcom . github . lip in skip aw el . game . Game Flow Controller Ċ import Ġorg . assertj . core . api . Assertions Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . junit . jupiter . api . assert All Ċ Ċ class ĠGame Flow Controller Test Ġ{ ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` make Ġa Ġmove `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġgame Ġ= ĠGame Flow Controller () ĊĠĠĠĠĠĠĠ Ġval Ġboard Ġ= ĠBo ards . immutable Board () ĊĊĠĠĠĠĠĠĠ Ġval Ġafter Move Ġ= Ġgame . make AM ove ( 4 8 ) ĊĠĠĠĠĠĠĠ Ġval Ġfollow Up Board Ġ= Ġboard . execute Move ( Direction . NW ) ĊĊĠĠĠĠĠĠĠ Ġassert All (" after Ġmove ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĠAssertions . assertThat ( after Move . is Game Over ()). isFalse () Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĠAssertions . assertThat ( after Move . player ()). isEqualTo ( Player . SECOND ) Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĠAssertions . assertThat ( after Move . board ()). isEqualTo Comp aring Field By Field Re cursively ( follow Up Board ) Ġ} ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` make Ġa Ġmove Ġand Ġundo `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġgame Ġ= ĠGame Flow Controller () ĊĠĠĠĠĠĠĠ Ġval Ġboard Ġ= ĠBo ards . immutable Board () ĊĊĠĠĠĠĠĠĠ Ġval Ġafter Move Ġ= Ġgame . make AM ove ( 4 8 ). undo () ĊĠĠĠĠĠĠĠ Ġval Ġfollow Up Board Ġ= Ġboard . execute Move ( Direction . NW ). undo () ĊĊĠĠĠĠĠĠĠ Ġassert All (" after Ġmove Ġand Ġundo ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĠAssertions . assertThat ( after Move . is Game Over ()). isFalse () Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĠAssertions . assertThat ( after Move . player ()). isEqualTo ( Player . FIRST ) Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĠAssertions . assertThat ( after Move . board ()). isEqualTo Comp aring Field By Field Re cursively ( follow Up Board ) Ġ} ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġbe Ġgame Ġover `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġgame Ġ= ĠGame Flow Controller () ĊĠĠĠĠĠĠĠ Ġval Ġboard Ġ= ĠBo ards . immutable Board () ĊĊĠĠĠĠĠĠĠ Ġval Ġgame Over Ġ= Ġgame . game Over ( board , Ġtrue ) ĊĠĠĠĠĠĠĠ Ġval Ġgame Over 2 Ġ= Ġgame . game Over ( board ) ĊĊĠĠĠĠĠĠĠ Ġassert All (" game Ġover Ġwith / without Ġover loading Ġargument ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĠAssertions . assertThat ( game Over . is Game Over ()). isTrue () Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĠAssertions . assertThat ( game Over . player ()). isEqualTo ( Player . FIRST ) Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĠAssertions . assertThat ( game Over . board ()). isEqualTo Comp aring Field By Field Re cursively ( board ) Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĠAssertions . assertThat ( game Over 2 . is Game Over ()). isTrue () Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĠAssertions . assertThat ( game Over 2 . player ()). isEqualTo ( Player . FIRST ) Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĠAssertions . assertThat ( game Over 2 ). isEqualTo Comp aring Field By Field Re cursively ( game Over ) Ġ} ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` two Ġmoves , Ġundo Player Move `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġgame Ġ= ĠGame Flow Controller () ĊĊĠĠĠĠĠĠĠ Ġval Ġafter Moves Ġ= Ġgame ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. make AM ove ( 4 8 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. make AM ove ( 3 9 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. undo Player Move Ġ{ Ġ} ĊĊĠĠĠĠĠĠĠ Ġassert All (" after Ġtwo Ġmoves Ġand Ġ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĠAssertions . assertThat ( after Moves . player ()). isEqualTo ( Player . FIRST ) Ġ} ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` three Ġmoves , Ġundo Player Move `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġgame Ġ= ĠGame Flow Controller () ĊĊĠĠĠĠĠĠĠ Ġval Ġafter Moves Ġ= Ġgame ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. make AM ove ( 4 8 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. make AM ove ( 3 9 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. make AM ove ( 4 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. undo Player Move Ġ{ Ġ} ĊĊĠĠĠĠĠĠĠ Ġassert All (" after Ġtwo Ġmoves Ġand Ġ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĠAssertions . assertThat ( after Moves . player ()). isEqualTo ( Player . SECOND ) Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĠAssertions . assertThat ( after Moves . board (). ball Position ). isEqualTo ( 4 8 ) Ġ} ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} Ċ } Ċ