Merge pull request #76 from allentiak/migrate-junit3-tests-to-testng

Migrate all remaining JUnit3 tests to TestNG
This commit is contained in:
Chris H
2022-04-21 20:26:40 -04:00
committed by GitHub
6 changed files with 688 additions and 573 deletions

View File

@@ -24,11 +24,10 @@
<version>1.2</version> <version>1.2</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>org.testng</groupId>
<artifactId>junit</artifactId> <artifactId>testng</artifactId>
<version>4.13.2</version> <version>7.4.0</version>
<scope>test</scope> <scope>test</scope>
<type>jar</type>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.sentry</groupId> <groupId>io.sentry</groupId>

View File

@@ -1,24 +1,26 @@
package forge.game.ability; package forge.game.ability;
import org.testng.annotations.Test;
import org.testng.AssertJUnit;
import java.util.Map; import java.util.Map;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import junit.framework.TestCase; public class AbilityKeyTest {
public class AbilityKeyTest extends TestCase { @Test
public void testFromStringWorksForAllKeys() { public void testFromStringWorksForAllKeys() {
for (AbilityKey key : AbilityKey.values()) { for (AbilityKey key : AbilityKey.values()) {
assertEquals(key, AbilityKey.fromString(key.toString())); AssertJUnit.assertEquals(key, AbilityKey.fromString(key.toString()));
} }
} }
@Test
public void testCopyingEmptyMapWorks() { public void testCopyingEmptyMapWorks() {
Map<AbilityKey, Object> map = Maps.newHashMap(); Map<AbilityKey, Object> map = Maps.newHashMap();
Map<AbilityKey, Object> newMap = AbilityKey.newMap(map); Map<AbilityKey, Object> newMap = AbilityKey.newMap(map);
// An actual copy should be made. // An actual copy should be made.
assertNotSame(map, newMap); AssertJUnit.assertNotSame(map, newMap);
} }
} }

View File

@@ -1,5 +1,7 @@
package forge.game.mana; package forge.game.mana;
import org.testng.annotations.Test;
import org.testng.AssertJUnit;
import static forge.card.MagicColor.COLORLESS; import static forge.card.MagicColor.COLORLESS;
import static forge.card.MagicColor.GREEN; import static forge.card.MagicColor.GREEN;
import static forge.card.MagicColor.RED; import static forge.card.MagicColor.RED;
@@ -7,27 +9,33 @@ import static forge.card.MagicColor.WHITE;
import forge.card.mana.ManaCost; import forge.card.mana.ManaCost;
import forge.card.mana.ManaCostParser; import forge.card.mana.ManaCostParser;
import junit.framework.TestCase;
public class ManaCostBeingPaidTest extends TestCase { public class ManaCostBeingPaidTest {
@Test
public void testPayManaViaConvoke() { public void testPayManaViaConvoke() {
runConvokeTest("1 W W", new byte[] { WHITE, COLORLESS, WHITE }, new String[] {"{1}{W}{W}", "{1}{W}", "{W}"}); runConvokeTest("1 W W", new byte[] { WHITE, COLORLESS, WHITE }, new String[] { "{1}{W}{W}", "{1}{W}", "{W}" });
runConvokeTest("1 W W", new byte[] { COLORLESS, WHITE, WHITE }, new String[] {"{1}{W}{W}", "{W}{W}", "{W}"}); runConvokeTest("1 W W", new byte[] { COLORLESS, WHITE, WHITE }, new String[] { "{1}{W}{W}", "{W}{W}", "{W}" });
runConvokeTest("1 W W", new byte[] { GREEN, WHITE, WHITE }, new String[] {"{1}{W}{W}", "{W}{W}", "{W}"}); runConvokeTest("1 W W", new byte[] { GREEN, WHITE, WHITE }, new String[] { "{1}{W}{W}", "{W}{W}", "{W}" });
runConvokeTest("1 W G", new byte[] { GREEN, RED, WHITE }, new String[] {"{1}{W}{G}", "{1}{W}", "{W}"}); runConvokeTest("1 W G", new byte[] { GREEN, RED, WHITE }, new String[] { "{1}{W}{G}", "{1}{W}", "{W}" });
} }
private void runConvokeTest(String initialCost, byte[] colorsToPay, String[] expectedRemainder) { private void runConvokeTest(String initialCost, byte[] colorsToPay, String[] expectedRemainder) {
ManaCostBeingPaid cost = createManaCostBeingPaid(initialCost);
ManaCostBeingPaid costBeingPaid = createManaCostBeingPaid(initialCost);
for (int i = 0; i < colorsToPay.length; i++) { for (int i = 0; i < colorsToPay.length; i++) {
assertEquals(expectedRemainder[i], cost.toString()); AssertJUnit.assertEquals(expectedRemainder[i], costBeingPaid.toString());
cost.payManaViaConvoke(colorsToPay[i]); costBeingPaid.payManaViaConvoke(colorsToPay[i]);
} }
assertEquals("0", cost.toString());
AssertJUnit.assertEquals("0", costBeingPaid.toString());
} }
private ManaCostBeingPaid createManaCostBeingPaid(String cost) { private ManaCostBeingPaid createManaCostBeingPaid(String costString) {
ManaCostParser parser = new ManaCostParser(cost); ManaCostParser parsedCostString = new ManaCostParser(costString);
return new ManaCostBeingPaid(new ManaCost(parser)); ManaCost manaCost = new ManaCost(parsedCostString);
return new ManaCostBeingPaid(manaCost);
} }
} }

