### Question:
FileUtils { public static String file2String(MultipartFile file) { StringBuilder strBuilder = new StringBuilder(); try (InputStreamReader inputStreamReader = new InputStreamReader(file.getInputStream(), StandardCharsets.UTF_8)) { BufferedReader streamReader = new BufferedReader(inputStreamReader); String inputStr; while ((inputStr = streamReader.readLine()) != null) { strBuilder.append(inputStr); } } catch (IOException e) { logger.error("file convert to string failed: {}", file.getName()); } return strBuilder.toString(); }  static void copyFile(MultipartFile file, String destFilename); static Resource file2Resource(String filename); static String file2String(MultipartFile file);  }### Answer:
@Test public void testFile2String() throws IOException { String content = "123"; org.apache.dolphinscheduler.common.utils.FileUtils.writeStringToFile(new File("/tmp/task.json"),content); File file = new File("/tmp/task.json"); FileInputStream fileInputStream = new FileInputStream("/tmp/task.json"); MultipartFile multipartFile = new MockMultipartFile(file.getName(), file.getName(), ContentType.APPLICATION_OCTET_STREAM.toString(), fileInputStream); String resultStr = FileUtils.file2String(multipartFile); Assert.assertEquals(content, resultStr); boolean delete = file.delete(); Assert.assertTrue(delete); }