From daea448c5ce7226bf27163c8c02c9291a1e154f5 Mon Sep 17 00:00:00 2001 From: fdai7920 Date: Wed, 24 Jan 2024 14:50:04 +0100 Subject: [PATCH] Test.allowedMove --- .../de/hsfulda/onses/GameServiceTest.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/test/java/de/hsfulda/onses/GameServiceTest.java b/src/test/java/de/hsfulda/onses/GameServiceTest.java index 2d7f904..97cba48 100644 --- a/src/test/java/de/hsfulda/onses/GameServiceTest.java +++ b/src/test/java/de/hsfulda/onses/GameServiceTest.java @@ -35,4 +35,34 @@ public class GameServiceTest { // assert assertEquals(input, answer); } + + @Test + @DisplayName("allowedMoveSameColorRed") + public void allowedMoveSameColorRed() { + // arrange + Card input = new Card().setColor(Card.Color.RED).setValue(Card.Value.TWO); + boolean expected = true; + // act + GameService gameService = new GameService(); + gameService.getGame().setLastPlayedCard(new Card().setColor(Card.Color.RED).setValue(Card.Value.FIVE)); + + boolean answer = gameService.allowedMove(new Player(), input); + // assert + assertEquals(expected, answer); + } + @Test + @DisplayName("allowedMoveSameColorBlue") + public void allowedMoveSameColorBlue() { + // arrange + Card input = new Card().setColor(Card.Color.BLUE).setValue(Card.Value.THREE); + boolean expected = true; + // act + GameService gameService = new GameService(); + gameService.getGame().setLastPlayedCard(new Card().setColor(Card.Color.BLUE).setValue(Card.Value.ONE)); + + boolean answer = gameService.allowedMove(new Player(), input); + // assert + assertEquals(expected, answer); + } + }