From 8f742081b6fd3064009c077f8a0a3d1e90b7a422 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Thu, 23 Mar 2023 23:38:43 +0400 Subject: [PATCH] Tests: improved logs on wrong ability command usage --- .../java/org/mage/test/player/TestPlayer.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java index 7f59787625..66264a201d 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java @@ -620,6 +620,9 @@ public class TestPlayer implements Player { groupsForTargetHandling = null; } } + printStart("Available for " + this.getName()); + printAbilities(game, this.getPlayable(game, true)); + printEnd(); Assert.fail("Can't find ability to activate command: " + command); } else if (action.getAction().startsWith(ACTIVATE_MANA)) { 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:")) { String command = action.getAction(); command = command.substring(command.indexOf("addCounters:") + 12); @@ -1204,9 +1215,9 @@ public class TestPlayer implements Player { + a.getSourceObject(game).getIdName() + " -> " + (a.toString().startsWith("Cast ") ? "[" + a.getManaCostsToPay().getText() + "] -> " : "") // printed cost, not modified + (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()) - + "...")) + )) .sorted() .collect(Collectors.toList());