From 7e771a2fc3cae9b5721ae3636a6468125f183de1 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 28 Jul 2020 13:27:31 +0200 Subject: [PATCH] * Changes to execute stop assert and execute assert again a single test (e.g. druidsRepositoryTest()). --- .../base/impl/CardTestPlayerAPIImpl.java | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java index dd97f07cfb4..674cf34d621 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestPlayerAPIImpl.java @@ -287,14 +287,16 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement } } Assert.assertFalse("Wrong stop command on " + this.stopOnTurn + " / " + this.stopAtStep + " (" + this.stopAtStep.getIndex() + ")" - + " (found actions after stop on " + maxTurn + " / " + maxPhase + ")", + + " (found actions after stop on " + maxTurn + " / " + maxPhase + ")", (maxTurn > this.stopOnTurn) || (maxTurn == this.stopOnTurn && maxPhase > this.stopAtStep.getIndex())); - for (Player player : currentGame.getPlayers().values()) { - TestPlayer testPlayer = (TestPlayer) player; - currentGame.cheat(player.getId(), getCommands(testPlayer)); - currentGame.cheat(player.getId(), activePlayer.getId(), getLibraryCards(testPlayer), getHandCards(testPlayer), - getBattlefieldCards(testPlayer), getGraveCards(testPlayer), getCommandCards(testPlayer)); + if (!currentGame.isPaused()) { + for (Player player : currentGame.getPlayers().values()) { + TestPlayer testPlayer = (TestPlayer) player; + currentGame.cheat(player.getId(), getCommands(testPlayer)); + currentGame.cheat(player.getId(), activePlayer.getId(), getLibraryCards(testPlayer), getHandCards(testPlayer), + getBattlefieldCards(testPlayer), getGraveCards(testPlayer), getCommandCards(testPlayer)); + } } long t1 = System.nanoTime(); @@ -303,6 +305,9 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement gameOptions.stopOnTurn = stopOnTurn; gameOptions.stopAtStep = stopAtStep; currentGame.setGameOptions(gameOptions); + if (currentGame.isPaused()) { + currentGame.resume();// needed if execute() is performed multiple times + } currentGame.start(activePlayer.getId()); currentGame.setGameStopped(true); // used for rollback handling long t2 = System.nanoTime(); @@ -530,8 +535,8 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement * should be used once before initialization to form the library in certain * order. *

- * Warning, if you doesn't add cards to hand then player will lose the game on draw and test - * return unused actions (game ended too early) + * Warning, if you doesn't add cards to hand then player will lose the game + * on draw and test return unused actions (game ended too early) * * @param player {@link Player} to remove all library cards from. */