From 2d7abb293604cd6513b46fba25cdd96881fc090b Mon Sep 17 00:00:00 2001 From: fdai7906 Date: Mon, 5 Feb 2024 19:11:00 +0100 Subject: [PATCH] Test.ChooseColorBotTest --- .../de/hsfulda/onses/GameServiceTest.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/test/java/de/hsfulda/onses/GameServiceTest.java b/src/test/java/de/hsfulda/onses/GameServiceTest.java index fde7519..d84fdc7 100644 --- a/src/test/java/de/hsfulda/onses/GameServiceTest.java +++ b/src/test/java/de/hsfulda/onses/GameServiceTest.java @@ -1,6 +1,7 @@ package de.hsfulda.onses; +import de.hsfulda.onses.models.Game; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -395,4 +396,24 @@ public class GameServiceTest { assertTrue(lastPlayedCardDoesNotExistInDrawCardDeck); } + + @Test + @DisplayName("ChooseColorBotTest") + public void ChooseColorBotTest() { + GameService gameService = new GameService(); + Card card = new Card().setColor(Card.Color.BLACK).setValue(Card.Value.CHOOSE); + boolean answer = false; + + gameService.getGame().getPlayerService().getPlayerList().getLast().getPlayerDeck().clear(); + gameService.getGame().getPlayerService().getPlayerList().getLast().getPlayerDeck().add(card); + + gameService.getGame().getPlayerService().setCurrentTurn(false); + gameService.playCard(card); + + if (gameService.getGame().getLastPlayedCard().getColor() != Card.Color.BLACK){ + answer = true; + } + + assertTrue(answer); + } }