Tests: added verify checks for wrong set's settings like parent set and block name (temporary disabled)

This commit is contained in:
Oleg Agafonov 2023-04-07 03:41:10 +04:00
parent 59d2b59a4f
commit 8f748b0f2c
4 changed files with 53 additions and 3 deletions

View file

@ -942,6 +942,50 @@ public class VerifyCardDataTest {
}
}
// CHECK: parent and block info
for (ExpansionSet set : sets) {
if (true) continue; // TODO: comments it and run to find a problems
MtgJsonSet jsonSet = MtgJsonService.sets().getOrDefault(set.getCode().toUpperCase(Locale.ENGLISH), null);
if (jsonSet == null) {
continue;
}
// parent set
MtgJsonSet jsonParentSet = jsonSet.parentCode == null ? null : MtgJsonService.sets().getOrDefault(jsonSet.parentCode, null);
ExpansionSet mageParentSet = set.getParentSet();
String jsonParentCode = jsonParentSet == null ? "null" : jsonParentSet.code;
String mageParentCode = mageParentSet == null ? "null" : mageParentSet.getCode();
String needMageClass = "";
if (!jsonParentCode.equals("null")) {
needMageClass = sets
.stream()
.filter(exp -> exp.getCode().equals(jsonParentCode))
.map(exp -> " - " + exp.getClass().getSimpleName() + ".getInstance()")
.findFirst()
.orElse("- error, can't find class");
}
if (!Objects.equals(jsonParentCode, mageParentCode)) {
errorsList.add(String.format("Error: set with wrong parentSet settings: %s (parentSet = %s, but must be %s%s)",
set.getCode() + " - " + set.getName(),
mageParentCode,
jsonParentCode,
needMageClass
));
}
// block info
if (!Objects.equals(set.getBlockName(), jsonSet.block)) {
if (true) continue; // TODO: comments it and run to find a problems
errorsList.add(String.format("Error: set with wrong blockName settings: %s (blockName = %s, but must be %s)",
set.getCode() + " - " + set.getName(),
set.getBlockName(),
jsonSet.block
));
}
}
// TODO: add test to check num cards for rarity (rarityStats > 0 and numRarity > 0)
printMessages(warningsList);
printMessages(errorsList);