program towards Interface rather than implementations

This commit is contained in:
Ingmar Goudt 2020-02-10 10:39:56 +01:00
parent b04c436801
commit ae7919cd07
100 changed files with 218 additions and 209 deletions

View file

@ -2973,7 +2973,7 @@ public class TestPlayer implements Player {
}
@Override
public boolean flipCoin(Ability source, Game game, boolean winnable, ArrayList<UUID> appliedEffects) {
public boolean flipCoin(Ability source, Game game, boolean winnable, List<UUID> appliedEffects) {
return computerPlayer.flipCoin(source, game, true, appliedEffects);
}
@ -2983,7 +2983,7 @@ public class TestPlayer implements Player {
}
@Override
public int rollDice(Game game, ArrayList<UUID> appliedEffects, int numSides) {
public int rollDice(Game game, List<UUID> appliedEffects, int numSides) {
return computerPlayer.rollDice(game, appliedEffects, numSides);
}
@ -3604,12 +3604,12 @@ public class TestPlayer implements Player {
}
@Override
public PlanarDieRoll rollPlanarDie(Game game, ArrayList<UUID> appliedEffects) {
public PlanarDieRoll rollPlanarDie(Game game, List<UUID> appliedEffects) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public PlanarDieRoll rollPlanarDie(Game game, ArrayList<UUID> appliedEffects, int numberChaosSides, int numberPlanarSides) {
public PlanarDieRoll rollPlanarDie(Game game, List<UUID> appliedEffects, int numberChaosSides, int numberPlanarSides) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

View file

@ -642,7 +642,7 @@ public class PlayerStub implements Player {
}
@Override
public boolean flipCoin(Ability source, Game game, boolean winnable, ArrayList<UUID> appliedEffects) {
public boolean flipCoin(Ability source, Game game, boolean winnable, List<UUID> appliedEffects) {
return false;
}
@ -652,7 +652,7 @@ public class PlayerStub implements Player {
}
@Override
public int rollDice(Game game, ArrayList<UUID> appliedEffects, int numSides) {
public int rollDice(Game game, List<UUID> appliedEffects, int numSides) {
return 1;
}
@ -1322,12 +1322,12 @@ public class PlayerStub implements Player {
}
@Override
public PlanarDieRoll rollPlanarDie(Game game, ArrayList<UUID> appliedEffects) {
public PlanarDieRoll rollPlanarDie(Game game, List<UUID> appliedEffects) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public PlanarDieRoll rollPlanarDie(Game game, ArrayList<UUID> appliedEffects, int numberChaosSides, int numberPlanarSides) {
public PlanarDieRoll rollPlanarDie(Game game, List<UUID> appliedEffects, int numberChaosSides, int numberPlanarSides) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

View file

@ -2,6 +2,7 @@ package org.mage.test.utils;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.UUID;
import mage.Mana;
import mage.abilities.Ability;
@ -188,7 +189,7 @@ public class ManaUtilTest extends CardTestPlayerBase {
Card card = CardRepository.instance.findCard(landName).getCard();
Assert.assertNotNull(card);
HashMap<UUID, ActivatedManaAbilityImpl> useableAbilities = getManaAbilities(card);
Map<UUID, ActivatedManaAbilityImpl> useableAbilities = getManaAbilities(card);
Assert.assertEquals(expected1, useableAbilities.size());
useableAbilities = ManaUtil.tryToAutoPay(unpaid, (LinkedHashMap<UUID, ActivatedManaAbilityImpl>) useableAbilities);
@ -216,7 +217,7 @@ public class ManaUtilTest extends CardTestPlayerBase {
Card card = CardRepository.instance.findCard(landName).getCard();
Assert.assertNotNull(card);
HashMap<UUID, ActivatedManaAbilityImpl> useableAbilities = getManaAbilities(card);
Map<UUID, ActivatedManaAbilityImpl> useableAbilities = getManaAbilities(card);
Assert.assertEquals(expected1, useableAbilities.size());
useableAbilities = ManaUtil.tryToAutoPay(unpaid, (LinkedHashMap<UUID, ActivatedManaAbilityImpl>) useableAbilities);
@ -251,8 +252,8 @@ public class ManaUtilTest extends CardTestPlayerBase {
* @param card Card to extract mana abilities from.
* @return
*/
private HashMap<UUID, ActivatedManaAbilityImpl> getManaAbilities(Card card) {
HashMap<UUID, ActivatedManaAbilityImpl> useableAbilities = new LinkedHashMap<>();
private Map<UUID, ActivatedManaAbilityImpl> getManaAbilities(Card card) {
Map<UUID, ActivatedManaAbilityImpl> useableAbilities = new LinkedHashMap<>();
for (Ability ability : card.getAbilities()) {
if (ability instanceof ActivatedManaAbilityImpl) {
ability.newId(); // we need to assign id manually as we are not in game