From 860dc72590d3bc23ec8d106aeaf122c118d321a9 Mon Sep 17 00:00:00 2001 From: TricyOne Date: Tue, 14 Oct 2025 12:02:43 +0200 Subject: [PATCH 1/2] basic spell creation system --- .idea/misc.xml | 2 +- src/main/java/Spell.java | 18 ++++++++++++++++++ src/test/java/SpellTest.java | 28 ++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/main/java/Spell.java create mode 100644 src/test/java/SpellTest.java diff --git a/.idea/misc.xml b/.idea/misc.xml index 001e756..eda147d 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -8,7 +8,7 @@ - + \ No newline at end of file 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"); + } +} -- 2.39.5 From b40bd0ae350452c11aa95d81c84498d78e74e7c8 Mon Sep 17 00:00:00 2001 From: TricyOne Date: Tue, 14 Oct 2025 12:07:58 +0200 Subject: [PATCH 2/2] didnt mean to change that --- .idea/misc.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index eda147d..001e756 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -8,7 +8,7 @@ - + \ No newline at end of file -- 2.39.5