completed UT for 3443

This commit is contained in:
igoudt 2017-05-31 22:33:02 +02:00
parent b0a6c76228
commit 86bc25811d
2 changed files with 30 additions and 2 deletions

View file

@ -1,5 +1,6 @@
package org.mage.test.cards.mana;
import mage.abilities.costs.mana.ColorlessManaCost;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
@ -8,15 +9,21 @@ import org.mage.test.serverside.base.impl.CardTestAPIImpl;
public class DoublingCubeTest extends CardTestPlayerBase {
// {3}, {T}: Double the amount of each type of mana in your mana pool.
String cube = "Doubling Cube";
// {T}: Add {C}{C} to your mana pool. Spend this mana only to cast colorless Eldrazi spells or activate abilities of colorless Eldrazi.
String temple = "Eldrazi Temple";
// Mana pools don't empty as steps and phases end.
String upwelling = "Upwelling";
//issue 3443
@Test
public void DoublingCubeEldraziTemple() {
addCard(Zone.BATTLEFIELD, playerA, temple);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
addCard(Zone.BATTLEFIELD, playerA, cube);
addCard(Zone.BATTLEFIELD, playerA, upwelling);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {G} to your mana pool");
@ -28,7 +35,7 @@ public class DoublingCubeTest extends CardTestPlayerBase {
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
execute();
assertManaPool(playerA);
assertManaPool(playerA, "colorless", 4);
}

View file

@ -1,5 +1,6 @@
package org.mage.test.serverside.base.impl;
import mage.Mana;
import mage.abilities.Ability;
import mage.cards.Card;
import mage.cards.decks.Deck;
@ -835,8 +836,28 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
}
public void assertManaPool(Player player){
public void assertManaPool(Player player, String color, int amount){
ManaPool manaPool = currentGame.getPlayer(player.getId()).getManaPool();
switch (color){
case "colorless":
Assert.assertEquals(manaPool.getColorless() + manaPool.getConditionalMana().stream().mapToInt(Mana::getColorless).sum(), amount);
break;
case "red":
Assert.assertEquals(manaPool.getRed() + manaPool.getConditionalMana().stream().mapToInt(Mana::getRed).sum(), amount);
break;
case "blue":
Assert.assertEquals(manaPool.getBlue() + manaPool.getConditionalMana().stream().mapToInt(Mana::getBlue).sum(), amount);
break;
case "white":
Assert.assertEquals(manaPool.getWhite() + manaPool.getConditionalMana().stream().mapToInt(Mana::getWhite).sum(), amount);
break;
case "green":
Assert.assertEquals(manaPool.getGreen() + manaPool.getConditionalMana().stream().mapToInt(Mana::getGreen).sum(), amount);
break;
case "black":
Assert.assertEquals(manaPool.getBlack() + manaPool.getConditionalMana().stream().mapToInt(Mana::getBlack).sum(), amount);
break;
}
}
/**