From 2e08539e68397b558764c424e559d89044bc06cc Mon Sep 17 00:00:00 2001 From: Jonas Wagner Date: Tue, 18 Jan 2022 09:57:48 +0100 Subject: [PATCH] Refactor startGame Method --- src/main/java/Game.java | 17 ++++++++++++++++- src/test/java/GameTest.java | 16 ++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/main/java/Game.java b/src/main/java/Game.java index 03be2ad..da68c76 100644 --- a/src/main/java/Game.java +++ b/src/main/java/Game.java @@ -1,7 +1,22 @@ public class Game { + Gameboard gb; + Player p1; + Player p2; + Player p3; + Player p4; + public static void main(String[] args) { - Gameboard gb = new Gameboard(); + Game g = new Game(); + g.startGame(); + } + + public void startGame() { + this.gb = new Gameboard(); gb.initGameboard(); + p1 = new Player("Rot"); + p2 = new Player("Blau"); + p3 = new Player("Gelb"); + p4 = new Player("Grün"); } } diff --git a/src/test/java/GameTest.java b/src/test/java/GameTest.java index f389fff..122fbe6 100644 --- a/src/test/java/GameTest.java +++ b/src/test/java/GameTest.java @@ -8,4 +8,20 @@ import org.junit.jupiter.params.provider.MethodSource; public class GameTest { + private Gameboard gb; + private Player p1; + private Player p2; + private Player p3; + private Player p4; + + @BeforeEach + void setup() { + this.gb = new Gameboard(); + gb.initGameboard(); + p1 = new Player("Rot"); + p2 = new Player("Blau"); + p3 = new Player("Gelb"); + p4 = new Player("Grün"); + } + }