From 1dd8b730cdef533aef537487b238b592ddadb696 Mon Sep 17 00:00:00 2001 From: Ozan-Can Ekinci Date: Mon, 16 Jan 2023 20:38:01 +0100 Subject: [PATCH] created test for LosingRestartBtn --- src/test/java/Gui/ActionHandlerTest.java | 33 +++++++++++++++++++ .../compile/default-compile/inputFiles.lst | 18 +++++----- .../default-testCompile/inputFiles.lst | 7 ++-- 3 files changed, 46 insertions(+), 12 deletions(-) create mode 100644 src/test/java/Gui/ActionHandlerTest.java diff --git a/src/test/java/Gui/ActionHandlerTest.java b/src/test/java/Gui/ActionHandlerTest.java new file mode 100644 index 0000000..f798a3a --- /dev/null +++ b/src/test/java/Gui/ActionHandlerTest.java @@ -0,0 +1,33 @@ +package Gui; + +import static org.junit.jupiter.api.Assertions.*; + +import java.awt.event.ActionEvent; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.TestInstance.Lifecycle; +@TestInstance(Lifecycle.PER_CLASS) +class ActionHandlerTest { + gui gui = new gui(); + GameGui gameGui = new GameGui(); + @BeforeAll + void setUp(){ + gui.StartMainMenu(); + gameGui.createGui(); + gameGui.createLosingPanel(); + } + + @Test + public void testLosingRestartBtn() { + //arrange + int expectedNr = 1; + //act + GameGui.questionNr= 2; + ActionHandler actionHandler = new ActionHandler(); + GameGui.LosingRestartBtn.doClick(); + //assert + assertEquals(expectedNr, GameGui.questionNr); + } +} \ No newline at end of file diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index e519c8c..b7c28cf 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -1,9 +1,9 @@ -C:\Users\Leon\MiniGameProject\src\main\java\Gui\ActionHandler.java -C:\Users\Leon\MiniGameProject\src\main\java\game\loadNextQuestion.java -C:\Users\Leon\MiniGameProject\src\main\java\Gui\GameGuiInterface.java -C:\Users\Leon\MiniGameProject\src\main\java\Gui\gui.java -C:\Users\Leon\MiniGameProject\src\main\java\game\runGame.java -C:\Users\Leon\MiniGameProject\src\main\java\main.java -C:\Users\Leon\MiniGameProject\src\main\java\Gui\StartGameGui.java -C:\Users\Leon\MiniGameProject\src\main\java\Gui\GameGui.java -C:\Users\Leon\MiniGameProject\src\main\java\Gui\GuiInterface.java +C:\Users\ozan_\MiniGameProject\src\main\java\Gui\GuiInterface.java +C:\Users\ozan_\MiniGameProject\src\main\java\Gui\GameGuiInterface.java +C:\Users\ozan_\MiniGameProject\src\main\java\Gui\gui.java +C:\Users\ozan_\MiniGameProject\src\main\java\game\loadNextQuestion.java +C:\Users\ozan_\MiniGameProject\src\main\java\Gui\ActionHandler.java +C:\Users\ozan_\MiniGameProject\src\main\java\main.java +C:\Users\ozan_\MiniGameProject\src\main\java\game\runGame.java +C:\Users\ozan_\MiniGameProject\src\main\java\Gui\StartGameGui.java +C:\Users\ozan_\MiniGameProject\src\main\java\Gui\GameGui.java diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst index 17c97ad..35cd4ce 100644 --- a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst +++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -1,3 +1,4 @@ -C:\Users\Leon\MiniGameProject\src\test\java\Gui\guiTest.java -C:\Users\Leon\MiniGameProject\src\test\java\Gui\GameGuiTest.java -C:\Users\Leon\MiniGameProject\src\test\java\game\runGameTest.java +C:\Users\ozan_\MiniGameProject\src\test\java\Gui\ActionHandlerTest.java +C:\Users\ozan_\MiniGameProject\src\test\java\Gui\GameGuiTest.java +C:\Users\ozan_\MiniGameProject\src\test\java\game\runGameTest.java +C:\Users\ozan_\MiniGameProject\src\test\java\Gui\guiTest.java