From d0afdd0f57012cb31973afdd759c80c124e23f5c Mon Sep 17 00:00:00 2001 From: fdai7793 Date: Sat, 3 Feb 2024 19:11:31 +0100 Subject: [PATCH] Test.CheckCardRemovalFromBotDeck --- .../de/hsfulda/onses/PlayerServiceTest.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/test/java/de/hsfulda/onses/PlayerServiceTest.java b/src/test/java/de/hsfulda/onses/PlayerServiceTest.java index 0bb951a..c9dad13 100644 --- a/src/test/java/de/hsfulda/onses/PlayerServiceTest.java +++ b/src/test/java/de/hsfulda/onses/PlayerServiceTest.java @@ -3,6 +3,7 @@ package de.hsfulda.onses; import com.sun.tools.jconsole.JConsoleContext; import de.hsfulda.onses.models.Card; +import de.hsfulda.onses.services.GameService; import de.hsfulda.onses.services.PlayerService; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -110,4 +111,25 @@ public class PlayerServiceTest { assertEquals(before - 1, after); } + + @Test + @DisplayName("CheckCardRemovalFromBotDeck") + void CheckCardRemovalFromBotDeck() { + 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); + + gameService.getGame().setLastPlayedCard(new Card().setColor(Card.Color.RED).setValue(Card.Value.FIVE)); + gameService.getGame().getPlayerService().setCurrentTurn(false); + + gameService.getGame().getPlayerService().getPlayerList().getLast().addCardToPlayerDeck(card1); + gameService.getGame().getPlayerService().getPlayerList().getLast().addCardToPlayerDeck(card2); + int before = gameService.getGame().getPlayerService().getPlayerList().getLast().getPlayerDeck().size(); + + gameService.getGame().getPlayerService().botMove(); + int after = gameService.getGame().getPlayerService().getPlayerList().getLast().getPlayerDeck().size(); + + assertEquals(before - 1, after); + } }