diff --git a/src/test/java/game/loadNextQuestionTest.java b/src/test/java/game/loadNextQuestionTest.java new file mode 100644 index 0000000..33d613c --- /dev/null +++ b/src/test/java/game/loadNextQuestionTest.java @@ -0,0 +1,37 @@ +package game; + +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; + +import Gui.GameGui; +import Gui.gui; +@TestInstance(Lifecycle.PER_CLASS) +class loadNextQuestionTest { + gui gui = new gui(); + GameGui gameGui = new GameGui(); + @BeforeAll + void setUp(){ + gui.StartMainMenu(); + gameGui.createGui(); + } + + @Test + public void testCorrectAnswer() { + //arrange + gameGui.questionNr = 0; + loadNextQuestion loadNextQuestion = new loadNextQuestion(); + runGame.splitAns = new String[] {"option1", "option2", "option3", "option4", "1"}; + //act + gameGui.AnswersBtn1.doClick(); + //assert + assertEquals(1, gameGui.questionNr); + + } + +} \ No newline at end of file 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 35cd4ce..cd8f159 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,4 +1,5 @@ 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\loadNextQuestionTest.java C:\Users\ozan_\MiniGameProject\src\test\java\game\runGameTest.java C:\Users\ozan_\MiniGameProject\src\test\java\Gui\guiTest.java