1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-10 17:00:08 -09:00

Little improves for tests

This commit is contained in:
Oleg Agafonov 2020-06-26 18:58:13 +04:00
parent e73a11cb12
commit 329f7fd609
5 changed files with 15 additions and 14 deletions
Mage.Tests/src/test/java/org/mage/test
Mage/src/main/java/mage/abilities/effects

View file

@ -1,5 +1,4 @@
package org.mage.test.cards.abilities.keywords;
package org.mage.test.cards.abilities.abilitywords;
import mage.constants.PhaseStep; import mage.constants.PhaseStep;
import mage.constants.Zone; import mage.constants.Zone;
@ -7,7 +6,6 @@ import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public class ConvergeTest extends CardTestPlayerBase { public class ConvergeTest extends CardTestPlayerBase {

View file

@ -1,5 +1,4 @@
package org.mage.test.cards.abilities.keywords;
package org.mage.test.cards.abilities.abilitywords;
import mage.constants.PhaseStep; import mage.constants.PhaseStep;
import mage.constants.Zone; import mage.constants.Zone;
@ -7,7 +6,6 @@ import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public class DomainTest extends CardTestPlayerBase { public class DomainTest extends CardTestPlayerBase {

View file

@ -1,5 +1,4 @@
package org.mage.test.cards.abilities.keywords;
package org.mage.test.cards.abilities.abilitywords;
import mage.constants.PhaseStep; import mage.constants.PhaseStep;
import mage.constants.Zone; import mage.constants.Zone;
@ -7,7 +6,6 @@ import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public class RevoltTest extends CardTestPlayerBase { public class RevoltTest extends CardTestPlayerBase {

View file

@ -51,7 +51,8 @@ import java.util.stream.Collectors;
*/ */
public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implements CardTestAPI { public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implements CardTestAPI {
private static final boolean FAST_SCAN_WITHOUT_DATABASE_CREATE = false; // DEBUG only, enable it to fast startup tests without database create // DEBUG only, enable it to fast startup tests without database create (delete \db\ folder to force db recreate)
private static final boolean FAST_SCAN_WITHOUT_DATABASE_CREATE = false;
public static final String ALIAS_PREFIX = "@"; // don't change -- it uses in user's tests public static final String ALIAS_PREFIX = "@"; // don't change -- it uses in user's tests
public static final String CHECK_PARAM_DELIMETER = "#"; public static final String CHECK_PARAM_DELIMETER = "#";
@ -137,7 +138,7 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
public CardTestPlayerAPIImpl() { public CardTestPlayerAPIImpl() {
// load all cards to db from class list // load all cards to db from class list
ArrayList<String> errorsList = new ArrayList<>(); ArrayList<String> errorsList = new ArrayList<>();
if (FAST_SCAN_WITHOUT_DATABASE_CREATE) { if (FAST_SCAN_WITHOUT_DATABASE_CREATE && CardRepository.instance.findCard("Mountain") != null) {
CardScanner.scanned = true; CardScanner.scanned = true;
} }
CardScanner.scan(errorsList); CardScanner.scan(errorsList);

View file

@ -223,14 +223,20 @@ public class ContinuousEffectsList<T extends ContinuousEffect> extends ArrayList
effectAbilityMap.clear(); effectAbilityMap.clear();
} }
public boolean contains(Effect effect) { @Override
public boolean contains(Object object) {
if (object == null || !(object instanceof ContinuousEffect)) {
return false;
}
// search by id // search by id
ContinuousEffect need = (ContinuousEffect) object;
for (Iterator<T> iterator = this.iterator(); iterator.hasNext(); ) { for (Iterator<T> iterator = this.iterator(); iterator.hasNext(); ) {
T test = iterator.next(); T test = iterator.next();
if (effect.getId().equals(test.getId())) { if (need.equals(test)) {
return true; return true;
} }
if (effect.equals(test)) { if (need.getId().equals(test.getId())) {
return true; return true;
} }
} }