Add Verify test to detect that copy of a Card throws an Exception (#10752)

* Add test to detect a copy loop on all the Card in the CardRepository

* reword messages

* move copy test in verify checks

* catch any kind of error
This commit is contained in:
Susucre 2023-08-05 00:37:45 +02:00 committed by GitHub
parent 5c58e28f9b
commit b04b13d530
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -57,7 +57,7 @@ public class VerifyCardDataTest {
private static final Logger logger = Logger.getLogger(VerifyCardDataTest.class);
private static final String FULL_ABILITIES_CHECK_SET_CODES = "LTR;LTC"; // check ability text due mtgjson, can use multiple sets like MAT;CMD or * for all
private static final String FULL_ABILITIES_CHECK_SET_CODES = "LTR;LTC;CMM"; // check ability text due mtgjson, can use multiple sets like MAT;CMD or * for all
private static final boolean CHECK_ONLY_ABILITIES_TEXT = false; // use when checking text locally, suppresses unnecessary checks and output messages
private static final boolean AUTO_FIX_SAMPLE_DECKS = false; // debug only: auto-fix sample decks by test_checkSampleDecks test run
@ -1606,6 +1606,7 @@ public class VerifyCardDataTest {
checkBasicLands(card, ref);
checkMissingAbilities(card, ref);
checkWrongSymbolsInRules(card);
checkCardCanBeCopied(card);
}
checkWrongAbilitiesText(card, ref, cardIndex);
}
@ -1635,6 +1636,14 @@ public class VerifyCardDataTest {
}
}
private void checkCardCanBeCopied(Card card) {
try {
Card card2 = card.copy();
} catch (Error err) {
fail(card, "copy", "throws on copy : " + err.getClass() + " : " + err.getMessage() + " : ");
}
}
private void checkSubtypes(Card card, MtgJsonCard ref) {
if (skipListHaveName(SKIP_LIST_SUBTYPE, card.getExpansionSetCode(), card.getName())) {
return;