From fe79dba5156f8a31ada73bc0185e2eaa5acafe83 Mon Sep 17 00:00:00 2001 From: fdai7920 Date: Sun, 4 Feb 2024 20:43:49 +0100 Subject: [PATCH] Test.DrawByChoiceAndPlay --- .../de/hsfulda/onses/GameServiceTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/test/java/de/hsfulda/onses/GameServiceTest.java b/src/test/java/de/hsfulda/onses/GameServiceTest.java index 208dac7..889f4b1 100644 --- a/src/test/java/de/hsfulda/onses/GameServiceTest.java +++ b/src/test/java/de/hsfulda/onses/GameServiceTest.java @@ -283,6 +283,25 @@ public class GameServiceTest { assertEquals(expected, answer); } + @Test + @DisplayName("DrawByChoiceForcePlay") + public void DrawByChoiceForcePlay() { + + GameService gameService = new GameService(); + Card input = new Card().setColor(Card.Color.RED).setValue(Card.Value.ONE); + + gameService.drawCard(gameService.getGame().getDrawCardDeck().size()); + gameService.getGame().getPlayerService().setCurrentTurn(true); + gameService.getGame().setLastPlayedCard(new Card().setColor(Card.Color.RED).setValue(Card.Value.SEVEN)); + gameService.getGame().addCardToDrawCardDeck(input); + gameService.getGame().getPlayerService().getPlayerList().getFirst().addCardToPlayerDeck(new Card().setColor(Card.Color.BLUE).setValue(Card.Value.TWO)); + gameService.drawCard(1); + + Card answer = gameService.getGame().getPlayerService().getPlayerList().getFirst().getPlayerDeck().getLast(); + + assertNotEquals(input, answer); + } + @Test @DisplayName("CheckThatBotDeckHasSevenCardsAfterGameStart") public void CheckThatBotDeckHasSevenCardsAfterGameStart() {