Tests: improved logs on wrong ability command usage

This commit is contained in:
Oleg Agafonov 2023-03-23 23:38:43 +04:00
parent d019acbd55
commit 8f742081b6

View file

@ -620,6 +620,9 @@ public class TestPlayer implements Player {
groupsForTargetHandling = null; groupsForTargetHandling = null;
} }
} }
printStart("Available for " + this.getName());
printAbilities(game, this.getPlayable(game, true));
printEnd();
Assert.fail("Can't find ability to activate command: " + command); Assert.fail("Can't find ability to activate command: " + command);
} else if (action.getAction().startsWith(ACTIVATE_MANA)) { } else if (action.getAction().startsWith(ACTIVATE_MANA)) {
String command = action.getAction(); String command = action.getAction();
@ -669,6 +672,14 @@ public class TestPlayer implements Player {
} }
} }
} }
printStart("Available for " + this.getName());
printAbilities(game, this.getPlayable(game, true));
printEnd();
// TODO: enable assert and rewrite failed activateManaAbility tests
// (must use checkAbility instead multiple mana calls)
//Assert.fail("Can't find mana ability to activate command: " + command);
new Exception("WARNING, test must be rewritten to use checkAbility instead multiple mana calls")
.printStackTrace();
} else if (action.getAction().startsWith("addCounters:")) { } else if (action.getAction().startsWith("addCounters:")) {
String command = action.getAction(); String command = action.getAction();
command = command.substring(command.indexOf("addCounters:") + 12); command = command.substring(command.indexOf("addCounters:") + 12);
@ -1204,9 +1215,9 @@ public class TestPlayer implements Player {
+ a.getSourceObject(game).getIdName() + " -> " + a.getSourceObject(game).getIdName() + " -> "
+ (a.toString().startsWith("Cast ") ? "[" + a.getManaCostsToPay().getText() + "] -> " : "") // printed cost, not modified + (a.toString().startsWith("Cast ") ? "[" + a.getManaCostsToPay().getText() + "] -> " : "") // printed cost, not modified
+ (a.toString().length() > 0 + (a.toString().length() > 0
? a.toString().substring(0, Math.min(20, a.toString().length())) ? a.toString().substring(0, Math.min(40, a.toString().length())) + "..."
: a.getClass().getSimpleName()) : a.getClass().getSimpleName())
+ "...")) ))
.sorted() .sorted()
.collect(Collectors.toList()); .collect(Collectors.toList());