Browse Source

refactoring: ImprovingCheckForCardRemoval

main
fdai7793 11 months ago
parent
commit
c4bc3f78aa
  1. 14
      src/test/java/de/hsfulda/onses/PlayerServiceTest.java

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

@ -97,17 +97,19 @@ public class PlayerServiceTest {
@Test @Test
@DisplayName("CheckForCardRemoval") @DisplayName("CheckForCardRemoval")
void CheckForCardRemoval() { void CheckForCardRemoval() {
PlayerService playerService = new PlayerService();
GameService gameService = new GameService();
Card card1 = new Card().setColor(Card.Color.YELLOW).setValue(Card.Value.TWO); Card card1 = new Card().setColor(Card.Color.YELLOW).setValue(Card.Value.TWO);
Card card2 = new Card().setColor(Card.Color.RED).setValue(Card.Value.ONE); Card card2 = new Card().setColor(Card.Color.RED).setValue(Card.Value.ONE);
playerService.getPlayerList().getFirst().addCardToPlayerDeck(card1);
playerService.getPlayerList().getFirst().addCardToPlayerDeck(card2);
int before = playerService.getPlayerList().getFirst().getPlayerDeck().size();
gameService.getGame().getPlayerService().setCurrentTurn(true);
gameService.getGame().getPlayerService().getPlayerList().getFirst().addCardToPlayerDeck(card1);
gameService.getGame().getPlayerService().getPlayerList().getFirst().addCardToPlayerDeck(card2);
int before = gameService.getGame().getPlayerService().getPlayerList().getFirst().getPlayerDeck().size();
playerService.removeCardFromPlayerDeck(card1);
int after = playerService.getPlayerList().getFirst().getPlayerDeck().size();
gameService.getGame().getPlayerService().removeCardFromPlayerDeck(card1);
int after = gameService.getGame().getPlayerService().getPlayerList().getFirst().getPlayerDeck().size();
assertEquals(before - 1, after); assertEquals(before - 1, after);
} }

Loading…
Cancel
Save