From b5f45f395faa13d82af7bdc3b83b0d67647965ac Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Sun, 14 Jun 2020 04:32:10 +0400 Subject: [PATCH] Tests: improved showCardInfo to show texts from multiple card names --- .../cards/single/ThousandYearStormTest.java | 2 +- .../java/mage/verify/VerifyCardDataTest.java | 28 ++++++++++++------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/ThousandYearStormTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/ThousandYearStormTest.java index f777c75bab..f2a88b5b99 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/ThousandYearStormTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/ThousandYearStormTest.java @@ -280,7 +280,7 @@ public class ThousandYearStormTest extends CardTestPlayerBase { Cycling {2} ({2}, Discard this card: Draw a card.) */ // Test fails sometimes with the following message: - // java.lang.AssertionError: b 0x copy after control - PlayerA have wrong life: 20 <> 17 expected:<17> but was:<20> + // Can't find available command - activate:Cast Lightning Bolt$targetPlayer=PlayerA @Test public void test_GetControlNotCounts() { addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5); diff --git a/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java b/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java index 8e32f24aec..2c2d1e3e4e 100644 --- a/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java +++ b/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java @@ -967,17 +967,25 @@ public class VerifyCardDataTest { @Test public void showCardInfo() throws Exception { // debug only: show direct card info (takes it from class file, not from db repository) - String cardName = "Essence Capture"; + // can check multiple cards at once, example: name1;name2;name3 + String cardNames = "Armed // Dangerous;Beacon Behemoth;Grizzly Bears"; CardScanner.scan(); - CardSetInfo testSet = new CardSetInfo(cardName, "test", "123", Rarity.COMMON); - CardInfo cardInfo = CardRepository.instance.findCard(cardName); - Card card = CardImpl.createCard(cardInfo.getClassName(), testSet); - System.out.println(card.getName()); - if (card instanceof SplitCard) { - card.getAbilities().getRules(card.getName()).stream().forEach(System.out::println); - } else { - card.getRules().stream().forEach(System.out::println); - } + Arrays.stream(cardNames.split(";")).forEach(cardName -> { + cardName = cardName.trim(); + CardSetInfo testSet = new CardSetInfo(cardName, "test", "123", Rarity.COMMON); + CardInfo cardInfo = CardRepository.instance.findCard(cardName); + if (cardInfo == null) { + Assert.fail("Can't find card name: " + cardName); + } + Card card = CardImpl.createCard(cardInfo.getClassName(), testSet); + System.out.println(); + System.out.println(card.getName() + " " + card.getManaCost().getText()); + if (card instanceof SplitCard) { + card.getAbilities().getRules(card.getName()).stream().forEach(System.out::println); + } else { + card.getRules().stream().forEach(System.out::println); + } + }); } private void checkWrongAbilitiesText(Card card, JsonCard ref, int cardIndex) {