From c4bc3f78aaa2fec0ef71e44d40393f040e2c1e63 Mon Sep 17 00:00:00 2001 From: fdai7793 Date: Sat, 3 Feb 2024 19:15:01 +0100 Subject: [PATCH] refactoring: ImprovingCheckForCardRemoval --- .../java/de/hsfulda/onses/PlayerServiceTest.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/test/java/de/hsfulda/onses/PlayerServiceTest.java b/src/test/java/de/hsfulda/onses/PlayerServiceTest.java index c9dad13..1f1d140 100644 --- a/src/test/java/de/hsfulda/onses/PlayerServiceTest.java +++ b/src/test/java/de/hsfulda/onses/PlayerServiceTest.java @@ -97,17 +97,19 @@ public class PlayerServiceTest { @Test @DisplayName("CheckForCardRemoval") void CheckForCardRemoval() { - PlayerService playerService = new PlayerService(); + GameService gameService = new GameService(); Card card1 = new Card().setColor(Card.Color.YELLOW).setValue(Card.Value.TWO); 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); }