From d2031d81f393db73652cf9c72af716fc6f0de015 Mon Sep 17 00:00:00 2001 From: LevelX2 <ludwig.hirth@online.de> Date: Tue, 26 Jan 2016 10:39:51 +0100 Subject: [PATCH] Added test. --- .../sets/battleforzendikar/SwarmSurge.java | 6 +-- .../mage/test/cards/rules/CantCastTest.java | 37 +++++++++++++++++-- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/Mage.Sets/src/mage/sets/battleforzendikar/SwarmSurge.java b/Mage.Sets/src/mage/sets/battleforzendikar/SwarmSurge.java index 4c86dffec6..559a47fc4b 100644 --- a/Mage.Sets/src/mage/sets/battleforzendikar/SwarmSurge.java +++ b/Mage.Sets/src/mage/sets/battleforzendikar/SwarmSurge.java @@ -47,10 +47,10 @@ import mage.filter.predicate.mageobject.ColorlessPredicate; */ public class SwarmSurge extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Colorless creatures you control"); + private static final FilterCreaturePermanent FILTER = new FilterCreaturePermanent("Colorless creatures you control"); static { - filter.add(new ColorlessPredicate()); + FILTER.add(new ColorlessPredicate()); } public SwarmSurge(UUID ownerId) { @@ -66,7 +66,7 @@ public class SwarmSurge extends CardImpl { this.getSpellAbility().addEffect(new BoostControlledEffect(2, 0, Duration.EndOfTurn)); // Colorless creatures you control also gain first strike until end of turn. - Effect effect = new GainAbilityControlledEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn, filter); + Effect effect = new GainAbilityControlledEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn, FILTER); effect.setText("Colorless creatures you control also gain first strike until end of turn"); this.getSpellAbility().addEffect(effect); } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/rules/CantCastTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/rules/CantCastTest.java index 1e55f7efd5..97fa256ab8 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/rules/CantCastTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/rules/CantCastTest.java @@ -40,11 +40,11 @@ public class CantCastTest extends CardTestPlayerBase { /** * I control Void Winnower. But my opponent can cast Jayemdae Tome (that's - * converted mana cost is even) He can cast other even spell. - * + * converted mana cost is even) He can cast other even spell. Test casting + * cost 4 */ @Test - public void testVoidWinnower() { + public void testVoidWinnower1() { // Your opponent can't cast spells with even converted mana costs. (Zero is even.) // Your opponents can't block with creatures with even converted mana costs. addCard(Zone.BATTLEFIELD, playerB, "Void Winnower"); @@ -53,7 +53,7 @@ public class CantCastTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Jayemdae Tome", 1); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Jayemdae Tome"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Jayemdae Tome"); // {4} setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); @@ -64,6 +64,9 @@ public class CantCastTest extends CardTestPlayerBase { } + /** + * Test with X=3 + */ @Test public void testVoidWinnower2() { // Your opponent can't cast spells with even converted mana costs. (Zero is even.) @@ -87,6 +90,9 @@ public class CantCastTest extends CardTestPlayerBase { } + /** + * Test with X=4 + */ @Test public void testVoidWinnower3() { // Your opponent can't cast spells with even converted mana costs. (Zero is even.) @@ -136,4 +142,27 @@ public class CantCastTest extends CardTestPlayerBase { assertHandCount(playerA, "Pine Walker", 1); } + + /** + * Test with casting cost = {0} + */ + @Test + public void testVoidWinnowerZero() { + // Your opponent can't cast spells with even converted mana costs. (Zero is even.) + // Your opponents can't block with creatures with even converted mana costs. + addCard(Zone.BATTLEFIELD, playerB, "Void Winnower"); + + // Metalcraft - {T}: Add one mana of any color to your mana pool. Activate this ability only if you control three or more artifacts. + addCard(Zone.HAND, playerA, "Mox Opal", 1); // {0} + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Mox Opal"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertHandCount(playerA, "Mox Opal", 1); + + assertLife(playerB, 20); + + } }