test manatype on enum, not on string

This commit is contained in:
igoudt 2017-06-02 17:27:36 +02:00
parent 745c3a9a7e
commit 35ae9e316e
2 changed files with 10 additions and 12 deletions

View file

@ -1,6 +1,7 @@
package org.mage.test.cards.mana; package org.mage.test.cards.mana;
import mage.abilities.costs.mana.ColorlessManaCost; import mage.abilities.costs.mana.ColorlessManaCost;
import mage.constants.ManaType;
import mage.constants.PhaseStep; import mage.constants.PhaseStep;
import mage.constants.Zone; import mage.constants.Zone;
import org.junit.Test; import org.junit.Test;
@ -35,7 +36,7 @@ public class DoublingCubeTest extends CardTestPlayerBase {
setStopAt(1, PhaseStep.PRECOMBAT_MAIN); setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
execute(); execute();
assertManaPool(playerA, "colorless", 4); assertManaPool(playerA, ManaType.COLORLESS, 4);
} }

View file

@ -8,10 +8,7 @@ import mage.cards.decks.importer.DeckImporterUtil;
import mage.cards.repository.CardInfo; import mage.cards.repository.CardInfo;
import mage.cards.repository.CardRepository; import mage.cards.repository.CardRepository;
import mage.cards.repository.CardScanner; import mage.cards.repository.CardScanner;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.PhaseStep;
import mage.constants.RangeOfInfluence;
import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.Filter; import mage.filter.Filter;
import mage.filter.FilterCard; import mage.filter.FilterCard;
@ -836,25 +833,25 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
} }
public void assertManaPool(Player player, String color, int amount){ public void assertManaPool(Player player, ManaType color, int amount){
ManaPool manaPool = currentGame.getPlayer(player.getId()).getManaPool(); ManaPool manaPool = currentGame.getPlayer(player.getId()).getManaPool();
switch (color){ switch (color){
case "colorless": case COLORLESS:
Assert.assertEquals(manaPool.getColorless() + manaPool.getConditionalMana().stream().mapToInt(Mana::getColorless).sum(), amount); Assert.assertEquals(manaPool.getColorless() + manaPool.getConditionalMana().stream().mapToInt(Mana::getColorless).sum(), amount);
break; break;
case "red": case RED:
Assert.assertEquals(manaPool.getRed() + manaPool.getConditionalMana().stream().mapToInt(Mana::getRed).sum(), amount); Assert.assertEquals(manaPool.getRed() + manaPool.getConditionalMana().stream().mapToInt(Mana::getRed).sum(), amount);
break; break;
case "blue": case BLUE:
Assert.assertEquals(manaPool.getBlue() + manaPool.getConditionalMana().stream().mapToInt(Mana::getBlue).sum(), amount); Assert.assertEquals(manaPool.getBlue() + manaPool.getConditionalMana().stream().mapToInt(Mana::getBlue).sum(), amount);
break; break;
case "white": case WHITE:
Assert.assertEquals(manaPool.getWhite() + manaPool.getConditionalMana().stream().mapToInt(Mana::getWhite).sum(), amount); Assert.assertEquals(manaPool.getWhite() + manaPool.getConditionalMana().stream().mapToInt(Mana::getWhite).sum(), amount);
break; break;
case "green": case GREEN:
Assert.assertEquals(manaPool.getGreen() + manaPool.getConditionalMana().stream().mapToInt(Mana::getGreen).sum(), amount); Assert.assertEquals(manaPool.getGreen() + manaPool.getConditionalMana().stream().mapToInt(Mana::getGreen).sum(), amount);
break; break;
case "black": case BLACK:
Assert.assertEquals(manaPool.getBlack() + manaPool.getConditionalMana().stream().mapToInt(Mana::getBlack).sum(), amount); Assert.assertEquals(manaPool.getBlack() + manaPool.getConditionalMana().stream().mapToInt(Mana::getBlack).sum(), amount);
break; break;
} }