From d7c7b7688ee1d41034c108fbbbde5968baf19fc0 Mon Sep 17 00:00:00 2001 From: fdai7793 Date: Sun, 4 Feb 2024 18:28:13 +0100 Subject: [PATCH] CheckThatLastPlayedCardWasPlayedByBot --- .../de/hsfulda/onses/PlayerServiceTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/test/java/de/hsfulda/onses/PlayerServiceTest.java b/src/test/java/de/hsfulda/onses/PlayerServiceTest.java index 1f1d140..74333b8 100644 --- a/src/test/java/de/hsfulda/onses/PlayerServiceTest.java +++ b/src/test/java/de/hsfulda/onses/PlayerServiceTest.java @@ -134,4 +134,23 @@ public class PlayerServiceTest { assertEquals(before - 1, after); } + + @Test + @DisplayName("CheckThatLastPlayedCardWasPlayedByBot") + void CheckThatLastPlayedCardWasPlayedByBot() { + GameService gameService = new GameService(); + + Card card1 = 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().getPlayerDeck().clear(); + gameService.getGame().getPlayerService().getPlayerList().getLast().addCardToPlayerDeck(card1); + + gameService.getGame().getPlayerService().botMove(); + Card lastPlayedCard = gameService.getGame().getLastPlayedCard(); + + assertEquals(card1, lastPlayedCard); + } }