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")); }