|
@ -15,11 +15,15 @@ public class PlayerServiceTest { |
|
|
void addPlayerToPlayerList() { |
|
|
void addPlayerToPlayerList() { |
|
|
//arrange |
|
|
//arrange |
|
|
Player input = new Player(); |
|
|
Player input = new Player(); |
|
|
Player expected = input; |
|
|
|
|
|
|
|
|
boolean expected = true; |
|
|
|
|
|
boolean answer = false; |
|
|
// act |
|
|
// act |
|
|
PlayerService playerservice = new PlayerService(); |
|
|
PlayerService playerservice = new PlayerService(); |
|
|
playerservice.addPlayerToList(input); |
|
|
playerservice.addPlayerToList(input); |
|
|
Player answer = playerservice.getPlayerList().getFirst(); |
|
|
|
|
|
|
|
|
for (Player i : playerservice.getPlayerList()) |
|
|
|
|
|
{ |
|
|
|
|
|
if (i == input) {answer = true; break;} |
|
|
|
|
|
} |
|
|
// assert |
|
|
// assert |
|
|
assertEquals(expected, answer); |
|
|
assertEquals(expected, answer); |
|
|
} |
|
|
} |
|
@ -28,20 +32,24 @@ public class PlayerServiceTest { |
|
|
@DisplayName("addMultiplePlayerToPlayerList") |
|
|
@DisplayName("addMultiplePlayerToPlayerList") |
|
|
void addMultiplePlayerToPlayerList() { |
|
|
void addMultiplePlayerToPlayerList() { |
|
|
//arrange |
|
|
//arrange |
|
|
|
|
|
boolean expected = true; |
|
|
Player input1 = new Player(); |
|
|
Player input1 = new Player(); |
|
|
Player expected1 = input1; |
|
|
|
|
|
|
|
|
boolean answer1 = false; |
|
|
Player input2 = new Player(); |
|
|
Player input2 = new Player(); |
|
|
Player expected2 = input2; |
|
|
|
|
|
|
|
|
boolean answer2 = false; |
|
|
// act |
|
|
// act |
|
|
PlayerService playerservice = new PlayerService(); |
|
|
PlayerService playerservice = new PlayerService(); |
|
|
playerservice.addPlayerToList(input1); |
|
|
playerservice.addPlayerToList(input1); |
|
|
playerservice.addPlayerToList(input2); |
|
|
playerservice.addPlayerToList(input2); |
|
|
|
|
|
|
|
|
Player answer1 = playerservice.getPlayerList().getFirst(); |
|
|
|
|
|
Player answer2 = playerservice.getPlayerList().get(1); |
|
|
|
|
|
|
|
|
for (Player i : playerservice.getPlayerList()) |
|
|
|
|
|
{ |
|
|
|
|
|
if (i == input1) {answer1 = true;} |
|
|
|
|
|
if (i == input2) {answer2 = true;} |
|
|
|
|
|
} |
|
|
// assert |
|
|
// assert |
|
|
assertEquals(expected1, answer1); |
|
|
|
|
|
assertEquals(expected2, answer2); |
|
|
|
|
|
|
|
|
assertEquals(expected, answer1); |
|
|
|
|
|
assertEquals(expected, answer2); |
|
|
} |
|
|
} |
|
|
@Test |
|
|
@Test |
|
|
@DisplayName("checkCurrentTurnAfterNextTurn") |
|
|
@DisplayName("checkCurrentTurnAfterNextTurn") |
|
@ -70,4 +78,16 @@ public class PlayerServiceTest { |
|
|
// assert |
|
|
// assert |
|
|
assertEquals(expected, answer); |
|
|
assertEquals(expected, answer); |
|
|
} |
|
|
} |
|
|
|
|
|
@Test |
|
|
|
|
|
@DisplayName("RelationShip_Player_PlayerService") |
|
|
|
|
|
void Relationship_Player_PlayerService() { |
|
|
|
|
|
// arrange |
|
|
|
|
|
PlayerService expected = new PlayerService(); |
|
|
|
|
|
// act |
|
|
|
|
|
PlayerService answer1 = expected.getPlayerList().getFirst().getPlayerService(); |
|
|
|
|
|
PlayerService answer2 = expected.getPlayerList().getLast().getPlayerService(); |
|
|
|
|
|
// assert |
|
|
|
|
|
assertEquals(expected, answer1); |
|
|
|
|
|
assertEquals(expected, answer2); |
|
|
|
|
|
} |
|
|
} |
|
|
} |