From bc2352684ac2aef229726f35a8a70e22175522c7 Mon Sep 17 00:00:00 2001 From: Jonathan Cook Date: Thu, 13 Aug 2020 09:12:53 +0200 Subject: [PATCH] BAEL-4341 - Add AfterEach annotation instead of BeforeEach on tearDown method --- .../java/com/baeldung/systemout/SystemOutPrintlnUnitTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnUnitTest.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnUnitTest.java index 3ffc508fa5..549f0ee7b9 100644 --- a/testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnUnitTest.java +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnUnitTest.java @@ -4,6 +4,7 @@ import java.io.ByteArrayOutputStream; import java.io.PrintStream; import org.junit.Assert; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -19,7 +20,7 @@ class SystemOutPrintlnUnitTest { System.setOut(new PrintStream(outputStreamCaptor)); } - @BeforeEach + @AfterEach public void tearDown() { System.setOut(standardOut); }