fdai7471
2 years ago
1 changed files with 0 additions and 67 deletions
@ -1,67 +0,0 @@ |
|||
import static org.junit.Assert.assertEquals; |
|||
|
|||
import java.io.ByteArrayInputStream; |
|||
import java.io.ByteArrayOutputStream; |
|||
import java.io.PrintStream; |
|||
import java.util.Random; |
|||
|
|||
import org.junit.Test; |
|||
|
|||
public class TestKlasee { |
|||
|
|||
|
|||
@Test |
|||
public void testKarteikarten() { |
|||
ByteArrayOutputStream outContent = new ByteArrayOutputStream(); |
|||
System.setOut(new PrintStream(outContent)); |
|||
|
|||
Programm.Karteikarten(); |
|||
String expectedOutput = "Was ist die Hauptstadt von Deutschland?\n" + |
|||
"Berlin\n" + |
|||
"Korrekt!\n" + |
|||
"Welches ist der größtes Planet in unserem Sonnensystem?\n" + |
|||
"Jupiter\n" + |
|||
"Korrekt!\n" + |
|||
"Was hat die Mona Lisa gemalt?\n" + |
|||
"Leonardo da Vinci\n" + |
|||
"Korrekt!\n" + |
|||
"Das Spiel ist zu Ende. Dein Punktestand ist 3 von insgesamt 3\n"; |
|||
|
|||
assertEquals(expectedOutput, outContent.toString()); |
|||
} |
|||
|
|||
@Test |
|||
public void testQuizz() { |
|||
Random rand = new Random(); |
|||
ByteArrayOutputStream outContent = new ByteArrayOutputStream(); |
|||
System.setOut(new PrintStream(outContent)); |
|||
|
|||
Programm.Quizz(); |
|||
String expectedOutput = "Wer hat die Formel E=mc² entwickelt?\n" + |
|||
"A) Isaac Newton\n" + |
|||
"B) Albert Einstein\n" + |
|||
"C) Galileo Galilei\n" + |
|||
"D) Stephen Hawking\n" + |
|||
"B\n" + |
|||
"Richtig!\n"; |
|||
|
|||
assertEquals(expectedOutput, outContent.toString()); |
|||
} |
|||
|
|||
@Test |
|||
public void testBinaerrechner() { |
|||
ByteArrayOutputStream outContent = new ByteArrayOutputStream(); |
|||
System.setOut(new PrintStream(outContent)); |
|||
|
|||
Programm.Binaerrechner(); |
|||
String expectedOutput = "Gebe den ersten Binärcode ein: 11\n" + |
|||
"Gebe den zweiten Binärcode ein: 10\n" + |
|||
"Gebe die gewünschte Operation ein (+, -, *, /): +\n" + |
|||
"Das Ergebnis ist: 101\n"; |
|||
|
|||
assertEquals(expectedOutput, outContent.toString()); |
|||
} |
|||
|
|||
} |
|||
|
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue