From 86bc25811d4656f17747b92420c388d28191aad7 Mon Sep 17 00:00:00 2001 From: igoudt Date: Wed, 31 May 2017 22:33:02 +0200 Subject: [PATCH] completed UT for 3443 --- .../test/cards/mana/DoublingCubeTest.java | 9 +++++++- .../base/impl/CardTestPlayerAPIImpl.java | 23 ++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/mana/DoublingCubeTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/mana/DoublingCubeTest.java index ed477c2fa5..e659f324a2 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/mana/DoublingCubeTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/mana/DoublingCubeTest.java @@ -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); } diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java index 563c552ad1..f550889536 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java @@ -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; + } } /**