diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/CrewTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/CrewTest.java index 74c545302e..4d9e6c830e 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/CrewTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/CrewTest.java @@ -81,4 +81,27 @@ public class CrewTest extends CardTestPlayerBase { assertType("Smuggler's Copter", CardType.CREATURE, "Vehicle"); } + @Test + public void testThatBouncingACrewedVehicleWillUncrewIt() { + addCard(Zone.BATTLEFIELD, playerA, "Smuggler's Copter", 1); + addCard(Zone.BATTLEFIELD, playerA, "Speedway Fanatic", 1); + addCard(Zone.BATTLEFIELD, playerA, "Island", 7); + addCard(Zone.HAND, playerA, "Evacuation", 1); + + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Crew 1"); + setChoice(playerA, "Speedway Fanatic"); + + // Return all creatures to there owners hands + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Evacuation"); + + // (Re)Cast Smugglers Copter + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Smuggler's Copter"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + // Only crewed vehicles have card type creature + assertNotType("Smuggler's Copter", CardType.CREATURE); + } + } 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 8892244611..3d819e72d3 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 @@ -703,22 +703,24 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement * @param subType a subtype to test for */ public void assertType(String cardName, CardType type, String subType) throws AssertionError { - Permanent found = null; - for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents()) { - if (permanent.getName().equals(cardName)) { - found = permanent; - break; - } - } - - Assert.assertNotNull("There is no such permanent on the battlefield, cardName=" + cardName, found); - + Permanent found = getPermanent(cardName); Assert.assertTrue("(Battlefield) card type not found (" + cardName + ':' + type + ')', found.getCardType().contains(type)); if (subType != null) { Assert.assertTrue("(Battlefield) card sub-type not equal (" + cardName + ':' + subType + ')', found.getSubtype(currentGame).contains(subType)); } } + /** + * Assert whether a permanent is not a specified type + * + * @param cardName Name of the permanent that should be checked. + * @param type A type to test for + */ + public void assertNotType(String cardName, CardType type) throws AssertionError { + Permanent found = getPermanent(cardName); + Assert.assertFalse("(Battlefield) card type found (" + cardName + ':' + type + ')', found.getCardType().contains(type)); + } + /** * Assert whether a permanent is tapped or not * @@ -922,6 +924,20 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement Assert.assertEquals("message", currentGame.getState().getActivePlayerId(), player.getId()); } + public Permanent getPermanent(String cardName) { + Permanent found = null; + for (Permanent permanent : currentGame.getBattlefield().getAllActivePermanents()) { + if (permanent.getName().equals(cardName)) { + found = permanent; + break; + } + } + + Assert.assertNotNull("Couldn't find a card with specified name: " + cardName, found); + + return found; + } + public Permanent getPermanent(String cardName, Player player) { return getPermanent(cardName, player.getId()); }