mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 04:42:07 -08:00
Asserting action count in tests. minor changes.
This commit is contained in:
parent
ef92e006d0
commit
de6d1bf46b
7 changed files with 33 additions and 8 deletions
|
|
@ -91,5 +91,4 @@ public class PersistTest extends CardTestPlayerBase {
|
|||
}
|
||||
|
||||
// some tests were moved to LastKnownInformationTest
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ public class LastKnownInformationTest extends CardTestPlayerBase {
|
|||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertActionCount(playerB, 0);
|
||||
assertPermanentCount(playerA, "Safehold Elite", 1);
|
||||
assertPowerToughness(playerA, "Safehold Elite", 1, 1);
|
||||
// because enchanted Safehold Elite's P/T was 2/2, Murder Investigation has to put 2 Soldier onto the battlefield
|
||||
|
|
|
|||
|
|
@ -85,6 +85,11 @@ public class TestPlayer extends ComputerPlayer {
|
|||
actions.add(new PlayerAction(turnNum, step, action));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActionCount() {
|
||||
return actions.size();
|
||||
}
|
||||
|
||||
public void addChoice(String choice) {
|
||||
choices.add(choice);
|
||||
}
|
||||
|
|
@ -366,7 +371,7 @@ public class TestPlayer extends ComputerPlayer {
|
|||
if (groups.length > 2 && groups[2].startsWith("spellOnStack=")) {
|
||||
String spellOnStack = groups[2].substring(13);
|
||||
for (StackObject stackObject: game.getStack()) {
|
||||
if (stackObject.getStackAbility().toString().indexOf(spellOnStack) >= 0) {
|
||||
if (stackObject.getStackAbility().toString().contains(spellOnStack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -374,7 +379,7 @@ public class TestPlayer extends ComputerPlayer {
|
|||
} else if (groups.length > 2 && groups[2].startsWith("!spellOnStack=")) {
|
||||
String spellNotOnStack = groups[2].substring(14);
|
||||
for (StackObject stackObject: game.getStack()) {
|
||||
if (stackObject.getStackAbility().toString().equals(spellNotOnStack)) {
|
||||
if (stackObject.getStackAbility().toString().contains(spellNotOnStack)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -388,7 +393,7 @@ public class TestPlayer extends ComputerPlayer {
|
|||
String spellOnTopOFStack = groups[2].substring(18);
|
||||
if (game.getStack().size() > 0) {
|
||||
StackObject stackObject = game.getStack().getFirst();
|
||||
if (stackObject != null && stackObject.getStackAbility().toString().indexOf(spellOnTopOFStack) >= 0) {
|
||||
if (stackObject != null && stackObject.getStackAbility().toString().contains(spellOnTopOFStack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -621,6 +621,15 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
Assert.assertEquals("(Graveyard) Card counts are not equal (" + cardName + ")", count, actualCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts added actions count. Usefull to make sure that all actions were executed.
|
||||
* @param player
|
||||
* @param count
|
||||
*/
|
||||
public void assertActionCount(TestPlayer player, int count) {
|
||||
Assert.assertEquals("Actions left are not equal: ", count, player.getActionCount());
|
||||
}
|
||||
|
||||
public Permanent getPermanent(String cardName, Player player) {
|
||||
return getPermanent(cardName, player.getId());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue