Added test for Mana.enough method.

This commit is contained in:
LevelX2 2015-11-20 15:06:00 +01:00
parent 7e58dc70d5
commit 8a133a43d0
2 changed files with 62 additions and 5 deletions

View file

@ -67,12 +67,12 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
public ManaCostsImpl(final ManaCostsImpl<T> costs) {
this.id = costs.id;
for (T cost : costs) {
this.add((T) cost.copy());
this.add(cost.copy());
}
}
@Override
public boolean add(ManaCost cost) {
public final boolean add(ManaCost cost) {
if (cost instanceof ManaCosts) {
for (ManaCost manaCost : (ManaCosts<T>) cost) {
super.add((T) manaCost);
@ -298,7 +298,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
}
@Override
public void load(String mana) {
public final void load(String mana) {
this.clear();
if (costs.containsKey(mana)) {
ManaCosts<T> savedCosts = costs.get(mana);
@ -433,7 +433,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
@Override
public boolean isPaid() {
for (T cost : this) {
if (!((T) cost instanceof VariableManaCost) && !cost.isPaid()) {
if (!(cost instanceof VariableManaCost) && !cost.isPaid()) {
return false;
}
}
@ -465,7 +465,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
@Override
public ManaCosts<T> copy() {
return new ManaCostsImpl(this);
return new ManaCostsImpl<>(this);
}
@Override