public static void writeStringToFile(File file, String data, String encoding) throws IOException {
        try (OutputStream os = new FileOutputStream(file)) {
            os.write(data.getBytes(encoding));
            os.flush();
        }
    }
@Test
    public void testWriteStringToFile() throws IOException {
        File tempFile = new File(tempDir.toFile(), "testWriteStringToFile.txt");
        String testString = "test string";
        IoUtil.writeStringToFile(tempFile, testString, "UTF-8");
        BufferedReader reader = new BufferedReader(new FileReader(tempFile));
        String fileContent = reader.readLine();
        reader.close();
        Assert.assertEquals(testString, fileContent);
    }