gruppe06-hufflepuff-projekt.../test/GameTest.java

36 lines
938 B
Java
Raw Normal View History

2021-10-08 09:15:24 +02:00
import static org.junit.jupiter.api.Assertions.*;
2021-10-08 09:51:14 +02:00
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.jupiter.api.Test;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
2021-10-08 09:15:24 +02:00
class GameTest {
2021-10-08 09:51:14 +02:00
private final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
private final ByteArrayOutputStream errContent = new ByteArrayOutputStream();
private final PrintStream originalOut = System.out;
private final PrintStream originalErr = System.err;
@Before
public void setUpStreams() {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
}
@After
public void restoreStreams() {
System.setOut(originalOut);
System.setErr(originalErr);
}
2021-10-08 09:15:24 +02:00
2021-10-08 09:51:14 +02:00
@Test
void checkTest() {
System.out.println("hello");
assertEquals("hello", outContent.toString());
2021-10-08 09:15:24 +02:00
}
}