From 3348d8e62d8d1f1a9bffef914fb2ff0de9f72f67 Mon Sep 17 00:00:00 2001 From: Sualeh Fatehi Date: Sun, 23 Apr 2023 12:16:42 -0400 Subject: [PATCH] Fix capture of System streams --- .../test/utility/CaptureSystemStreamsExtension.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/schemacrawler-api/src/test/java/schemacrawler/test/utility/CaptureSystemStreamsExtension.java b/schemacrawler-api/src/test/java/schemacrawler/test/utility/CaptureSystemStreamsExtension.java index a146e5bbca..958c630828 100644 --- a/schemacrawler-api/src/test/java/schemacrawler/test/utility/CaptureSystemStreamsExtension.java +++ b/schemacrawler-api/src/test/java/schemacrawler/test/utility/CaptureSystemStreamsExtension.java @@ -29,13 +29,12 @@ package schemacrawler.test.utility; import static org.junit.jupiter.api.Assertions.fail; - import java.io.FileDescriptor; import java.io.FileOutputStream; import java.io.PrintStream; import java.lang.reflect.Parameter; import java.nio.charset.Charset; - +import java.nio.charset.StandardCharsets; import org.junit.jupiter.api.extension.AfterTestExecutionCallback; import org.junit.jupiter.api.extension.BeforeTestExecutionCallback; import org.junit.jupiter.api.extension.ExtensionContext; @@ -47,6 +46,7 @@ final class CaptureSystemStreamsExtension implements ParameterResolver, BeforeTestExecutionCallback, AfterTestExecutionCallback { private static final String DEFAULT_CHARSET = Charset.defaultCharset().name(); + private static final String UTF_8_CHARSET = StandardCharsets.UTF_8.toString(); private TestOutputStream err; private TestOutputStream out; @@ -75,10 +75,10 @@ public void beforeTestExecution(final ExtensionContext context) throws Exception err = new TestOutputStream(); System.out.flush(); - System.setOut(new PrintStream(out, true, DEFAULT_CHARSET)); + System.setOut(new PrintStream(out, true, UTF_8_CHARSET)); System.err.flush(); - System.setErr(new PrintStream(err, true, DEFAULT_CHARSET)); + System.setErr(new PrintStream(err, true, UTF_8_CHARSET)); } @Override