|
@ -43,70 +43,4 @@ public class PlayerServiceTest { |
|
|
assertEquals(expected1, answer1); |
|
|
assertEquals(expected1, answer1); |
|
|
assertEquals(expected2, answer2); |
|
|
assertEquals(expected2, answer2); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
@DisplayName("addAmountOfOpponents") |
|
|
|
|
|
void addAmountOfOpponents() { |
|
|
|
|
|
//arrange |
|
|
|
|
|
int input = 3; |
|
|
|
|
|
int expected = 3; |
|
|
|
|
|
// act |
|
|
|
|
|
PlayerService playerservice = new PlayerService(); |
|
|
|
|
|
int before = playerservice.getPlayerList().size(); |
|
|
|
|
|
|
|
|
|
|
|
playerservice.addOpponents(input); |
|
|
|
|
|
|
|
|
|
|
|
int after = playerservice.getPlayerList().size(); |
|
|
|
|
|
int answer = after - before; |
|
|
|
|
|
// assert |
|
|
|
|
|
assertEquals(expected, answer); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
@DisplayName("TotalTurnsEqualsAmountPlayers") |
|
|
|
|
|
void totalTurnsEqualsAmountPlayers() { |
|
|
|
|
|
// act |
|
|
|
|
|
PlayerService playerservice = new PlayerService(); |
|
|
|
|
|
playerservice.addPlayerToList(new Player()); |
|
|
|
|
|
playerservice.addOpponents(3); |
|
|
|
|
|
|
|
|
|
|
|
int expected = playerservice.getPlayerList().size(); |
|
|
|
|
|
int answer = playerservice.getTotalTurns(); |
|
|
|
|
|
// assert |
|
|
|
|
|
assertEquals(expected, answer); |
|
|
|
|
|
} |
|
|
|
|
|
@Test |
|
|
|
|
|
@DisplayName("currentTurnsSwitching") |
|
|
|
|
|
void currentTurnsSwitching4Players() { |
|
|
|
|
|
// arrange |
|
|
|
|
|
int expected = 2; |
|
|
|
|
|
// act |
|
|
|
|
|
PlayerService playerservice = new PlayerService(); |
|
|
|
|
|
playerservice.addPlayerToList(new Player()); |
|
|
|
|
|
playerservice.addOpponents(3); |
|
|
|
|
|
|
|
|
|
|
|
for (int i=0; i < expected; i++){ playerservice.nextTurn(); } |
|
|
|
|
|
|
|
|
|
|
|
int answer = playerservice.getCurrentTurn(); |
|
|
|
|
|
// assert |
|
|
|
|
|
assertEquals(expected, answer); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
@DisplayName("currentTurnsResettingAfterAfterTotalTurns") |
|
|
|
|
|
void currentTurnsResettingAfterTotalTurns() { |
|
|
|
|
|
// arrange |
|
|
|
|
|
int expected = 0; |
|
|
|
|
|
// act |
|
|
|
|
|
PlayerService playerservice = new PlayerService(); |
|
|
|
|
|
playerservice.addPlayerToList(new Player()); |
|
|
|
|
|
playerservice.addOpponents(3); |
|
|
|
|
|
int totalTurns = playerservice.getTotalTurns(); |
|
|
|
|
|
|
|
|
|
|
|
for (int i=0; i < totalTurns; i++){ playerservice.nextTurn(); } |
|
|
|
|
|
|
|
|
|
|
|
int answer = playerservice.getCurrentTurn(); |
|
|
|
|
|
// assert |
|
|
|
|
|
assertEquals(expected, answer); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |