mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +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);
|
||||
assertPermanentCount(playerA, "Giant", 0); // was countered by Chalice
|
||||
assertPermanentCount(playerB, "Giant", 1); // was not countered by Chalice because it was not cast
|
||||
Assert.assertTrue("Player A must have won", playerA.hasWon());
|
||||
Assert.assertTrue("Player B must have lost", playerB.hasLost());
|
||||
assertWonTheGame(playerA);
|
||||
assertLostTheGame(playerB);
|
||||
assertLife(playerB, 20);
|
||||
assertLife(playerA, 20);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class WinLoseEffectsTest extends CardTestPlayerBase {
|
|||
execute();
|
||||
|
||||
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(playerB, 20);
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class WinLoseEffectsTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerA, "Platinum Angel", 0);
|
||||
assertLibraryCount(playerA, 1); // Angel returned to top of library
|
||||
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();
|
||||
|
||||
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(playerB, 20);
|
||||
|
||||
|
@ -149,7 +149,7 @@ public class WinLoseEffectsTest extends CardTestPlayerBase {
|
|||
assertLife(playerA, -5);
|
||||
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);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
Assert.assertTrue("Player A has won.", playerA.hasWon());
|
||||
assertWonTheGame(playerA);
|
||||
assertLostTheGame(playerB);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,8 +32,8 @@ public class BiovisionaryTest extends CardTestPlayerBase {
|
|||
|
||||
assertPermanentCount(playerA, "Biovisionary", 4);
|
||||
|
||||
Assert.assertTrue("Player B loses",playerB.hasLost());
|
||||
Assert.assertTrue("Player A wins with four Biovisionary",playerA.hasWon());
|
||||
assertLostTheGame(playerB);
|
||||
assertWonTheGame(playerA);
|
||||
|
||||
}
|
||||
|
||||
|
@ -61,8 +61,8 @@ public class BiovisionaryTest extends CardTestPlayerBase {
|
|||
assertLife(playerB, 20);
|
||||
|
||||
assertPermanentCount(playerA, "Biovisionary", 4);
|
||||
Assert.assertTrue("Player B loses",playerB.hasLost());
|
||||
Assert.assertTrue("Player A wins with four Biovisionary",playerA.hasWon());
|
||||
assertLostTheGame(playerB);
|
||||
assertWonTheGame(playerA);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class TeferiMageOfZhalfirTest extends CardTestCommanderDuelBase {
|
|||
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
|
||||
|
||||
Assert.assertEquals("Player A has won because of commander damage", true, playerA.hasWon());
|
||||
Assert.assertEquals("Player B has lost because of commander damage", true, playerB.hasLost());
|
||||
assertWonTheGame(playerA);
|
||||
assertLostTheGame(playerB);
|
||||
}
|
||||
}
|
|
@ -37,8 +37,8 @@ public class GameIsADrawTest extends CardTestPlayerBase {
|
|||
assertLife(playerA, 0);
|
||||
assertLife(playerB, 0);
|
||||
|
||||
Assert.assertFalse("Player A has not won.", playerA.hasWon());
|
||||
Assert.assertFalse("Player B has not won.", playerB.hasWon());
|
||||
assertHasNotWonTheGame(playerA);
|
||||
assertHasNotWonTheGame(playerB);
|
||||
|
||||
Assert.assertTrue("Game has ended.", currentGame.hasEnded());
|
||||
|
||||
|
@ -65,8 +65,8 @@ public class GameIsADrawTest extends CardTestPlayerBase {
|
|||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
Assert.assertFalse("Player A has not won.", playerA.hasWon());
|
||||
Assert.assertFalse("Player B has not won.", playerB.hasWon());
|
||||
assertHasNotWonTheGame(playerA);
|
||||
assertHasNotWonTheGame(playerB);
|
||||
|
||||
Assert.assertTrue("Game has ended.", currentGame.hasEnded());
|
||||
|
||||
|
@ -106,8 +106,8 @@ public class GameIsADrawTest extends CardTestPlayerBase {
|
|||
Permanent shield = getPermanent("Pariah's Shield");
|
||||
Assert.assertTrue("Pariah's Shield is attached", shield.getAttachedTo() != null);
|
||||
|
||||
Assert.assertFalse("Player A has not won.", playerA.hasWon());
|
||||
Assert.assertFalse("Player B has not won.", playerB.hasWon());
|
||||
assertHasNotWonTheGame(playerA);
|
||||
assertHasNotWonTheGame(playerB);
|
||||
|
||||
Assert.assertTrue("Game has ended.", currentGame.hasEnded());
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public class PhageTheUntouchableTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerB, "Phage the Untouchable", 1);
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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