Skip to content

Instantly share code, notes, and snippets.

@samuelteixeiras
Created September 23, 2021 14:03
Show Gist options
  • Save samuelteixeiras/c604e97d79de46f92c1d6349dd6af164 to your computer and use it in GitHub Desktop.
Save samuelteixeiras/c604e97d79de46f92c1d6349dd6af164 to your computer and use it in GitHub Desktop.
WeekOneExercisesTest3
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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment