diff options
-rw-r--r-- | game-engine/src/test/java/org/luxons/sevenwonders/game/GameTest.java | 17 | ||||
-rw-r--r-- | game-engine/src/test/java/org/luxons/sevenwonders/game/test/TestUtils.java | 6 |
2 files changed, 7 insertions, 16 deletions
diff --git a/game-engine/src/test/java/org/luxons/sevenwonders/game/GameTest.java b/game-engine/src/test/java/org/luxons/sevenwonders/game/GameTest.java index e504126d..b9b399bb 100644 --- a/game-engine/src/test/java/org/luxons/sevenwonders/game/GameTest.java +++ b/game-engine/src/test/java/org/luxons/sevenwonders/game/GameTest.java @@ -91,26 +91,17 @@ public class GameTest { private static PlayerMove createPlayCardMove(PlayerTurnInfo turnInfo) { for (HandCard handCard : turnInfo.getHand()) { if (handCard.isFree()) { - return createMove(handCard, MoveType.PLAY); + return TestUtils.createPlayerMove(handCard.getCard().getName(), MoveType.PLAY); } } - return createMove(turnInfo.getHand().get(0), MoveType.DISCARD); + HandCard firstCardInHand = turnInfo.getHand().get(0); + return TestUtils.createPlayerMove(firstCardInHand.getCard().getName(), MoveType.DISCARD); } private static PlayerMove createPickGuildMove(PlayerTurnInfo turnInfo) { List<Card> neighbourGuilds = turnInfo.getNeighbourGuildCards(); assertNotNull(neighbourGuilds); String cardName = neighbourGuilds.isEmpty() ? null : neighbourGuilds.get(0).getName(); - PlayerMove move = new PlayerMove(); - move.setCardName(cardName); - move.setType(MoveType.COPY_GUILD); - return move; - } - - private static PlayerMove createMove(HandCard handCard, MoveType type) { - PlayerMove move = new PlayerMove(); - move.setCardName(handCard.getCard().getName()); - move.setType(type); - return move; + return TestUtils.createPlayerMove(cardName, MoveType.COPY_GUILD); } } diff --git a/game-engine/src/test/java/org/luxons/sevenwonders/game/test/TestUtils.java b/game-engine/src/test/java/org/luxons/sevenwonders/game/test/TestUtils.java index 137dd3d7..34b2e74f 100644 --- a/game-engine/src/test/java/org/luxons/sevenwonders/game/test/TestUtils.java +++ b/game-engine/src/test/java/org/luxons/sevenwonders/game/test/TestUtils.java @@ -220,13 +220,13 @@ public class TestUtils { } public static Move createMove(int playerIndex, Card card, MoveType type, BoughtResources... boughtResources) { - PlayerMove playerMove = createPlayerMove(card, type, boughtResources); + PlayerMove playerMove = createPlayerMove(card.getName(), type, boughtResources); return type.resolve(playerIndex, card, playerMove); } - private static PlayerMove createPlayerMove(Card card, MoveType type, BoughtResources... boughtResources) { + public static PlayerMove createPlayerMove(String cardName, MoveType type, BoughtResources... boughtResources) { PlayerMove playerMove = new PlayerMove(); - playerMove.setCardName(card.getName()); + playerMove.setCardName(cardName); playerMove.setType(type); playerMove.setBoughtResources(Arrays.asList(boughtResources)); return playerMove; |