From 34fd1271c988dd309161ca35622e7363241613a9 Mon Sep 17 00:00:00 2001 From: Sita Lakshmi Sangameswaran Date: Wed, 21 Dec 2022 02:08:54 +0530 Subject: [PATCH] Update SnippetsIT.java --- webrisk/src/test/java/webrisk/SnippetsIT.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/webrisk/src/test/java/webrisk/SnippetsIT.java b/webrisk/src/test/java/webrisk/SnippetsIT.java index 3b5bc310bfc..2d4d9252870 100644 --- a/webrisk/src/test/java/webrisk/SnippetsIT.java +++ b/webrisk/src/test/java/webrisk/SnippetsIT.java @@ -45,8 +45,7 @@ public class SnippetsIT { private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static ByteArrayOutputStream originalOut = new ByteArrayOutputStream(); - private static PrintStream printStream = new PrintStream(originalOut); + private final PrintStream originalOut = System.out; private ByteArrayOutputStream stdOut; @@ -59,7 +58,6 @@ public static void requireEnvVar(String envVarName) { @BeforeClass public static void setUp() throws IOException { - printStream.println(System.out); requireEnvVar("GOOGLE_APPLICATION_CREDENTIALS"); requireEnvVar("GOOGLE_CLOUD_PROJECT"); } @@ -72,8 +70,8 @@ public void beforeEach() { @After public void afterEach() { - stdOut = originalOut; - System.setOut(new PrintStream(originalOut)); + stdOut.reset(); + System.setOut(originalOut); } @Test