Unit tests for Blood Moon + Urborg interaction (#3216)

* Adding unit tests for Blood Moon + Urborg, Tomb of Yawgmoth interaction as per issue #3072 and #2957.  These tests fail expected, confirming those bug reports.

* Re-adding line that was accidentally deleted from other unit test.

* Cleaning up unit tests a bit more and removing leftover code I had missed the first time.
This commit is contained in:
Clint Herron 2017-04-23 04:36:01 +02:00 committed by Jeff Wadsworth
parent 900e7b29ba
commit 56ce1abb44
2 changed files with 75 additions and 0 deletions

View file

@ -32,6 +32,7 @@ import mage.constants.CardType;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -128,7 +129,68 @@ public class LandTypeChangingEffectsTest extends CardTestPlayerBase {
assertCounterCount("Forbidding Watchtower", CounterType.FLOOD, 1);
assertType("Forbidding Watchtower", CardType.LAND, "Island");
assertPowerToughness(playerB, "Forbidding Watchtower", 1, 5);
}
String urborgtoy = "Urborg, Tomb of Yawgmoth";
String bloodmoon = "Blood Moon";
String canopyvista = "Canopy Vista";
@Test
public void testBloodMoonBeforeUrborg() {
// Blood Moon 2R
// Enchantment
// Nonbasic lands are Mountains
addCard(Zone.HAND, playerA, bloodmoon);
// Each land is a Swamp in addition to its other land types.
addCard(Zone.HAND, playerA, urborgtoy);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
addCard(Zone.BATTLEFIELD, playerB, canopyvista, 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, bloodmoon);
playLand(1, PhaseStep.POSTCOMBAT_MAIN, playerA, urborgtoy);
setStopAt(2, PhaseStep.PRECOMBAT_MAIN);
execute();
assertPermanentCount(playerA, bloodmoon, 1);
assertPermanentCount(playerA, urborgtoy, 1);
assertType(canopyvista, CardType.LAND, "Mountain");
assertNotSubtype(canopyvista, "Island");
assertNotSubtype(canopyvista, "Swamp");
assertType(urborgtoy, CardType.LAND, "Mountain");
assertNotSubtype(urborgtoy, "Swamp");
Assert.assertTrue("The mana the land can produce should be [{R}] but it's " + playerB.getManaAvailable(currentGame).toString(), playerB.getManaAvailable(currentGame).toString().equals("[{R}]"));
}
@Test
public void testBloodMoonAfterUrborg() {
// Blood Moon 2R
// Enchantment
// Nonbasic lands are Mountains
addCard(Zone.HAND, playerA, bloodmoon);
// Each land is a Swamp in addition to its other land types.
addCard(Zone.HAND, playerA, urborgtoy);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
addCard(Zone.BATTLEFIELD, playerB, canopyvista, 1);
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, urborgtoy);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, bloodmoon);
setStopAt(2, PhaseStep.PRECOMBAT_MAIN);
execute();
assertPermanentCount(playerA, bloodmoon, 1);
assertPermanentCount(playerA, urborgtoy, 1);
assertType(canopyvista, CardType.LAND, "Mountain");
assertNotSubtype(canopyvista, "Island");
assertNotSubtype(canopyvista, "Swamp");
assertType(urborgtoy, CardType.LAND, "Mountain");
assertNotSubtype(urborgtoy, "Swamp");
Assert.assertTrue("The mana the land can produce should be [{R}] but it's " + playerB.getManaAvailable(currentGame).toString(), playerB.getManaAvailable(currentGame).toString().equals("[{R}]"));
}
}

View file

@ -721,6 +721,19 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
Assert.assertFalse("(Battlefield) card type found (" + cardName + ':' + type + ')', found.getCardType().contains(type));
}
/**
* Assert whether a permanent is not a specified subtype
*
* @param cardName Name of the permanent that should be checked.
* @param subType a subtype to test for
*/
public void assertNotSubtype(String cardName, String subType) throws AssertionError {
Permanent found = getPermanent(cardName);
if (subType != null) {
Assert.assertFalse("(Battlefield) card sub-type equal (" + cardName + ':' + subType + ')', found.getSubtype(currentGame).contains(subType));
}
}
/**
* Assert whether a permanent is tapped or not
*