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