|
|
@ -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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |