From 06c30264e58873ed21df5b05806807e8e25e1486 Mon Sep 17 00:00:00 2001 From: Albumen Kevin Date: Thu, 2 Jan 2025 09:47:22 +0800 Subject: [PATCH] Fix UnsafeByteArrayOutputStreamTest --- .../dubbo/common/io/UnsafeByteArrayOutputStreamTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeByteArrayOutputStreamTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeByteArrayOutputStreamTest.java index 6cb0be0f36f..107d66cdf62 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeByteArrayOutputStreamTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/io/UnsafeByteArrayOutputStreamTest.java @@ -19,6 +19,7 @@ import java.io.IOException; import java.io.OutputStream; import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -72,7 +73,7 @@ void testExtendLengthForBuffer() throws IOException { @Test void testToStringWithCharset() throws IOException { UnsafeByteArrayOutputStream outputStream = new UnsafeByteArrayOutputStream(); - outputStream.write("Hòa Bình".getBytes()); + outputStream.write("Hòa Bình".getBytes(StandardCharsets.UTF_8)); assertThat(outputStream.toString("UTF-8"), is("Hòa Bình")); }