32 lines
930 B
Java
32 lines
930 B
Java
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package pgp.wkd.cli.online_test_vectors;
|
|
|
|
import org.junit.jupiter.api.AfterEach;
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.PrintStream;
|
|
|
|
public abstract class RedirectSystemStreamsTest {
|
|
|
|
protected final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
|
|
protected final ByteArrayOutputStream errContent = new ByteArrayOutputStream();
|
|
private final PrintStream originalOut = System.out;
|
|
private final PrintStream originalErr = System.err;
|
|
|
|
@BeforeEach
|
|
public final void setUpStreams() {
|
|
System.setOut(new PrintStream(outContent));
|
|
System.setErr(new PrintStream(errContent));
|
|
}
|
|
|
|
@AfterEach
|
|
public void restoreStreams() {
|
|
System.setOut(originalOut);
|
|
System.setErr(originalErr);
|
|
}
|
|
}
|