diff --git a/src/main/java/de/hsfulda/onses/services/GameService.java b/src/main/java/de/hsfulda/onses/services/GameService.java index 3edca44..bdee4d5 100644 --- a/src/main/java/de/hsfulda/onses/services/GameService.java +++ b/src/main/java/de/hsfulda/onses/services/GameService.java @@ -24,14 +24,14 @@ public class GameService { // check for special rules (draw, colorchoose, skip,...) } - public boolean allowedMove(Player player, Card card) + public boolean legalMove(Player player, Card card) { - boolean isAllowed = false; + boolean legalMoveFound = false; Card lastCard = game.getLastPlayedCard(); // rules: - if (card.getColor() == lastCard.getColor()) isAllowed = true; // same color + if (card.getColor() == lastCard.getColor()) legalMoveFound = true; // same color - return isAllowed; + return legalMoveFound; } } diff --git a/src/test/java/de/hsfulda/onses/GameServiceTest.java b/src/test/java/de/hsfulda/onses/GameServiceTest.java index 97cba48..8a22108 100644 --- a/src/test/java/de/hsfulda/onses/GameServiceTest.java +++ b/src/test/java/de/hsfulda/onses/GameServiceTest.java @@ -7,7 +7,6 @@ import static org.junit.jupiter.api.Assertions.*; import de.hsfulda.onses.models.Card; import de.hsfulda.onses.models.Player; -import de.hsfulda.onses.models.Game; import de.hsfulda.onses.services.GameService; public class GameServiceTest { @@ -37,8 +36,8 @@ public class GameServiceTest { } @Test - @DisplayName("allowedMoveSameColorRed") - public void allowedMoveSameColorRed() { + @DisplayName("legalMoveSameColorRed") + public void legalMoveSameColorRed() { // arrange Card input = new Card().setColor(Card.Color.RED).setValue(Card.Value.TWO); boolean expected = true; @@ -46,13 +45,13 @@ public class GameServiceTest { GameService gameService = new GameService(); gameService.getGame().setLastPlayedCard(new Card().setColor(Card.Color.RED).setValue(Card.Value.FIVE)); - boolean answer = gameService.allowedMove(new Player(), input); + boolean answer = gameService.legalMove(new Player(), input); // assert assertEquals(expected, answer); } @Test - @DisplayName("allowedMoveSameColorBlue") - public void allowedMoveSameColorBlue() { + @DisplayName("legalMoveSameColorBlue") + public void legalMoveSameColorBlue() { // arrange Card input = new Card().setColor(Card.Color.BLUE).setValue(Card.Value.THREE); boolean expected = true; @@ -60,7 +59,7 @@ public class GameServiceTest { GameService gameService = new GameService(); gameService.getGame().setLastPlayedCard(new Card().setColor(Card.Color.BLUE).setValue(Card.Value.ONE)); - boolean answer = gameService.allowedMove(new Player(), input); + boolean answer = gameService.legalMove(new Player(), input); // assert assertEquals(expected, answer); }