add test coverage

This commit is contained in:
jmlundeen 2025-08-28 22:37:42 -05:00
parent 7129c02d86
commit 3fa021a295
4 changed files with 238 additions and 0 deletions

View file

@ -0,0 +1,58 @@
package org.mage.test.cards.single.acr;
import mage.constants.CardType;
import mage.constants.PhaseStep;
import mage.constants.SubType;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class AdrestiaTest extends CardTestPlayerBase {
/*
Adrestia
{3}
Legendary Artifact Vehicle
Islandwalk (This creature cant be blocked as long as defending player controls an Island.)
Whenever Adrestia attacks, if an Assassin crewed it this turn, draw a card. Adrestia becomes an Assassin in addition to its other types until end of turn.
Crew 1
*/
private static final String adrestia = "Adrestia";
/*
Nekrataal
{2}{B}{B}
Creature Human Assassin
First strike
When this creature enters, destroy target nonartifact, nonblack creature. That creature cant be regenerated.
2/1
*/
private static final String nekrataal = "Nekrataal";
@Test
public void testAdrestia() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, adrestia);
addCard(Zone.BATTLEFIELD, playerA, nekrataal);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Crew");
setChoice(playerA, nekrataal);
attack(1, playerA, adrestia);
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertSubtype(adrestia, SubType.VEHICLE);
assertType(adrestia, CardType.CREATURE, true);
assertType(adrestia, CardType.ARTIFACT, true);
assertSubtype(adrestia, SubType.ASSASSIN);
assertHandCount(playerA, 1);
}
}

View file

@ -0,0 +1,45 @@
package org.mage.test.cards.single.big;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class EsotericDuplicatorTest extends CardTestPlayerBase {
/*
Esoteric Duplicator
{2}{U}
Artifact Clue
Whenever you sacrifice this artifact or another artifact, you may pay {2}. If you do, at the beginning of the next end step, create a token thats a copy of that artifact.
{2}, Sacrifice this artifact: Draw a card.
*/
private static final String esotericDuplicator = "Esoteric Duplicator";
@Test
@Ignore("Sculpting steel doesn't retain copy on entering battlefield")
public void testEsotericDuplicator() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerB, esotericDuplicator);
addCard(Zone.HAND, playerA, "Sculpting Steel");
addCard(Zone.BATTLEFIELD, playerA, "Island", 7);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Sculpting Steel");
setChoice(playerA, true);
setChoice(playerA, esotericDuplicator);
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}, Sacrifice"); // Sacrifice duplicator
setChoice(playerA, true); // duplicate
setStopAt(2, PhaseStep.UPKEEP);
execute();
assertPermanentCount(playerA, esotericDuplicator, 1);
}
}

View file

@ -0,0 +1,80 @@
package org.mage.test.cards.single.kld;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.target.common.TargetPermanentOrPlayer;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class AnimationModuleTest extends CardTestPlayerBase {
/*
Animation Module
{1}
Artifact
Whenever one or more +1/+1 counters are put on a permanent you control, you may pay {1}. If you do, create a 1/1 colorless Servo artifact creature token.
{3}, {T}: Choose a counter on target permanent or player. Give that permanent or player another counter of that kind.
*/
private static final String animationModule = "Animation Module";
@Test
public void testGivePermanentCounter() {
setStrictChooseMode(true);
Ability ability = new SimpleActivatedAbility(
new AddCountersTargetEffect(CounterType.P1P1.createInstance()),
new ManaCostsImpl<>("")
);
ability.addTarget(new TargetPermanentOrPlayer(1));
addCustomCardWithAbility("add counter", playerA, ability);
addCard(Zone.BATTLEFIELD, playerA, animationModule);
addCard(Zone.BATTLEFIELD, playerA, "Island", 10);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "put", animationModule);
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
setChoice(playerA, true); //pay to create servo
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{3}, {T}: Choose a counter", animationModule);
setChoice(playerA, true); //pay to create servo
setStopAt(1, PhaseStep.END_TURN);
execute();
assertCounterCount(playerA, animationModule, CounterType.P1P1, 2);
assertPermanentCount(playerA, "Servo Token", 2);
}
@Test
public void testGivePlayerCounter() {
setStrictChooseMode(true);
Ability ability = new SimpleActivatedAbility(
new AddCountersTargetEffect(CounterType.ENERGY.createInstance()),
new ManaCostsImpl<>("")
);
ability.addTarget(new TargetPermanentOrPlayer(1));
addCustomCardWithAbility("add counter", playerA, ability);
addCard(Zone.BATTLEFIELD, playerA, animationModule);
addCard(Zone.BATTLEFIELD, playerA, "Island", 10);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "put", playerA);
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{3}, {T}: Choose a counter", playerA);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertCounterCount(playerA, CounterType.ENERGY, 2);
}
}

View file

@ -0,0 +1,55 @@
package org.mage.test.cards.single.leg;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class AlAbarasCarpetTest extends CardTestPlayerBase {
/*
Al-abara's Carpet
{5}
Artifact
{5}, {T}: Prevent all damage that would be dealt to you this turn by attacking creatures without flying.
*/
private static final String alabarasCarpet = "Al-abara's Carpet";
/*
Storm Crow
{1}{U}
Creature Bird
Flying (This creature cant be blocked except by creatures with flying or reach.)
1/2
*/
private static final String stormCrow = "Storm Crow";
/*
Balduvian Bears
{1}{G}
Creature Bear
2/2
*/
private static final String balduvianBears = "Balduvian Bears";
@Test
public void testCarpet() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, alabarasCarpet);
addCard(Zone.BATTLEFIELD, playerA, "Island", 5);
addCard(Zone.BATTLEFIELD, playerB, balduvianBears);
addCard(Zone.BATTLEFIELD, playerB, stormCrow);
attack(2, playerB, balduvianBears);
attack(2, playerB, stormCrow);
activateAbility(2, PhaseStep.DECLARE_ATTACKERS, playerA, "{5}, {T}");
setStopAt(2, PhaseStep.END_TURN);
execute();
assertLife(playerA, 20 - 1);
}
}