View File

@@ -1,14 +1,23 @@
package forge.ai.simulation; package forge.ai.simulation;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import forge.GuiDesktop; import forge.GuiDesktop;
import forge.StaticData; import forge.StaticData;
import forge.ai.AIOption; import forge.ai.AIOption;
import forge.ai.LobbyPlayerAi; import forge.ai.LobbyPlayerAi;
import forge.ai.simulation.GameStateEvaluator.Score; import forge.ai.simulation.GameStateEvaluator.Score;
import forge.deck.Deck; import forge.deck.Deck;
import forge.game.*; import forge.game.Game;
import forge.game.GameRules;
import forge.game.GameStage;
import forge.game.GameType;
import forge.game.Match;
import forge.game.card.Card; import forge.game.card.Card;
import forge.game.card.CardCollectionView; import forge.game.card.CardCollectionView;
import forge.game.player.Player; import forge.game.player.Player;
@@ -20,20 +29,15 @@ import forge.item.IPaperCard;
import forge.localinstance.properties.ForgePreferences; import forge.localinstance.properties.ForgePreferences;
import forge.localinstance.properties.ForgePreferences.FPref; import forge.localinstance.properties.ForgePreferences.FPref;
import forge.model.FModel; import forge.model.FModel;
import junit.framework.TestCase;
import java.util.HashSet; public class SimulationTest {
import java.util.List;
import java.util.Set;
public class SimulationTestCase extends TestCase {
private static boolean initialized = false; private static boolean initialized = false;
protected Game initAndCreateGame() { protected Game initAndCreateGame() {
if (!initialized) { if (!initialized) {
GuiBase.setInterface(new GuiDesktop()); GuiBase.setInterface(new GuiDesktop());
FModel.initialize(null, new Function<ForgePreferences, Void>() { FModel.initialize(null, new Function<ForgePreferences, Void>() {
@Override @Override
public Void apply(ForgePreferences preferences) { public Void apply(ForgePreferences preferences) {
preferences.setPref(FPref.LOAD_CARD_SCRIPTS_LAZILY, false); preferences.setPref(FPref.LOAD_CARD_SCRIPTS_LAZILY, false);

View File

@@ -2,6 +2,9 @@ package forge.ai.simulation;
import java.util.List; import java.util.List;
import org.testng.AssertJUnit;
import org.testng.annotations.Test;
import forge.game.Game; import forge.game.Game;
import forge.game.card.Card; import forge.game.card.Card;
import forge.game.card.CounterEnumType; import forge.game.card.CounterEnumType;
@@ -11,7 +14,8 @@ import forge.game.player.Player;
import forge.game.spellability.SpellAbility; import forge.game.spellability.SpellAbility;
import forge.game.zone.ZoneType; import forge.game.zone.ZoneType;
public class SpellAbilityPickerTest extends SimulationTestCase { public class SpellAbilityPickerSimulationTest extends SimulationTest {
@Test
public void testPickingLethalDamage() { public void testPickingLethalDamage() {
Game game = initAndCreateGame(); Game game = initAndCreateGame();
Player p = game.getPlayers().get(1); Player p = game.getPlayers().get(1);
@@ -31,11 +35,12 @@ public class SpellAbilityPickerTest extends SimulationTestCase {
SpellAbilityPicker picker = new SpellAbilityPicker(game, p); SpellAbilityPicker picker = new SpellAbilityPicker(game, p);
SpellAbility sa = picker.chooseSpellAbilityToPlay(null); SpellAbility sa = picker.chooseSpellAbilityToPlay(null);
assertNotNull(sa); AssertJUnit.assertNotNull(sa);
assertNull(sa.getTargetCard()); AssertJUnit.assertNull(sa.getTargetCard());
assertEquals(opponent, sa.getTargets().getFirstTargetedPlayer()); AssertJUnit.assertEquals(opponent, sa.getTargets().getFirstTargetedPlayer());
} }
@Test
public void testPickingKillingCreature() { public void testPickingKillingCreature() {
Game game = initAndCreateGame(); Game game = initAndCreateGame();
Player p = game.getPlayers().get(1); Player p = game.getPlayers().get(1);
@@ -52,11 +57,12 @@ public class SpellAbilityPickerTest extends SimulationTestCase {
SpellAbilityPicker picker = new SpellAbilityPicker(game, p); SpellAbilityPicker picker = new SpellAbilityPicker(game, p);
SpellAbility sa = picker.chooseSpellAbilityToPlay(null); SpellAbility sa = picker.chooseSpellAbilityToPlay(null);
assertNotNull(sa); AssertJUnit.assertNotNull(sa);
assertEquals(bearCard, sa.getTargetCard()); AssertJUnit.assertEquals(bearCard, sa.getTargetCard());
assertNull(sa.getTargets().getFirstTargetedPlayer()); AssertJUnit.assertNull(sa.getTargets().getFirstTargetedPlayer());
} }
@Test
public void testSequenceStartingWithPlayingLand() { public void testSequenceStartingWithPlayingLand() {
Game game = initAndCreateGame(); Game game = initAndCreateGame();
Player p = game.getPlayers().get(1); Player p = game.getPlayers().get(1);
@@ -73,16 +79,17 @@ public class SpellAbilityPickerTest extends SimulationTestCase {
SpellAbilityPicker picker = new SpellAbilityPicker(game, p); SpellAbilityPicker picker = new SpellAbilityPicker(game, p);
SpellAbility sa = picker.chooseSpellAbilityToPlay(null); SpellAbility sa = picker.chooseSpellAbilityToPlay(null);
//assertEquals(game.PLAY_LAND_SURROGATE, sa); // assertEquals(game.PLAY_LAND_SURROGATE, sa);
assertEquals(mountain, sa.getHostCard()); AssertJUnit.assertEquals(mountain, sa.getHostCard());
Plan plan = picker.getPlan(); Plan plan = picker.getPlan();
assertEquals(2, plan.getDecisions().size()); AssertJUnit.assertEquals(2, plan.getDecisions().size());
assertEquals("Play land Mountain", plan.getDecisions().get(0).saRef.toString()); AssertJUnit.assertEquals("Play land Mountain", plan.getDecisions().get(0).saRef.toString());
assertEquals("Shock deals 2 damage to any target.", plan.getDecisions().get(1).saRef.toString()); AssertJUnit.assertEquals("Shock deals 2 damage to any target.", plan.getDecisions().get(1).saRef.toString());
assertTrue(plan.getDecisions().get(1).targets.toString().contains("Runeclaw Bear")); AssertJUnit.assertTrue(plan.getDecisions().get(1).targets.toString().contains("Runeclaw Bear"));
} }
@Test
public void testModeSelection() { public void testModeSelection() {
Game game = initAndCreateGame(); Game game = initAndCreateGame();
Player p = game.getPlayers().get(1); Player p = game.getPlayers().get(1);
@@ -101,10 +108,12 @@ public class SpellAbilityPickerTest extends SimulationTestCase {
// Expected: All creatures get -2/-2 to kill the bear. // Expected: All creatures get -2/-2 to kill the bear.
SpellAbilityPicker picker = new SpellAbilityPicker(game, p); SpellAbilityPicker picker = new SpellAbilityPicker(game, p);
SpellAbility sa = picker.chooseSpellAbilityToPlay(null); SpellAbility sa = picker.chooseSpellAbilityToPlay(null);
assertEquals(spell.getSpellAbilities().get(0), sa); AssertJUnit.assertEquals(spell.getSpellAbilities().get(0), sa);
assertEquals("Dromar's Charm -> Target creature gets -2/-2 until end of turn.", picker.getPlan().getDecisions().get(0).modesStr); AssertJUnit.assertEquals("Dromar's Charm -> Target creature gets -2/-2 until end of turn.",
picker.getPlan().getDecisions().get(0).modesStr);
} }
@Test
public void testModeSelection2() { public void testModeSelection2() {
Game game = initAndCreateGame(); Game game = initAndCreateGame();
Player p = game.getPlayers().get(1); Player p = game.getPlayers().get(1);
@@ -120,10 +129,11 @@ public class SpellAbilityPickerTest extends SimulationTestCase {
// Expected: Gain 5 life, since other modes aren't helpful. // Expected: Gain 5 life, since other modes aren't helpful.
SpellAbilityPicker picker = new SpellAbilityPicker(game, p); SpellAbilityPicker picker = new SpellAbilityPicker(game, p);
SpellAbility sa = picker.chooseSpellAbilityToPlay(null); SpellAbility sa = picker.chooseSpellAbilityToPlay(null);
assertEquals(spell.getSpellAbilities().get(0), sa); AssertJUnit.assertEquals(spell.getSpellAbilities().get(0), sa);
assertEquals("Dromar's Charm -> You gain 5 life.", picker.getPlan().getDecisions().get(0).modesStr); AssertJUnit.assertEquals("Dromar's Charm -> You gain 5 life.", picker.getPlan().getDecisions().get(0).modesStr);
} }
@Test
public void testMultipleModes() { public void testMultipleModes() {
Game game = initAndCreateGame(); Game game = initAndCreateGame();
Player p = game.getPlayers().get(1); Player p = game.getPlayers().get(1);
@@ -144,14 +154,15 @@ public class SpellAbilityPickerTest extends SimulationTestCase {
// Expected: 2x 1 damage to each creature, 1x 2 damage to each opponent. // Expected: 2x 1 damage to each creature, 1x 2 damage to each opponent.
SpellAbilityPicker picker = new SpellAbilityPicker(game, p); SpellAbilityPicker picker = new SpellAbilityPicker(game, p);
SpellAbility sa = picker.chooseSpellAbilityToPlay(null); SpellAbility sa = picker.chooseSpellAbilityToPlay(null);
assertEquals(spell.getSpellAbilities().get(0), sa); AssertJUnit.assertEquals(spell.getSpellAbilities().get(0), sa);
String dmgCreaturesStr = "Fiery Confluence deals 1 damage to each creature."; String dmgCreaturesStr = "Fiery Confluence deals 1 damage to each creature.";
String dmgOppStr = "Fiery Confluence deals 2 damage to each opponent."; String dmgOppStr = "Fiery Confluence deals 2 damage to each opponent.";
String expected = "Fiery Confluence -> " + dmgCreaturesStr + " " + dmgCreaturesStr + " " + dmgOppStr; String expected = "Fiery Confluence -> " + dmgCreaturesStr + " " + dmgCreaturesStr + " " + dmgOppStr;
assertEquals(expected, picker.getPlan().getDecisions().get(0).modesStr); AssertJUnit.assertEquals(expected, picker.getPlan().getDecisions().get(0).modesStr);
} }
@Test
public void testMultipleModes2() { public void testMultipleModes2() {
Game game = initAndCreateGame(); Game game = initAndCreateGame();
Player p = game.getPlayers().get(1); Player p = game.getPlayers().get(1);
@@ -172,13 +183,14 @@ public class SpellAbilityPickerTest extends SimulationTestCase {
// Expected: 3x 2 damage to each opponent. // Expected: 3x 2 damage to each opponent.
SpellAbilityPicker picker = new SpellAbilityPicker(game, p); SpellAbilityPicker picker = new SpellAbilityPicker(game, p);
SpellAbility sa = picker.chooseSpellAbilityToPlay(null); SpellAbility sa = picker.chooseSpellAbilityToPlay(null);
assertEquals(spell.getSpellAbilities().get(0), sa); AssertJUnit.assertEquals(spell.getSpellAbilities().get(0), sa);
String dmgOppStr = "Fiery Confluence deals 2 damage to each opponent."; String dmgOppStr = "Fiery Confluence deals 2 damage to each opponent.";
String expected = "Fiery Confluence -> " + dmgOppStr + " " + dmgOppStr + " " + dmgOppStr; String expected = "Fiery Confluence -> " + dmgOppStr + " " + dmgOppStr + " " + dmgOppStr;
assertEquals(expected, picker.getPlan().getDecisions().get(0).modesStr); AssertJUnit.assertEquals(expected, picker.getPlan().getDecisions().get(0).modesStr);
} }
@Test
public void testMultipleTargets() { public void testMultipleTargets() {
Game game = initAndCreateGame(); Game game = initAndCreateGame();
Player p = game.getPlayers().get(1); Player p = game.getPlayers().get(1);
@@ -197,14 +209,15 @@ public class SpellAbilityPickerTest extends SimulationTestCase {
SpellAbilityPicker picker = new SpellAbilityPicker(game, p); SpellAbilityPicker picker = new SpellAbilityPicker(game, p);
SpellAbility sa = picker.chooseSpellAbilityToPlay(null); SpellAbility sa = picker.chooseSpellAbilityToPlay(null);
assertEquals(spell.getSpellAbilities().get(0), sa); AssertJUnit.assertEquals(spell.getSpellAbilities().get(0), sa);
assertEquals(bear, sa.getTargetCard()); AssertJUnit.assertEquals(bear, sa.getTargetCard());
assertEquals("2", sa.getParam("NumDmg")); AssertJUnit.assertEquals("2", sa.getParam("NumDmg"));
SpellAbility subSa = sa.getSubAbility(); SpellAbility subSa = sa.getSubAbility();
assertEquals(men, subSa.getTargetCard()); AssertJUnit.assertEquals(men, subSa.getTargetCard());
assertEquals("1", subSa.getParam("NumDmg")); AssertJUnit.assertEquals("1", subSa.getParam("NumDmg"));
} }
@Test
public void testLandSearchForCombo() { public void testLandSearchForCombo() {
Game game = initAndCreateGame(); Game game = initAndCreateGame();
Player p = game.getPlayers().get(1); Player p = game.getPlayers().get(1);
@@ -224,22 +237,23 @@ public class SpellAbilityPickerTest extends SimulationTestCase {
game.getPhaseHandler().devModeSet(PhaseType.MAIN2, p); game.getPhaseHandler().devModeSet(PhaseType.MAIN2, p);
game.getAction().checkStateEffects(true); game.getAction().checkStateEffects(true);
assertEquals(10, darkDepths.getCounters(CounterEnumType.ICE)); AssertJUnit.assertEquals(10, darkDepths.getCounters(CounterEnumType.ICE));
SpellAbilityPicker picker = new SpellAbilityPicker(game, p); SpellAbilityPicker picker = new SpellAbilityPicker(game, p);
SpellAbility sa = picker.chooseSpellAbilityToPlay(null); SpellAbility sa = picker.chooseSpellAbilityToPlay(null);
assertEquals(cropRotation.getSpellAbilities().get(0), sa); AssertJUnit.assertEquals(cropRotation.getSpellAbilities().get(0), sa);
// Expected: Sac a Forest to get an Urborg. // Expected: Sac a Forest to get an Urborg.
List<String> choices = picker.getPlan().getDecisions().get(0).choices; List<String> choices = picker.getPlan().getDecisions().get(0).choices;
assertEquals(2, choices.size()); AssertJUnit.assertEquals(2, choices.size());
assertEquals("Forest", choices.get(0)); AssertJUnit.assertEquals("Forest", choices.get(0));
assertEquals("Urborg, Tomb of Yawgmoth", choices.get(1)); AssertJUnit.assertEquals("Urborg, Tomb of Yawgmoth", choices.get(1));
// Next, expected to use Thespian's Stage to copy Dark Depths. // Next, expected to use Thespian's Stage to copy Dark Depths.
Plan.Decision d2 = picker.getPlan().getDecisions().get(1); Plan.Decision d2 = picker.getPlan().getDecisions().get(1);
String expected = "{2}, {T}: Thespian's Stage becomes a copy of target land, except it has this ability."; String expected = "{2}, {T}: Thespian's Stage becomes a copy of target land, except it has this ability.";
assertEquals(expected, d2.saRef.toString()); AssertJUnit.assertEquals(expected, d2.saRef.toString());
assertTrue(d2.targets.toString().contains("Dark Depths")); AssertJUnit.assertTrue(d2.targets.toString().contains("Dark Depths"));
} }
@Test
public void testPlayRememberedCardsLand() { public void testPlayRememberedCardsLand() {
Game game = initAndCreateGame(); Game game = initAndCreateGame();
Player p = game.getPlayers().get(1); Player p = game.getPlayers().get(1);
@@ -257,18 +271,20 @@ public class SpellAbilityPickerTest extends SimulationTestCase {
game.getAction().checkStateEffects(true); game.getAction().checkStateEffects(true);
// Expected plan: // Expected plan:
// 1. Play Abbot. // 1. Play Abbot.
// 2. Play land exiled by Abbot. // 2. Play land exiled by Abbot.
// 3. Play Bolt targeting opponent. // 3. Play Bolt targeting opponent.
SpellAbilityPicker picker = new SpellAbilityPicker(game, p); SpellAbilityPicker picker = new SpellAbilityPicker(game, p);
SpellAbility sa = picker.chooseSpellAbilityToPlay(null); SpellAbility sa = picker.chooseSpellAbilityToPlay(null);
assertEquals(abbot.getSpellAbilities().get(0), sa); AssertJUnit.assertEquals(abbot.getSpellAbilities().get(0), sa);
Plan plan = picker.getPlan(); Plan plan = picker.getPlan();
assertEquals(3, plan.getDecisions().size()); AssertJUnit.assertEquals(3, plan.getDecisions().size());
assertEquals("Play land Mountain", plan.getDecisions().get(1).saRef.toString()); AssertJUnit.assertEquals("Play land Mountain", plan.getDecisions().get(1).saRef.toString());
assertEquals("Lightning Bolt deals 3 damage to any target.", plan.getDecisions().get(2).saRef.toString()); AssertJUnit.assertEquals("Lightning Bolt deals 3 damage to any target.",
plan.getDecisions().get(2).saRef.toString());
} }
@Test
public void testPlayRememberedCardsSpell() { public void testPlayRememberedCardsSpell() {
Game game = initAndCreateGame(); Game game = initAndCreateGame();
Player p = game.getPlayers().get(1); Player p = game.getPlayers().get(1);
@@ -286,17 +302,18 @@ public class SpellAbilityPickerTest extends SimulationTestCase {
game.getAction().checkStateEffects(true); game.getAction().checkStateEffects(true);
// Expected plan: // Expected plan:
// 1. Play Abbot. // 1. Play Abbot.
// 3. Play Bolt exiled by Abbot. // 3. Play Bolt exiled by Abbot.
SpellAbilityPicker picker = new SpellAbilityPicker(game, p); SpellAbilityPicker picker = new SpellAbilityPicker(game, p);
SpellAbility sa = picker.chooseSpellAbilityToPlay(null); SpellAbility sa = picker.chooseSpellAbilityToPlay(null);
assertEquals(abbot.getSpellAbilities().get(0), sa); AssertJUnit.assertEquals(abbot.getSpellAbilities().get(0), sa);
Plan plan = picker.getPlan(); Plan plan = picker.getPlan();
assertEquals(2, plan.getDecisions().size()); AssertJUnit.assertEquals(2, plan.getDecisions().size());
String saDesc = plan.getDecisions().get(1).saRef.toString(); String saDesc = plan.getDecisions().get(1).saRef.toString();
assertTrue(saDesc, saDesc.startsWith("Lightning Bolt deals 3 damage to any target.")); AssertJUnit.assertTrue(saDesc, saDesc.startsWith("Lightning Bolt deals 3 damage to any target."));
} }
@Test
public void testPlayingPumpSpellsAfterBlocks() { public void testPlayingPumpSpellsAfterBlocks() {
Game game = initAndCreateGame(); Game game = initAndCreateGame();
Player p = game.getPlayers().get(1); Player p = game.getPlayers().get(1);
@@ -315,11 +332,11 @@ public class SpellAbilityPickerTest extends SimulationTestCase {
game.getAction().checkStateEffects(true); game.getAction().checkStateEffects(true);
SpellAbilityPicker picker = new SpellAbilityPicker(game, p); SpellAbilityPicker picker = new SpellAbilityPicker(game, p);
assertNull(picker.chooseSpellAbilityToPlay(null)); AssertJUnit.assertNull(picker.chooseSpellAbilityToPlay(null));
game.getPhaseHandler().devAdvanceToPhase(PhaseType.COMBAT_BEGIN); game.getPhaseHandler().devAdvanceToPhase(PhaseType.COMBAT_BEGIN);
game.getAction().checkStateEffects(true); game.getAction().checkStateEffects(true);
assertNull(picker.chooseSpellAbilityToPlay(null)); AssertJUnit.assertNull(picker.chooseSpellAbilityToPlay(null));
game.getPhaseHandler().devModeSet(PhaseType.COMBAT_DECLARE_ATTACKERS, p); game.getPhaseHandler().devModeSet(PhaseType.COMBAT_DECLARE_ATTACKERS, p);
Combat combat = new Combat(p); Combat combat = new Combat(p);
@@ -327,7 +344,7 @@ public class SpellAbilityPickerTest extends SimulationTestCase {
combat.addAttacker(attacker2, opponent); combat.addAttacker(attacker2, opponent);
game.getPhaseHandler().setCombat(combat); game.getPhaseHandler().setCombat(combat);
game.getAction().checkStateEffects(true); game.getAction().checkStateEffects(true);
assertNull(picker.chooseSpellAbilityToPlay(null)); AssertJUnit.assertNull(picker.chooseSpellAbilityToPlay(null));
game.getPhaseHandler().devModeSet(PhaseType.COMBAT_DECLARE_BLOCKERS, p, false); game.getPhaseHandler().devModeSet(PhaseType.COMBAT_DECLARE_BLOCKERS, p, false);
game.getAction().checkStateEffects(true); game.getAction().checkStateEffects(true);
@@ -337,11 +354,12 @@ public class SpellAbilityPickerTest extends SimulationTestCase {
combat.orderBlockersForDamageAssignment(); combat.orderBlockersForDamageAssignment();
combat.orderAttackersForDamageAssignment(); combat.orderAttackersForDamageAssignment();
SpellAbility sa = picker.chooseSpellAbilityToPlay(null); SpellAbility sa = picker.chooseSpellAbilityToPlay(null);
assertNotNull(sa); AssertJUnit.assertNotNull(sa);
assertEquals("Target creature gets +3/+3 until end of turn.", sa.toString()); AssertJUnit.assertEquals("Target creature gets +3/+3 until end of turn.", sa.toString());
assertEquals(attacker2, sa.getTargetCard()); AssertJUnit.assertEquals(attacker2, sa.getTargetCard());
} }
@Test
public void testPlayingSorceryPumpSpellsBeforeBlocks() { public void testPlayingSorceryPumpSpellsBeforeBlocks() {
Game game = initAndCreateGame(); Game game = initAndCreateGame();
Player p = game.getPlayers().get(1); Player p = game.getPlayers().get(1);
@@ -361,11 +379,12 @@ public class SpellAbilityPickerTest extends SimulationTestCase {
SpellAbilityPicker picker = new SpellAbilityPicker(game, p); SpellAbilityPicker picker = new SpellAbilityPicker(game, p);
SpellAbility sa = picker.chooseSpellAbilityToPlay(null); SpellAbility sa = picker.chooseSpellAbilityToPlay(null);
assertNotNull(sa); AssertJUnit.assertNotNull(sa);
assertEquals(furor.getSpellAbilities().get(0), sa); AssertJUnit.assertEquals(furor.getSpellAbilities().get(0), sa);
assertEquals(attacker1, sa.getTargetCard()); AssertJUnit.assertEquals(attacker1, sa.getTargetCard());
} }
@Test
public void testPlayingRemovalBeforeBlocks() { public void testPlayingRemovalBeforeBlocks() {
Game game = initAndCreateGame(); Game game = initAndCreateGame();
Player p = game.getPlayers().get(1); Player p = game.getPlayers().get(1);
@@ -384,8 +403,8 @@ public class SpellAbilityPickerTest extends SimulationTestCase {
SpellAbilityPicker picker = new SpellAbilityPicker(game, p); SpellAbilityPicker picker = new SpellAbilityPicker(game, p);
SpellAbility sa = picker.chooseSpellAbilityToPlay(null); SpellAbility sa = picker.chooseSpellAbilityToPlay(null);
assertNotNull(sa); AssertJUnit.assertNotNull(sa);
assertEquals("Destroy target nonblack creature.", sa.toString()); AssertJUnit.assertEquals("Destroy target nonblack creature.", sa.toString());
assertEquals(blocker, sa.getTargetCard()); AssertJUnit.assertEquals(blocker, sa.getTargetCard());
} }
} }