From 056c0613a2e4b4e376f24259592f862b4c9a2a11 Mon Sep 17 00:00:00 2001 From: igoudt Date: Fri, 12 May 2017 09:41:19 +0200 Subject: [PATCH] UT for Final Punishment to cover the DamagedReceivedThisTurnWatcher --- .../cards/single/FinalPunishmentTest.java | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/single/FinalPunishmentTest.java diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/FinalPunishmentTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/FinalPunishmentTest.java new file mode 100644 index 0000000000..87a6a2094d --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/FinalPunishmentTest.java @@ -0,0 +1,60 @@ +package org.mage.test.cards.single; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +public class FinalPunishmentTest extends CardTestPlayerBase { + + final String finalPunishment = "Final Punishment"; + final String shock = "Shock"; + final String bob = "Dark Confidant"; + + @Test + public void lifelossBecauseOfDirectDamage() { + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5); + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5); + addCard(Zone.HAND, playerA, finalPunishment); + addCard(Zone.HAND, playerA, shock); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, shock, playerB); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, finalPunishment, playerB); + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertLife(playerB, 16); + + + } + + @Test + public void lifelossBecauseOfCombat() { + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5); + addCard(Zone.HAND, playerA, finalPunishment); + addCard(Zone.BATTLEFIELD, playerA, bob); + + attack(1, playerA, bob, playerB); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, finalPunishment, playerB); + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertLife(playerB, 16); + + } + + @Test + public void nolifelossInNextTurn() { + addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5); + addCard(Zone.HAND, playerA, finalPunishment); + addCard(Zone.BATTLEFIELD, playerA, bob); + + attack(1, playerA, bob, playerB); + castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, finalPunishment, playerB); + setStopAt(2, PhaseStep.END_TURN); + execute(); + + assertLife(playerB, 18); + + } +}