Two failing tests based on users' bug reports

This commit is contained in:
magenoxx 2012-05-11 19:34:56 +04:00
parent 0e2481c0a9
commit 38eaef59e0
3 changed files with 115 additions and 0 deletions

View file

@ -0,0 +1,41 @@
package org.mage.test.cards.abilities.enters;
import junit.framework.Assert;
import mage.Constants;
import mage.game.permanent.Permanent;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author noxx
*/
public class ProteanHydraTest extends CardTestPlayerBase {
@Test
public void testEnteringWithCounters() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 5);
addCard(Constants.Zone.HAND, playerA, "Protean Hydra");
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Protean Hydra");
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
for (Permanent permanent : currentGame.getBattlefield().getAllPermanents()) {
if (permanent.getName().equals("Forest")) {
// check all mana was spent
Assert.assertTrue(permanent.isTapped());
}
}
assertPermanentCount(playerA, "Protean Hydra", 1);
Permanent proteanHydra = getPermanent("Protean Hydra", playerA.getId());
Assert.assertEquals(4, proteanHydra.getPower().getValue());
Assert.assertEquals(4, proteanHydra.getToughness().getValue());
}
}

View file

@ -0,0 +1,39 @@
package org.mage.test.cards.conditional.twofaced;
import junit.framework.Assert;
import mage.Constants;
import mage.filter.Filter;
import mage.game.permanent.Permanent;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author noxx
*/
public class TwoFacedCardEffectsTest extends CardTestPlayerBase {
/**
* Tests that effects disappears when card gets transformed
*/
@Test
public void testEffectTurnedOffOnTransform() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mayor of Avabruck");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Wolfir Avenger");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Elite Inquisitor");
setStopAt(2, Constants.PhaseStep.BEGIN_COMBAT);
execute();
// check was transformed
assertPermanentCount(playerA, "Howlpack Alpha", 1);
// check new effect works
assertPowerToughness(playerA, "Wolfir Avenger", 4, 4, Filter.ComparisonScope.Any);
// check old effect doesn't work
Permanent eliteInquisitor = getPermanent("Elite Inquisitor", playerA.getId());
Assert.assertEquals(2, eliteInquisitor.getPower().getValue());
Assert.assertEquals(2, eliteInquisitor.getToughness().getValue());
}
}

View file

@ -0,0 +1,35 @@
package org.mage.test.cards.triggers.combat.damage;
import mage.Constants;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author noxx
*
* Whenever this creature deals combat damage to a player or planeswalker, draw that many cards.
*/
public class HuntersInsightTest extends CardTestPlayerBase {
@Test
public void testDrawingCards() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 3);
addCard(Constants.Zone.HAND, playerA, "Hunter's Insight", 1);
addCard(Constants.Zone.BATTLEFIELD, playerA, "Stampeding Rhino", 1);
attack(3, playerA, "Stampeding Rhino");
castSpell(3, Constants.PhaseStep.DECLARE_BLOCKERS, playerA, "Hunter's Insight", "Stampeding Rhino");
setStopAt(3, Constants.PhaseStep.POSTCOMBAT_MAIN);
execute();
assertLife(playerA, 20);
assertLife(playerB, 16);
// +1 in draw phase
// +4 in combat
assertHandCount(playerA, 5);
}
}