Added Test and changed some log messages from info to debug.

This commit is contained in:
LevelX2 2020-01-07 17:56:26 +01:00
parent d16a4e5934
commit d4ec65cddb
5 changed files with 48 additions and 8 deletions

View file

@ -0,0 +1,40 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.mage.test.cards.planeswalker;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class VivienTest extends CardTestPlayerBase {
@Test
public void VivienArkbowRangerAbility1NoTargetsTest() {
// +1: Distribute two +1/+1 counters among up to two target creatures. They gain trample until end of turn.
// 3: Target creature you control deals damage equal to its power to target creature or planeswalker.
// 5: You may choose a creature card you own from outside the game, reveal it, and put it into your hand.
addCard(Zone.HAND, playerA, "Vivien, Arkbow Ranger"); // Planeswalker {1}{G}{G}{G} - starts with 4 Loyality counters
addCard(Zone.BATTLEFIELD, playerA, "Forest", 4);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Vivien, Arkbow Ranger");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "+1: Distribute");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Vivien, Arkbow Ranger", 1);
assertCounterCount("Vivien, Arkbow Ranger", CounterType.LOYALTY, 5);
}
}

View file

@ -121,7 +121,7 @@ public abstract class MageTestBase {
private static Class<?> loadPlugin(Plugin plugin) {
try {
classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL());
logger.info("Loading plugin: " + plugin.getClassName());
logger.debug("Loading plugin: " + plugin.getClassName());
return Class.forName(plugin.getClassName(), true, classLoader);
} catch (ClassNotFoundException ex) {
logger.warn("Plugin not Found:" + plugin.getJar() + " - check plugin folder");
@ -134,7 +134,7 @@ public abstract class MageTestBase {
private static MatchType loadGameType(GamePlugin plugin) {
try {
classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL());
logger.info("Loading game type: " + plugin.getClassName());
logger.debug("Loading game type: " + plugin.getClassName());
return (MatchType) Class.forName(plugin.getTypeName(), true, classLoader).getConstructor().newInstance();
} catch (ClassNotFoundException ex) {
logger.warn("Game type not found:" + plugin.getJar() + " - check plugin folder");

View file

@ -115,7 +115,7 @@ public abstract class MageTestPlayerBase {
private static Class<?> loadPlugin(Plugin plugin) {
try {
classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL());
logger.info("Loading plugin: " + plugin.getClassName());
logger.debug("Loading plugin: " + plugin.getClassName());
return Class.forName(plugin.getClassName(), true, classLoader);
} catch (ClassNotFoundException ex) {
logger.warn("Plugin not Found:" + plugin.getJar() + " - check plugin folder");
@ -128,7 +128,7 @@ public abstract class MageTestPlayerBase {
private static MatchType loadGameType(GamePlugin plugin) {
try {
classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL());
logger.info("Loading game type: " + plugin.getClassName());
logger.debug("Loading game type: " + plugin.getClassName());
return (MatchType) Class.forName(plugin.getTypeName(), true, classLoader).getConstructor().newInstance();
} catch (ClassNotFoundException ex) {
logger.warn("Game type not found:" + plugin.getJar() + " - check plugin folder");

View file

@ -46,7 +46,7 @@ import java.util.stream.Collectors;
* @author ayratn
*/
public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implements CardTestAPI {
// Defines the constant if for activate ability is not target but a ability on the stack to define
public static final String NO_TARGET = "NO_TARGET";
@ -256,7 +256,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
currentGame.start(activePlayer.getId());
long t2 = System.nanoTime();
logger.debug("Winner: " + currentGame.getWinner());
logger.info("Test has been executed. Execution time: " + (t2 - t1) / 1000000 + " ms");
logger.info(Thread.currentThread().getStackTrace()[2].getMethodName() + " has been executed. Execution time: " + (t2 - t1) / 1000000 + " ms");
// TODO: 01.12.2018, JayDi85 - uncomment and fix MANY broken tests with wrong commands
//assertAllCommandsUsed();

View file

@ -813,7 +813,7 @@ public abstract class GameImpl implements Game, Serializable {
sb.append(']');
count++;
}
logger.info(sb.toString());
logger.debug(sb.toString());
}
}
@ -2886,7 +2886,7 @@ public abstract class GameImpl implements Game, Serializable {
try {
Integer amount = Integer.parseInt(s[1]);
player.setLife(amount, this, ownerId);
logger.info("Setting player's life: ");
logger.debug("Setting player's life: ");
} catch (NumberFormatException e) {
logger.fatal("error setting life", e);
}