From 511e090a54f00594ca1c5fc85401b4df27537420 Mon Sep 17 00:00:00 2001 From: Leon Montag Date: Fri, 30 Dec 2022 22:37:43 +0100 Subject: [PATCH] Added arrange and act in testRun --- src/test/java/Gui/guiTest.java | 1 + src/test/java/game/runGameTest.java | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/test/java/Gui/guiTest.java b/src/test/java/Gui/guiTest.java index 5ea01fc..0a6b092 100644 --- a/src/test/java/Gui/guiTest.java +++ b/src/test/java/Gui/guiTest.java @@ -11,6 +11,7 @@ class guiTest { static void setUp() { GuiInterface StartGui = new gui(); StartGui.StartMainMenu(); + gui.Frame.setVisible(false); } @Test diff --git a/src/test/java/game/runGameTest.java b/src/test/java/game/runGameTest.java index 52b7c87..05af9ca 100644 --- a/src/test/java/game/runGameTest.java +++ b/src/test/java/game/runGameTest.java @@ -9,8 +9,13 @@ import java.io.IOException; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import Gui.GameGui; +import Gui.gui; + class runGameTest { + GameGui game = new GameGui(); + gui Gui = new gui(); @BeforeEach void setUp() throws Exception { } @@ -60,4 +65,20 @@ class runGameTest { assertEquals("4", parts[3]); } + @Test + public void testRun() { + //arrange + Gui.StartMainMenu(); + game.createGui(); + gui.Frame.setVisible(false); + //act + runGame.arrQuestions = new String[]{"Frage 1", "Frage 2"}; + runGame.arrAnswers = new String[]{"Antw. 1,Antw. 2,Antw. 3,Antw. 4", + "Antw. 5,Antw. 6,Antw. 7,Antw. 8"}; + runGame game = new runGame(); + game.run(0); + + + } + }