|
|
@ -4,6 +4,8 @@ import static org.junit.jupiter.api.Assertions.*; |
|
|
|
|
|
|
|
import java.awt.GridBagConstraints; |
|
|
|
import java.awt.Insets; |
|
|
|
import java.io.File; |
|
|
|
import java.io.FileWriter; |
|
|
|
|
|
|
|
import org.junit.jupiter.api.BeforeAll; |
|
|
|
import org.junit.jupiter.api.BeforeEach; |
|
|
@ -58,4 +60,20 @@ class GameGuiTest { |
|
|
|
gameGui.highScore(); |
|
|
|
assertEquals(expectedHighScore, gameGui.highScore); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
public void testCreateShowQuestion() throws Exception{ |
|
|
|
|
|
|
|
File file; |
|
|
|
file = File.createTempFile("temp", ".txt"); |
|
|
|
FileWriter writer = new FileWriter(file); |
|
|
|
writer.write("1\n"); |
|
|
|
writer.write("2\n"); |
|
|
|
writer.write("3\n"); |
|
|
|
writer.close(); |
|
|
|
GameGui.currentQuestion = 1; |
|
|
|
gameGui.createShowQuestion(1 ,file.getAbsolutePath()); |
|
|
|
assertEquals("Frage 1: 1 Euro", GameGui.CurrentQuestionNrLabel.getText()); |
|
|
|
|
|
|
|
} |
|
|
|
} |