Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ void testCleanUp_DeleteTempDirFails() throws IOException {

@Test
void testReadAllBytes_Normal() throws IOException {
byte[] expected = "Hello, World!".getBytes();
byte[] expected = "Hello, World!".getBytes(StandardCharsets.UTF_8);
try (InputStream is = new ByteArrayInputStream(expected)) {
byte[] result = Utils.readAllBytes(is);
assertThat(result).isEqualTo(expected);
Expand Down Expand Up @@ -908,7 +908,7 @@ void testReadAllBytes() throws Exception {
}
@Test
public void test_readAllBytes_Normal() throws IOException {
byte[] expectedBytes = "test data".getBytes();
byte[] expectedBytes = "test data".getBytes(StandardCharsets.UTF_8);
try (InputStream inputStream = new ByteArrayInputStream(expectedBytes)) {
byte[] result = Utils.readAllBytes(inputStream);
assertArrayEquals(expectedBytes, result);
Expand Down Expand Up @@ -1013,7 +1013,7 @@ void testCreateTempDirectory_Success() throws IOException {
@Test
void testConvertMultipartFileToFile_Success() throws IOException {
// 准备 MultipartFile(使用 Spring MockMultipartFile)
byte[] content = "Hello, World!".getBytes();
byte[] content = "Hello, World!".getBytes(StandardCharsets.UTF_8);
MultipartFile multipartFile = new MockMultipartFile(
"file", "test.txt", "text/plain", content);
List<File> createdFiles = new ArrayList<>();
Expand Down Expand Up @@ -1249,7 +1249,7 @@ void testUnzip_ZipWithOnlyDirectories() throws IOException {
@Test
void testUnzip_InvalidZipFile() throws IOException {
// 非法的 ZIP 数据(随机字节)
byte[] invalidZip = "this is not a zip file".getBytes();
byte[] invalidZip = "this is not a zip file".getBytes(StandardCharsets.UTF_8);
MultipartFile multipartFile = new MockMultipartFile("file", "bad.zip", "application/zip", invalidZip);

// 实际行为可能是抛出 IOException,也可能返回空列表(如果方法内部处理了异常)
Expand Down
Loading