mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
add fromString test and make it pass.
This commit is contained in:
@@ -112,7 +112,185 @@ public enum AbilityKey {
|
|||||||
* @return the corresponding key if there is one or null otherwise
|
* @return the corresponding key if there is one or null otherwise
|
||||||
*/
|
*/
|
||||||
public static AbilityKey fromString(String s) {
|
public static AbilityKey fromString(String s) {
|
||||||
return null;
|
switch (s) {
|
||||||
|
case "AbilityMana":
|
||||||
|
return AbilityMana;
|
||||||
|
case "Activator":
|
||||||
|
return Activator;
|
||||||
|
case "Affected":
|
||||||
|
return Affected;
|
||||||
|
case "AllVotes":
|
||||||
|
return AllVotes;
|
||||||
|
case "Amount":
|
||||||
|
return Amount;
|
||||||
|
case "Attach":
|
||||||
|
return Attach;
|
||||||
|
case "AttachSource":
|
||||||
|
return AttachSource;
|
||||||
|
case "AttachTarget":
|
||||||
|
return AttachTarget;
|
||||||
|
case "Attacked":
|
||||||
|
return Attacked;
|
||||||
|
case "Attacker":
|
||||||
|
return Attacker;
|
||||||
|
case "Attackers":
|
||||||
|
return Attackers;
|
||||||
|
case "AttackingPlayer":
|
||||||
|
return AttackingPlayer;
|
||||||
|
case "AttackedTarget":
|
||||||
|
return AttackedTarget;
|
||||||
|
case "Blocker":
|
||||||
|
return Blocker;
|
||||||
|
case "Blockers":
|
||||||
|
return Blockers;
|
||||||
|
case "CastSA":
|
||||||
|
return CastSA;
|
||||||
|
case "CastSACMC":
|
||||||
|
return CastSACMC;
|
||||||
|
case "Card":
|
||||||
|
return Card;
|
||||||
|
case "Cards":
|
||||||
|
return Cards;
|
||||||
|
case "CardLKI":
|
||||||
|
return CardLKI;
|
||||||
|
case "Cause":
|
||||||
|
return Cause;
|
||||||
|
case "Causer":
|
||||||
|
return Causer;
|
||||||
|
case "Championed":
|
||||||
|
return Championed;
|
||||||
|
case "CopySA":
|
||||||
|
return CopySA;
|
||||||
|
case "Cost":
|
||||||
|
return Cost;
|
||||||
|
case "CostStack":
|
||||||
|
return CostStack;
|
||||||
|
case "CounterAmount":
|
||||||
|
return CounterAmount;
|
||||||
|
case "CounteredSA":
|
||||||
|
return CounteredSA;
|
||||||
|
case "CounterType":
|
||||||
|
return CounterType;
|
||||||
|
case "Crew":
|
||||||
|
return Crew;
|
||||||
|
case "CumulativeUpkeepPaid":
|
||||||
|
return CumulativeUpkeepPaid;
|
||||||
|
case "CurrentCastSpells":
|
||||||
|
return CurrentCastSpells;
|
||||||
|
case "CurrentStormCount":
|
||||||
|
return CurrentStormCount;
|
||||||
|
case "DamageAmount":
|
||||||
|
return DamageAmount;
|
||||||
|
case "DamageSource":
|
||||||
|
return DamageSource;
|
||||||
|
case "DamageSources":
|
||||||
|
return DamageSources;
|
||||||
|
case "DamageTarget":
|
||||||
|
return DamageTarget;
|
||||||
|
case "DamageTargets":
|
||||||
|
return DamageTargets;
|
||||||
|
case "Defender":
|
||||||
|
return Defender;
|
||||||
|
case "Defenders":
|
||||||
|
return Defenders;
|
||||||
|
case "DefendingPlayer":
|
||||||
|
return DefendingPlayer;
|
||||||
|
case "Destination":
|
||||||
|
return Destination;
|
||||||
|
case "Devoured":
|
||||||
|
return Devoured;
|
||||||
|
case "EchoPaid":
|
||||||
|
return EchoPaid;
|
||||||
|
case "Exploited":
|
||||||
|
return Exploited;
|
||||||
|
case "Explorer":
|
||||||
|
return Explorer;
|
||||||
|
case "Event":
|
||||||
|
return Event;
|
||||||
|
case "Fighter":
|
||||||
|
return Fighter;
|
||||||
|
case "FirstTime":
|
||||||
|
return FirstTime;
|
||||||
|
case "Fizzle":
|
||||||
|
return Fizzle;
|
||||||
|
case "IsCombatDamage":
|
||||||
|
return IsCombatDamage;
|
||||||
|
case "IndividualCostPaymentInstance":
|
||||||
|
return IndividualCostPaymentInstance;
|
||||||
|
case "IsMadness":
|
||||||
|
return IsMadness;
|
||||||
|
case "LifeAmount":
|
||||||
|
return LifeAmount;
|
||||||
|
case "MonstrosityAmount":
|
||||||
|
return MonstrosityAmount;
|
||||||
|
case "NewCounterAmount":
|
||||||
|
return NewCounterAmount;
|
||||||
|
case "Num":
|
||||||
|
return Num;
|
||||||
|
case "NumBlockers":
|
||||||
|
return NumBlockers;
|
||||||
|
case "NumThisTurn":
|
||||||
|
return NumThisTurn;
|
||||||
|
case "Number":
|
||||||
|
return Number;
|
||||||
|
case "Object":
|
||||||
|
return Object;
|
||||||
|
case "Objects":
|
||||||
|
return Objects;
|
||||||
|
case "OtherAttackers":
|
||||||
|
return OtherAttackers;
|
||||||
|
case "OtherVoters":
|
||||||
|
return OtherVoters;
|
||||||
|
case "Origin":
|
||||||
|
return Origin;
|
||||||
|
case "OriginalController":
|
||||||
|
return OriginalController;
|
||||||
|
case "OriginalDefender":
|
||||||
|
return OriginalDefender;
|
||||||
|
case "PayingMana":
|
||||||
|
return PayingMana;
|
||||||
|
case "Phase":
|
||||||
|
return Phase;
|
||||||
|
case "Player":
|
||||||
|
return Player;
|
||||||
|
case "Produced":
|
||||||
|
return Produced;
|
||||||
|
case "Result":
|
||||||
|
return Result;
|
||||||
|
case "Scheme":
|
||||||
|
return Scheme;
|
||||||
|
case "Source":
|
||||||
|
return Source;
|
||||||
|
case "Sources":
|
||||||
|
return Sources;
|
||||||
|
case "SourceSA":
|
||||||
|
return SourceSA;
|
||||||
|
case "SpellAbility":
|
||||||
|
return SpellAbility;
|
||||||
|
case "SpellAbilityStackInstance":
|
||||||
|
return SpellAbilityStackInstance;
|
||||||
|
case "SpellAbilityTargetingCards":
|
||||||
|
return SpellAbilityTargetingCards;
|
||||||
|
case "StackInstance":
|
||||||
|
return StackInstance;
|
||||||
|
case "StackSa":
|
||||||
|
return StackSa;
|
||||||
|
case "StackSi":
|
||||||
|
return StackSi;
|
||||||
|
case "Target":
|
||||||
|
return Target;
|
||||||
|
case "Targets":
|
||||||
|
return Targets;
|
||||||
|
case "Transformer":
|
||||||
|
return Transformer;
|
||||||
|
case "Vehicle":
|
||||||
|
return Vehicle;
|
||||||
|
case "Won":
|
||||||
|
return Won;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <V> EnumMap<AbilityKey, V> newMap() {
|
public static <V> EnumMap<AbilityKey, V> newMap() {
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package forge.game.ability;
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
public class AbilityKeyTest extends TestCase {
|
||||||
|
public void testFromStringWorksForAllKeys() {
|
||||||
|
for (AbilityKey key : AbilityKey.values()) {
|
||||||
|
assertEquals(key, AbilityKey.fromString(key.toString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user