55import org .junit .Before ;
66import org .junit .Test ;
77
8+ import static hotciv .framework .GameConstants .ARCHER ;
89import static org .hamcrest .CoreMatchers .is ;
910import static org .junit .Assert .assertNull ;
1011import static org .junit .Assert .assertThat ;
1112
1213public class zetaCiv_tests {
13- private Game game ;
14+ private GameImpl game ;
1415 /**
1516 * Fixture for zetaCiv testing.
1617 */
1718 @ Before
1819 public void setUp () {
1920 game = new GameImpl (GameType .zetaCiv , 2 );
2021 }
22+
23+ @ Test
24+ public void zetaCiv_FirstPlayerThatConquersWorldWins () {
25+ Position city1 = new Position (1 , 1 );
26+ Position city2 = new Position (1 , 4 );
27+
28+ game .setCityAt (city1 , Player .BLUE );
29+ game .setCityAt (city2 , Player .BLUE );
30+
31+ assertThat (game .getCityAt (city1 ).getOwner (), is (Player .BLUE ));
32+ assertThat (game .getWinner (), is (Player .BLUE )); // Blue owns both cities and should win
33+ }
34+ @ Test
35+ public void winnerAfter20Rounds (){
36+ game .progressRounds (20 );
37+
38+ Position unit1 = new Position (1 , 1 );
39+ game .createUnitAt (unit1 , ARCHER , Player .RED );
40+ game .incrementNumberOfSuccessfulAttacks (unit1 );
41+ assertNull (game .getWinner ());
42+ game .incrementNumberOfSuccessfulAttacks (unit1 );
43+ assertNull (game .getWinner ());
44+ game .incrementNumberOfSuccessfulAttacks (unit1 );
45+ assertThat (game .getWinner (), is (Player .RED ));
46+ }
2147}
0 commit comments