Tests: improved showCardInfo to show texts from multiple card names

This commit is contained in:
Oleg Agafonov 2020-06-14 04:32:10 +04:00
parent ad4be5a9fe
commit b5f45f395f
2 changed files with 19 additions and 11 deletions

View file

@ -280,7 +280,7 @@ public class ThousandYearStormTest extends CardTestPlayerBase {
Cycling {2} ({2}, Discard this card: Draw a card.) Cycling {2} ({2}, Discard this card: Draw a card.)
*/ */
// Test fails sometimes with the following message: // 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 @Test
public void test_GetControlNotCounts() { public void test_GetControlNotCounts() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5); addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);

View file

@ -967,17 +967,25 @@ public class VerifyCardDataTest {
@Test @Test
public void showCardInfo() throws Exception { public void showCardInfo() throws Exception {
// debug only: show direct card info (takes it from class file, not from db repository) // 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(); CardScanner.scan();
Arrays.stream(cardNames.split(";")).forEach(cardName -> {
cardName = cardName.trim();
CardSetInfo testSet = new CardSetInfo(cardName, "test", "123", Rarity.COMMON); CardSetInfo testSet = new CardSetInfo(cardName, "test", "123", Rarity.COMMON);
CardInfo cardInfo = CardRepository.instance.findCard(cardName); CardInfo cardInfo = CardRepository.instance.findCard(cardName);
if (cardInfo == null) {
Assert.fail("Can't find card name: " + cardName);
}
Card card = CardImpl.createCard(cardInfo.getClassName(), testSet); Card card = CardImpl.createCard(cardInfo.getClassName(), testSet);
System.out.println(card.getName()); System.out.println();
System.out.println(card.getName() + " " + card.getManaCost().getText());
if (card instanceof SplitCard) { if (card instanceof SplitCard) {
card.getAbilities().getRules(card.getName()).stream().forEach(System.out::println); card.getAbilities().getRules(card.getName()).stream().forEach(System.out::println);
} else { } else {
card.getRules().stream().forEach(System.out::println); card.getRules().stream().forEach(System.out::println);
} }
});
} }
private void checkWrongAbilitiesText(Card card, JsonCard ref, int cardIndex) { private void checkWrongAbilitiesText(Card card, JsonCard ref, int cardIndex) {