Added test to check missing abilities
@@ -82,6 +82,9 @@ public class VerifyCardDataTest {
// number
skipListCreate("NUMBER");
+
+ // missing abilities
+ skipListCreate("MISSING_ABILITIES");
}
public static List<Card> allCards() {
@@ -440,6 +443,7 @@ public class VerifyCardDataTest {
checkColors(card, ref);
//checkNumbers(card, ref); // TODO: load data from allsets.json and check it (allcards.json do not have card numbers)
checkBasicLands(card, ref);
+ checkMissingAbilities(card, ref);
}
private void checkColors(Card card, JsonCard ref) {
@@ -510,6 +514,33 @@ public class VerifyCardDataTest {
}
}
+ private void checkMissingAbilities(Card card, JsonCard ref) {
+ if (skipListHaveName("MISSING_ABILITIES", card.getName())) {
+ return;
+ }
+
+ // search missing abilities from card source
+
+ if (ref.text == null || ref.text.isEmpty()) {
+ return;
+ }
+
+ // spells have only 1 abilities
+ if (card.isSorcery() || card.isInstant()) {
+ return;
+ }
+
+ // additional cost go to 1 ability
+ if (ref.text.startsWith("As an additional cost to cast")) {
+ return;
+ }
+
+ // always 1 ability (to cast)
+ if (card.getAbilities().toArray().length == 1) { // all cards have 1 inner ability to cast
+ fail(card, "abilities", "card's abilities is empty, but ref have text");
+ }
+ }
+
private static <T> boolean eqSet(Collection<T> a, Collection<T> b) {
if (a == null || a.isEmpty()) {
return b == null || b.isEmpty();
