diff --git a/src/main/java/Spell.java b/src/main/java/Spell.java new file mode 100644 index 0000000..62ae11d --- /dev/null +++ b/src/main/java/Spell.java @@ -0,0 +1,18 @@ +public class Spell { + private final String spellName; + private int cost; + private int potency; + + public Spell(String spellName, int cost, int potency) { + this.spellName = spellName; + this.cost = cost; + this.potency = potency; + } + + public String getSpellName() {return spellName;} + + public int getCost() {return cost;} + + public int getPotency() {return potency;} +} + diff --git a/src/test/java/SpellTest.java b/src/test/java/SpellTest.java new file mode 100644 index 0000000..d039d0d --- /dev/null +++ b/src/test/java/SpellTest.java @@ -0,0 +1,28 @@ +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +public class SpellTest { + + private Spell defaultSpell() { + return new Spell("fireball", 20, 40); + } + + @Test + void setSpellNameOnCreation(){ + var spell = defaultSpell(); + assertEquals("fireball", spell.getSpellName(), "Spell name should be set"); + } + + @Test + void setCostOnCreation() { + var spell = defaultSpell(); + assertEquals(20, spell.getCost(), "Spell cost should have been set"); + } + + @Test + void setPotencyOnCreation() { + var spell = defaultSpell(); + assertEquals(40, spell.getPotency(), "spell potency should have been set"); + } +}