Tests for LevelUpAbility

This commit is contained in:
magenoxx 2012-05-02 19:21:29 +04:00
parent 76c6362df1
commit c2ea8246d2
7 changed files with 148 additions and 39 deletions

View file

@ -14,11 +14,79 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
*/
public class LevelUpAbilityTest extends CardTestPlayerBase {
/**
* Tests creature without any level up counter
*/
@Test
public void testFirstLevel() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Transcendent Master");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Plains", 15);
setStopAt(2, Constants.PhaseStep.END_TURN);
execute();
Permanent master = getPermanent("Transcendent Master", playerA.getId());
Assert.assertTrue(master.getCounters().isEmpty());
Assert.assertEquals(3, master.getPower().getValue());
Assert.assertEquals(3, master.getToughness().getValue());
Assert.assertFalse(master.getAbilities().contains(LifelinkAbility.getInstance()));
Assert.assertFalse(master.getAbilities().contains(IndestructibleAbility.getInstance()));
}
/**
* Tests that putting level up counters really makes effect
*/
@Test
public void testLevelChanged() {
public void testFirstLevelWithOneCounter() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Transcendent Master");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Plains", 15);
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Level up {1}");
setStopAt(2, Constants.PhaseStep.END_TURN);
execute();
Permanent master = getPermanent("Transcendent Master", playerA.getId());
Assert.assertEquals(1, master.getCounters().getCount(CounterType.LEVEL));
Assert.assertEquals(3, master.getPower().getValue());
Assert.assertEquals(3, master.getToughness().getValue());
Assert.assertFalse(master.getAbilities().contains(LifelinkAbility.getInstance()));
Assert.assertFalse(master.getAbilities().contains(IndestructibleAbility.getInstance()));
}
/**
* Tests second level that gives Lifelink as well as 6/6
*/
@Test
public void testSecondLevel() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Transcendent Master");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Plains", 15);
for (int i = 0; i < 6; i++) {
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Level up {1}");
}
setStopAt(2, Constants.PhaseStep.END_TURN);
execute();
Permanent master = getPermanent("Transcendent Master", playerA.getId());
Assert.assertEquals(6, master.getCounters().getCount(CounterType.LEVEL));
Assert.assertEquals(6, master.getPower().getValue());
Assert.assertEquals(6, master.getToughness().getValue());
// since now Lifelink will appear
Assert.assertTrue(master.getAbilities().contains(LifelinkAbility.getInstance()));
// but still no Indestructible
Assert.assertFalse(master.getAbilities().contains(IndestructibleAbility.getInstance()));
}
/**
* Tests third level that gives both Lifelink and Indestructible as well as 9/9
*/
@Test
public void testThirdLevel() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Transcendent Master");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Plains", 15);
@ -30,10 +98,6 @@ public class LevelUpAbilityTest extends CardTestPlayerBase {
execute();
Permanent master = getPermanent("Transcendent Master", playerA.getId());
Assert.assertNotNull(master);
Assert.assertNotNull(master.getCounters());
Assert.assertFalse(master.getCounters().isEmpty());
Assert.assertEquals(12, master.getCounters().getCount(CounterType.LEVEL));
Assert.assertEquals("Power different", 9, master.getPower().getValue());
@ -41,4 +105,29 @@ public class LevelUpAbilityTest extends CardTestPlayerBase {
Assert.assertTrue(master.getAbilities().contains(LifelinkAbility.getInstance()));
Assert.assertTrue(master.getAbilities().contains(IndestructibleAbility.getInstance()));
}
/**
* Tests that extra counters won't make any effect over third level
*/
@Test
public void testExtraCounters() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Transcendent Master");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Plains", 15);
for (int i = 0; i < 15; i++) {
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Level up {1}");
}
setStopAt(2, Constants.PhaseStep.END_TURN);
execute();
Permanent master = getPermanent("Transcendent Master", playerA.getId());
Assert.assertEquals(15, master.getCounters().getCount(CounterType.LEVEL));
Assert.assertEquals("Power different", 9, master.getPower().getValue());
Assert.assertEquals("Toughness different", 9, master.getToughness().getValue());
Assert.assertTrue(master.getAbilities().contains(LifelinkAbility.getInstance()));
Assert.assertTrue(master.getAbilities().contains(IndestructibleAbility.getInstance()));
}
}

View file

@ -71,7 +71,6 @@ public class PhantasmalImageTest extends CardTestPlayerBase {
castSpell(2, Constants.PhaseStep.PRECOMBAT_MAIN, playerB, "Phantasmal Image");
setStopAt(2, Constants.PhaseStep.END_TURN);
execute();