Browse Source

Test.totalTurns

main
fdai7920 11 months ago
parent
commit
a2f37d2d66
  1. 23
      src/test/java/de/hsfulda/onses/PlayerServiceTest.java

23
src/test/java/de/hsfulda/onses/PlayerServiceTest.java

@ -12,8 +12,7 @@ public class PlayerServiceTest {
@Test @Test
@DisplayName("addPlayerToPlayerList") @DisplayName("addPlayerToPlayerList")
void addPlayerToPlayerList()
{
void addPlayerToPlayerList() {
//arrange //arrange
Player input = new Player(); Player input = new Player();
Player expected = input; Player expected = input;
@ -24,10 +23,10 @@ public class PlayerServiceTest {
// assert // assert
assertEquals(expected, answer); assertEquals(expected, answer);
} }
@Test @Test
@DisplayName("addMultiplePlayerToPlayerList") @DisplayName("addMultiplePlayerToPlayerList")
void addMultiplePlayerToPlayerList()
{
void addMultiplePlayerToPlayerList() {
//arrange //arrange
Player input1 = new Player(); Player input1 = new Player();
Player expected1 = input1; Player expected1 = input1;
@ -47,8 +46,7 @@ public class PlayerServiceTest {
@Test @Test
@DisplayName("addAmountOfOpponents") @DisplayName("addAmountOfOpponents")
void addAmountOfOpponents()
{
void addAmountOfOpponents() {
//arrange //arrange
int input = 3; int input = 3;
int expected = 3; int expected = 3;
@ -64,4 +62,17 @@ public class PlayerServiceTest {
assertEquals(expected, answer); 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);
}
} }
Loading…
Cancel
Save