fixed some NPE's and other errors

This commit is contained in:
BetaSteward 2012-02-23 15:26:57 -05:00
parent c2df049383
commit 68391a7522
12 changed files with 82 additions and 15 deletions

View file

@ -0,0 +1,50 @@
package org.mage.test.cards;
import mage.Constants;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class TestCobraTrap extends CardTestPlayerBase {
@Test
public void testCard() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 2);
addCard(Constants.Zone.HAND, playerA, "Cobra Trap");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Mountain", 3);
addCard(Constants.Zone.HAND, playerB, "Stone Rain");
castSpell(2, Constants.PhaseStep.PRECOMBAT_MAIN, playerB, "Stone Rain", "Forest");
castSpell(2, Constants.PhaseStep.POSTCOMBAT_MAIN, playerA, "Cobra Trap");
setStopAt(2, Constants.PhaseStep.END_TURN);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertPermanentCount(playerA, "Forest", 1);
assertPermanentCount(playerA, "Snake", 4);
}
@Test
public void testCardNegative() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 2);
addCard(Constants.Zone.HAND, playerA, "Cobra Trap");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Mountain", 3);
addCard(Constants.Zone.HAND, playerB, "Stone Rain");
castSpell(2, Constants.PhaseStep.POSTCOMBAT_MAIN, playerA, "Cobra Trap");
setStopAt(2, Constants.PhaseStep.END_TURN);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
assertPermanentCount(playerA, "Forest", 2);
assertPermanentCount(playerA, "Snake", 0);
}
}