@@ -816,7 +816,7 @@ void testCleanUp_DeleteTempDirFails() throws IOException {
816816
817817 @ Test
818818 void testReadAllBytes_Normal () throws IOException {
819- byte [] expected = "Hello, World!" .getBytes ();
819+ byte [] expected = "Hello, World!" .getBytes (StandardCharsets . UTF_8 );
820820 try (InputStream is = new ByteArrayInputStream (expected )) {
821821 byte [] result = Utils .readAllBytes (is );
822822 assertThat (result ).isEqualTo (expected );
@@ -908,7 +908,7 @@ void testReadAllBytes() throws Exception {
908908 }
909909 @ Test
910910 public void test_readAllBytes_Normal () throws IOException {
911- byte [] expectedBytes = "test data" .getBytes ();
911+ byte [] expectedBytes = "test data" .getBytes (StandardCharsets . UTF_8 );
912912 try (InputStream inputStream = new ByteArrayInputStream (expectedBytes )) {
913913 byte [] result = Utils .readAllBytes (inputStream );
914914 assertArrayEquals (expectedBytes , result );
@@ -1013,7 +1013,7 @@ void testCreateTempDirectory_Success() throws IOException {
10131013 @ Test
10141014 void testConvertMultipartFileToFile_Success () throws IOException {
10151015 // 准备 MultipartFile(使用 Spring MockMultipartFile)
1016- byte [] content = "Hello, World!" .getBytes ();
1016+ byte [] content = "Hello, World!" .getBytes (StandardCharsets . UTF_8 );
10171017 MultipartFile multipartFile = new MockMultipartFile (
10181018 "file" , "test.txt" , "text/plain" , content );
10191019 List <File > createdFiles = new ArrayList <>();
@@ -1249,7 +1249,7 @@ void testUnzip_ZipWithOnlyDirectories() throws IOException {
12491249 @ Test
12501250 void testUnzip_InvalidZipFile () throws IOException {
12511251 // 非法的 ZIP 数据(随机字节)
1252- byte [] invalidZip = "this is not a zip file" .getBytes ();
1252+ byte [] invalidZip = "this is not a zip file" .getBytes (StandardCharsets . UTF_8 );
12531253 MultipartFile multipartFile = new MockMultipartFile ("file" , "bad.zip" , "application/zip" , invalidZip );
12541254
12551255 // 实际行为可能是抛出 IOException,也可能返回空列表(如果方法内部处理了异常)
0 commit comments