mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
add assertions for winning and losing the game
This commit is contained in:
parent
30fd8f00e7
commit
6eef8f9e0c
8 changed files with 44 additions and 22 deletions
|
@ -65,8 +65,8 @@ public class HiveMindTest extends CardTestPlayerBase {
|
||||||
assertGraveyardCount(playerA, "Pact of the Titan", 1);
|
assertGraveyardCount(playerA, "Pact of the Titan", 1);
|
||||||
assertPermanentCount(playerA, "Giant", 0); // was countered by Chalice
|
assertPermanentCount(playerA, "Giant", 0); // was countered by Chalice
|
||||||
assertPermanentCount(playerB, "Giant", 1); // was not countered by Chalice because it was not cast
|
assertPermanentCount(playerB, "Giant", 1); // was not countered by Chalice because it was not cast
|
||||||
Assert.assertTrue("Player A must have won", playerA.hasWon());
|
assertWonTheGame(playerA);
|
||||||
Assert.assertTrue("Player B must have lost", playerB.hasLost());
|
assertLostTheGame(playerB);
|
||||||
assertLife(playerB, 20);
|
assertLife(playerB, 20);
|
||||||
assertLife(playerA, 20);
|
assertLife(playerA, 20);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class WinLoseEffectsTest extends CardTestPlayerBase {
|
||||||
execute();
|
execute();
|
||||||
|
|
||||||
Assert.assertEquals("Player A library is empty", 0 , playerA.getLibrary().size());
|
Assert.assertEquals("Player A library is empty", 0 , playerA.getLibrary().size());
|
||||||
Assert.assertTrue("Player A has not won but should have", playerA.hasWon());
|
assertWonTheGame(playerA);
|
||||||
assertLife(playerA, 20);
|
assertLife(playerA, 20);
|
||||||
assertLife(playerB, 20);
|
assertLife(playerB, 20);
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ public class WinLoseEffectsTest extends CardTestPlayerBase {
|
||||||
assertPermanentCount(playerA, "Platinum Angel", 0);
|
assertPermanentCount(playerA, "Platinum Angel", 0);
|
||||||
assertLibraryCount(playerA, 1); // Angel returned to top of library
|
assertLibraryCount(playerA, 1); // Angel returned to top of library
|
||||||
assertLibraryCount(playerA, "Platinum Angel", 1);
|
assertLibraryCount(playerA, "Platinum Angel", 1);
|
||||||
Assert.assertFalse("Player A should not have lost yet", playerA.hasLost());
|
assertHasNotLostTheGame(playerA);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,7 +96,7 @@ public class WinLoseEffectsTest extends CardTestPlayerBase {
|
||||||
execute();
|
execute();
|
||||||
|
|
||||||
Assert.assertEquals("Player A library is empty", 0 , playerA.getLibrary().size());
|
Assert.assertEquals("Player A library is empty", 0 , playerA.getLibrary().size());
|
||||||
Assert.assertTrue("Player A has not won but should have", playerA.hasWon());
|
assertWonTheGame(playerA);
|
||||||
assertLife(playerA, 20);
|
assertLife(playerA, 20);
|
||||||
assertLife(playerB, 20);
|
assertLife(playerB, 20);
|
||||||
|
|
||||||
|
@ -148,8 +148,8 @@ public class WinLoseEffectsTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
assertLife(playerA, -5);
|
assertLife(playerA, -5);
|
||||||
assertLife(playerB, 20);
|
assertLife(playerB, 20);
|
||||||
|
|
||||||
Assert.assertTrue("Player A has not won but should have", playerA.hasWon());
|
assertWonTheGame(playerA);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,8 @@ public class VorpalSwordTest extends CardTestPlayerBase {
|
||||||
setStopAt(3, PhaseStep.POSTCOMBAT_MAIN);
|
setStopAt(3, PhaseStep.POSTCOMBAT_MAIN);
|
||||||
execute();
|
execute();
|
||||||
assertAllCommandsUsed();
|
assertAllCommandsUsed();
|
||||||
Assert.assertTrue("Player A has won.", playerA.hasWon());
|
assertWonTheGame(playerA);
|
||||||
|
assertLostTheGame(playerB);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,9 @@ public class BiovisionaryTest extends CardTestPlayerBase {
|
||||||
assertLife(playerB, 20);
|
assertLife(playerB, 20);
|
||||||
|
|
||||||
assertPermanentCount(playerA, "Biovisionary", 4);
|
assertPermanentCount(playerA, "Biovisionary", 4);
|
||||||
|
|
||||||
Assert.assertTrue("Player B loses",playerB.hasLost());
|
assertLostTheGame(playerB);
|
||||||
Assert.assertTrue("Player A wins with four Biovisionary",playerA.hasWon());
|
assertWonTheGame(playerA);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,8 +61,8 @@ public class BiovisionaryTest extends CardTestPlayerBase {
|
||||||
assertLife(playerB, 20);
|
assertLife(playerB, 20);
|
||||||
|
|
||||||
assertPermanentCount(playerA, "Biovisionary", 4);
|
assertPermanentCount(playerA, "Biovisionary", 4);
|
||||||
Assert.assertTrue("Player B loses",playerB.hasLost());
|
assertLostTheGame(playerB);
|
||||||
Assert.assertTrue("Player A wins with four Biovisionary",playerA.hasWon());
|
assertWonTheGame(playerA);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class TeferiMageOfZhalfirTest extends CardTestCommanderDuelBase {
|
||||||
assertPermanentCount(playerA, "Daxos of Meletis", 1);
|
assertPermanentCount(playerA, "Daxos of Meletis", 1);
|
||||||
assertPowerToughness(playerA, "Daxos of Meletis", 6, 6); // no effects removes after game over -- users and tests can get last game state with all affected effects
|
assertPowerToughness(playerA, "Daxos of Meletis", 6, 6); // no effects removes after game over -- users and tests can get last game state with all affected effects
|
||||||
|
|
||||||
Assert.assertEquals("Player A has won because of commander damage", true, playerA.hasWon());
|
assertWonTheGame(playerA);
|
||||||
Assert.assertEquals("Player B has lost because of commander damage", true, playerB.hasLost());
|
assertLostTheGame(playerB);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -37,8 +37,8 @@ public class GameIsADrawTest extends CardTestPlayerBase {
|
||||||
assertLife(playerA, 0);
|
assertLife(playerA, 0);
|
||||||
assertLife(playerB, 0);
|
assertLife(playerB, 0);
|
||||||
|
|
||||||
Assert.assertFalse("Player A has not won.", playerA.hasWon());
|
assertHasNotWonTheGame(playerA);
|
||||||
Assert.assertFalse("Player B has not won.", playerB.hasWon());
|
assertHasNotWonTheGame(playerB);
|
||||||
|
|
||||||
Assert.assertTrue("Game has ended.", currentGame.hasEnded());
|
Assert.assertTrue("Game has ended.", currentGame.hasEnded());
|
||||||
|
|
||||||
|
@ -65,8 +65,8 @@ public class GameIsADrawTest extends CardTestPlayerBase {
|
||||||
assertLife(playerA, 20);
|
assertLife(playerA, 20);
|
||||||
assertLife(playerB, 20);
|
assertLife(playerB, 20);
|
||||||
|
|
||||||
Assert.assertFalse("Player A has not won.", playerA.hasWon());
|
assertHasNotWonTheGame(playerA);
|
||||||
Assert.assertFalse("Player B has not won.", playerB.hasWon());
|
assertHasNotWonTheGame(playerB);
|
||||||
|
|
||||||
Assert.assertTrue("Game has ended.", currentGame.hasEnded());
|
Assert.assertTrue("Game has ended.", currentGame.hasEnded());
|
||||||
|
|
||||||
|
@ -106,8 +106,8 @@ public class GameIsADrawTest extends CardTestPlayerBase {
|
||||||
Permanent shield = getPermanent("Pariah's Shield");
|
Permanent shield = getPermanent("Pariah's Shield");
|
||||||
Assert.assertTrue("Pariah's Shield is attached", shield.getAttachedTo() != null);
|
Assert.assertTrue("Pariah's Shield is attached", shield.getAttachedTo() != null);
|
||||||
|
|
||||||
Assert.assertFalse("Player A has not won.", playerA.hasWon());
|
assertHasNotWonTheGame(playerA);
|
||||||
Assert.assertFalse("Player B has not won.", playerB.hasWon());
|
assertHasNotWonTheGame(playerB);
|
||||||
|
|
||||||
Assert.assertTrue("Game has ended.", currentGame.hasEnded());
|
Assert.assertTrue("Game has ended.", currentGame.hasEnded());
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class PhageTheUntouchableTest extends CardTestPlayerBase {
|
||||||
assertPermanentCount(playerB, "Phage the Untouchable", 1);
|
assertPermanentCount(playerB, "Phage the Untouchable", 1);
|
||||||
|
|
||||||
Assert.assertTrue("Game has ended.", currentGame.hasEnded());
|
Assert.assertTrue("Game has ended.", currentGame.hasEnded());
|
||||||
Assert.assertTrue("Player A has won.", playerA.hasWon());
|
assertWonTheGame(playerA);
|
||||||
Assert.assertTrue("Game ist At end phase", currentGame.getPhase().getType() == TurnPhase.END);
|
Assert.assertTrue("Game ist At end phase", currentGame.getPhase().getType() == TurnPhase.END);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2095,4 +2095,25 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void assertWonTheGame(Player player){
|
||||||
|
|
||||||
|
Assert.assertTrue(player.getName() + " has not won the game.", player.hasWon());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void assertHasNotWonTheGame(Player player){
|
||||||
|
|
||||||
|
Assert.assertFalse(player.getName() + " has won the game.", player.hasWon());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void assertLostTheGame(Player player){
|
||||||
|
|
||||||
|
Assert.assertTrue(player.getName() + " has not lost the game.", player.hasLost());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void assertHasNotLostTheGame(Player player){
|
||||||
|
|
||||||
|
Assert.assertFalse(player.getName() + " has lost the game.", player.hasLost());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue