From e1cf2fd7e077ae9a3e9dd9694e3cede923546631 Mon Sep 17 00:00:00 2001 From: DeepCrimson <98864333+DeepCrimson@users.noreply.github.com> Date: Thu, 16 Jun 2022 21:55:53 -0700 Subject: [PATCH] Move useRedDefault() method to only test which uses it (#9104) Co-authored-by: DeepCrimson Co-authored-by: Oleg Agafonov --- .../test/serverside/base/CardTestAPI.java | 10 ++---- .../serverside/base/impl/CardTestAPIImpl.java | 27 --------------- .../base/impl/CardTestPlayerAPIImpl.java | 27 --------------- .../abilities/ProtectionFromTypeTest.java | 33 +++++++++++++++---- 4 files changed, 28 insertions(+), 69 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/CardTestAPI.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/CardTestAPI.java index bb41e38218..23b4746827 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/CardTestAPI.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/CardTestAPI.java @@ -1,6 +1,5 @@ package org.mage.test.serverside.base; -import java.util.List; import mage.abilities.Ability; import mage.constants.PhaseStep; import mage.constants.Zone; @@ -8,6 +7,8 @@ import mage.filter.Filter; import mage.players.Player; import org.mage.test.player.TestPlayer; +import java.util.List; + /** * Interface for all test initialization and assertion operations. */ @@ -23,13 +24,6 @@ public interface CardTestAPI { DRAW } - //******* INITIALIZATION METHODS *******/ - /** - * Default game initialization params for red player (that plays with - * Mountains) - */ - void useRedDefault(); - /** * Removes all cards from player's library from the game. Usually this * should be used once before initialization to form the library in certain diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestAPIImpl.java b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestAPIImpl.java index ffc2dd5831..4874dca392 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestAPIImpl.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/base/impl/CardTestAPIImpl.java @@ -24,33 +24,6 @@ import java.util.UUID; * @author ayratn */ public abstract class CardTestAPIImpl extends MageTestBase implements CardTestAPI { - - /** - * Default game initialization params for red player (that plays with Mountains) - */ - @Override - public void useRedDefault() { - // *** ComputerA *** - // battlefield:ComputerA:Mountain:5 - addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5); - // hand:ComputerA:Mountain:4 - addCard(Zone.HAND, playerA, "Mountain", 5); - // library:ComputerA:clear:0 - removeAllCardsFromLibrary(playerA); - // library:ComputerA:Mountain:10 - addCard(Zone.LIBRARY, playerA, "Mountain", 10); - - // *** ComputerB *** - // battlefield:ComputerB:Plains:2 - addCard(Zone.BATTLEFIELD, playerB, "Plains", 2); - // hand:ComputerB:Plains:2 - addCard(Zone.HAND, playerB, "Plains", 2); - // library:ComputerB:clear:0 - removeAllCardsFromLibrary(playerB); - // library:ComputerB:Plains:10 - addCard(Zone.LIBRARY, playerB, "Plains", 10); - } - /** * Removes all cards from player's library from the game. * Usually this should be used once before initialization to form the library in certain order. 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 7ab7a2d077..d46e13fcb8 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 @@ -156,33 +156,6 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement } } - /** - * Default game initialization params for red player (that plays with - * Mountains) - */ - @Override - public void useRedDefault() { - // *** ComputerA *** - // battlefield:ComputerA:Mountain:5 - addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5); - // hand:ComputerA:Mountain:4 - addCard(Zone.HAND, playerA, "Mountain", 5); - // library:ComputerA:clear:0 - removeAllCardsFromLibrary(playerA); - // library:ComputerA:Mountain:10 - addCard(Zone.LIBRARY, playerA, "Mountain", 10); - - // *** ComputerB *** - // battlefield:ComputerB:Plains:2 - addCard(Zone.BATTLEFIELD, playerB, "Plains", 2); - // hand:ComputerB:Plains:2 - addCard(Zone.HAND, playerB, "Plains", 2); - // library:ComputerB:clear:0 - removeAllCardsFromLibrary(playerB); - // library:ComputerB:Plains:10 - addCard(Zone.LIBRARY, playerB, "Plains", 10); - } - /** * @throws GameException * @throws FileNotFoundException diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/cards/abilities/ProtectionFromTypeTest.java b/Mage.Tests/src/test/java/org/mage/test/serverside/cards/abilities/ProtectionFromTypeTest.java index 82f637ab58..5ba841acf1 100644 --- a/Mage.Tests/src/test/java/org/mage/test/serverside/cards/abilities/ProtectionFromTypeTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/cards/abilities/ProtectionFromTypeTest.java @@ -2,6 +2,7 @@ package org.mage.test.serverside.cards.abilities; import mage.constants.PhaseStep; import mage.constants.Zone; +import org.junit.Before; import org.junit.Test; import org.mage.test.serverside.base.CardTestPlayerBase; @@ -10,11 +11,33 @@ import org.mage.test.serverside.base.CardTestPlayerBase; */ public class ProtectionFromTypeTest extends CardTestPlayerBase { + @Before + public void setUp() { + // *** ComputerA *** + // battlefield:ComputerA:Mountain:5 + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5); + // hand:ComputerA:Mountain:4 + addCard(Zone.HAND, playerA, "Mountain", 5); + // library:ComputerA:clear:0 + removeAllCardsFromLibrary(playerA); + // library:ComputerA:Mountain:10 + addCard(Zone.LIBRARY, playerA, "Mountain", 10); + + // *** ComputerB *** + // battlefield:ComputerB:Plains:2 + addCard(Zone.BATTLEFIELD, playerB, "Plains", 2); + // hand:ComputerB:Plains:2 + addCard(Zone.HAND, playerB, "Plains", 2); + // library:ComputerB:clear:0 + removeAllCardsFromLibrary(playerB); + // library:ComputerB:Plains:10 + addCard(Zone.LIBRARY, playerB, "Plains", 10); + // Trigon of Corruption enters the battlefield with three charge counters on it. + addCard(Zone.BATTLEFIELD, playerA, "Trigon of Corruption"); + } + @Test public void testProtectionFromArtifacts() { - useRedDefault(); - addCard(Zone.BATTLEFIELD, playerA, "Trigon of Corruption"); - addCard(Zone.BATTLEFIELD, playerB, "Tel-Jilad Fallen"); checkPlayableAbility("before", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "Remove", false); @@ -27,10 +50,6 @@ public class ProtectionFromTypeTest extends CardTestPlayerBase { @Test public void testNoProtection() { - useRedDefault(); - // Trigon of Corruption enters the battlefield with three charge counters on it. - addCard(Zone.BATTLEFIELD, playerA, "Trigon of Corruption"); - addCard(Zone.BATTLEFIELD, playerB, "Coral Merfolk"); setStrictChooseMode(true);