From 1f44e1a592b94a99f5c68a1620b699b236e59713 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 4 May 2015 18:37:41 +0200 Subject: [PATCH] * Some minor adjustements to test handling. --- .../src/test/java/org/mage/test/player/TestPlayer.java | 5 +++-- .../mage/test/serverside/base/CardTestPlayerBase.java | 4 +++- .../test/serverside/base/impl/CardTestPlayerAPIImpl.java | 9 +++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java index bd81d51666..22a6c90582 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java @@ -71,6 +71,7 @@ import mage.target.TargetSource; import mage.target.TargetSpell; import mage.target.common.TargetCardInHand; import mage.target.common.TargetPermanentOrPlayer; +import static org.mage.test.serverside.base.CardTestPlayerBase.NO_TARGET; /** * @@ -134,7 +135,7 @@ public class TestPlayer extends ComputerPlayer { for (Ability ability: this.getPlayable(game, true)) { if (ability.toString().startsWith(groups[0])) { Ability newAbility = ability.copy(); - if (groups.length > 1) { + if (groups.length > 1 && !groups[1].equals("target=NO_TARGET")) { if (!addTargets(newAbility, groups, game)) { // targets could not be set -> try next priority break; @@ -543,7 +544,7 @@ public class TestPlayer extends ComputerPlayer { return null; } - private boolean checkExecuteCondition(String[] groups, Game game) { + private boolean checkExecuteCondition(String[] groups, Game game) { if (groups[2].startsWith("spellOnStack=")) { String spellOnStack = groups[2].substring(13); for (StackObject stackObject: game.getStack()) { diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/CardTestPlayerBase.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/CardTestPlayerBase.java index 5f486f7fd5..68c08699bc 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/CardTestPlayerBase.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/CardTestPlayerBase.java @@ -31,6 +31,8 @@ import org.mage.test.serverside.base.impl.CardTestPlayerAPIImpl; */ public abstract class CardTestPlayerBase extends CardTestPlayerAPIImpl { + public static final String NO_TARGET = "NO_TARGET"; + protected enum ExpectedType { TURN_NUMBER, RESULT, @@ -39,7 +41,7 @@ public abstract class CardTestPlayerBase extends CardTestPlayerAPIImpl { GRAVEYARD, UNKNOWN } - + protected GameOptions gameOptions; public CardTestPlayerBase() { diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java index 10645e939c..8c19c2b95a 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java @@ -796,6 +796,15 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement player.addAction(turnNum, step, "activate:" + ability + "$target=" + targetName); } + /** + * + * @param turnNum + * @param step + * @param player + * @param ability + * @param targetName if not target has to be defined use the constant NO_TARGET + * @param spellOnStack + */ public void activateAbility(int turnNum, PhaseStep step, TestPlayer player, String ability, String targetName, String spellOnStack) { StringBuilder sb = new StringBuilder("activate:").append(ability); if (targetName != null && !targetName.isEmpty()) {