Fixed tests

This commit is contained in:
Oleg Agafonov 2020-01-28 16:42:44 +04:00
parent 5c058d8f85
commit eb93c08a6f
3 changed files with 13 additions and 5 deletions

View file

@ -418,6 +418,7 @@ public class ManifestTest extends CardTestPlayerBase {
activateAbility(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Sacrifice a creature"); activateAbility(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Sacrifice a creature");
setChoice(playerB, EmptyNames.FACE_DOWN_CREATURE.toString()); setChoice(playerB, EmptyNames.FACE_DOWN_CREATURE.toString());
setStrictChooseMode(true);
setStopAt(2, PhaseStep.END_TURN); setStopAt(2, PhaseStep.END_TURN);
execute(); execute();
assertAllCommandsUsed(); assertAllCommandsUsed();

View file

@ -1,4 +1,3 @@
package org.mage.test.cards.abilities.oneshot.counterspell; package org.mage.test.cards.abilities.oneshot.counterspell;
import mage.constants.PhaseStep; import mage.constants.PhaseStep;
@ -7,7 +6,6 @@ import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public class NotOfThisWorldTest extends CardTestPlayerBase { public class NotOfThisWorldTest extends CardTestPlayerBase {
@ -22,20 +20,24 @@ public class NotOfThisWorldTest extends CardTestPlayerBase {
public void testCounterFirstSpell() { public void testCounterFirstSpell() {
// At the beginning of each player's upkeep, destroy target nonartifact creature that player controls of their choice. It can't be regenerated. // At the beginning of each player's upkeep, destroy target nonartifact creature that player controls of their choice. It can't be regenerated.
addCard(Zone.BATTLEFIELD, playerA, "The Abyss", 1); addCard(Zone.BATTLEFIELD, playerA, "The Abyss", 1);
addCard(Zone.BATTLEFIELD, playerB, "Island", 7); addCard(Zone.BATTLEFIELD, playerB, "Island", 7);
//
// Counter target spell or ability that targets a permanent you control. // Counter target spell or ability that targets a permanent you control.
// Not of This World costs {7} less to cast if it targets a spell or ability that targets a creature you control with power 7 or greater. // Not of This World costs {7} less to cast if it targets a spell or ability that targets a creature you control with power 7 or greater.
addCard(Zone.HAND, playerB, "Not of This World"); addCard(Zone.HAND, playerB, "Not of This World");
//
// At the beginning of combat on your turn, choose an opponent at random. Ruhan of the Fomori attacks that player this combat if able. // At the beginning of combat on your turn, choose an opponent at random. Ruhan of the Fomori attacks that player this combat if able.
addCard(Zone.BATTLEFIELD, playerB, "Ruhan of the Fomori", 1); // 7/7 addCard(Zone.BATTLEFIELD, playerB, "Ruhan of the Fomori", 1); // 7/7
// trigger on upkeep to destroy
addTarget(playerB, "Ruhan of the Fomori"); addTarget(playerB, "Ruhan of the Fomori");
// try to counter
castSpell(2, PhaseStep.UPKEEP, playerB, "Not of This World", "stack ability (At the beginning of each player's upkeep"); castSpell(2, PhaseStep.UPKEEP, playerB, "Not of This World", "stack ability (At the beginning of each player's upkeep");
setStrictChooseMode(true);
setStopAt(2, PhaseStep.PRECOMBAT_MAIN); setStopAt(2, PhaseStep.PRECOMBAT_MAIN);
execute(); execute();
assertAllCommandsUsed();
assertHandCount(playerB, "Not of This World", 0); assertHandCount(playerB, "Not of This World", 0);
assertGraveyardCount(playerB, "Not of This World", 1); assertGraveyardCount(playerB, "Not of This World", 1);

View file

@ -364,11 +364,16 @@ public class TestPlayer implements Player {
return true; return true;
} }
// must search any names, even empty // must search any names, even empty (face down cards)
if (CardUtil.haveSameNames(nameOrAlias, object.getName(), true)) { if (CardUtil.haveSameNames(nameOrAlias, object.getName(), true)) {
return true; return true;
} }
// no more empty names needs
if (nameOrAlias.isEmpty()) {
return false;
}
return object.getName().startsWith(nameOrAlias); return object.getName().startsWith(nameOrAlias);
} }