From 24847c1fa748e2f56b06350ea0351d6f34aee061 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Sat, 24 Jul 2021 15:50:18 +0400 Subject: [PATCH] Tests: added name test for +2 mace; --- .../test/cards/single/afr/Plus2MaceTest.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/single/afr/Plus2MaceTest.java diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/afr/Plus2MaceTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/afr/Plus2MaceTest.java new file mode 100644 index 0000000000..2d6711ac1d --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/afr/Plus2MaceTest.java @@ -0,0 +1,26 @@ +package org.mage.test.cards.single.afr; + +import mage.cards.Card; +import mage.cards.repository.CardInfo; +import mage.cards.repository.CardRepository; +import mage.util.GameLog; +import org.junit.Assert; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * @author JayDi85 + */ +public class Plus2MaceTest extends CardTestPlayerBase { + + @Test + public void test_NameProcessingByRegExp() { + // + character can't processing by regexp, so it must be quoted replaced in code by Pattern.quote(mageObject.getName()) + String cardName = "+2 Mace"; + CardInfo cardinfo = CardRepository.instance.findCard(cardName); + Assert.assertNotNull(cardName + " must exists", cardinfo); + Card card = cardinfo.getCard(); + String cardText = GameLog.replaceNameByColoredName(card, card.getSpellAbility().toString(), null); + Assert.assertTrue("card text must contain card name", cardText.contains(cardName)); + } +}