### Question:
ParseFileUtils { public static void writeStringToFile(File file, String string, Charset encoding) throws IOException { writeByteArrayToFile(file, string.getBytes(encoding)); }  static byte[] readFileToByteArray(File file); static FileInputStream openInputStream(File file); static void writeByteArrayToFile(File file, byte[] data); static FileOutputStream openOutputStream(File file); static void moveFile(final File srcFile, final File destFile); static void copyFile(final File srcFile, final File destFile); static void copyFile(final File srcFile, final File destFile,
                              final boolean preserveFileDate); static void deleteDirectory(final File directory); static boolean deleteQuietly(final File file); static void cleanDirectory(final File directory); static void forceDelete(final File file); static boolean isSymlink(final File file); static String readFileToString(File file, Charset encoding); static String readFileToString(File file, String encoding); static void writeStringToFile(File file, String string, Charset encoding); static void writeStringToFile(File file, String string, String encoding); static JSONObject readFileToJSONObject(File file); static void writeJSONObjectToFile(File file, JSONObject json); static final long ONE_KB; static final long ONE_MB; }### Answer:
@Test public void testWriteStringToFile() throws Exception { File file = temporaryFolder.newFile("file.txt"); ParseFileUtils.writeStringToFile(file, TEST_STRING, "UTF-8"); InputStream in = null; String content = null; try { in = new FileInputStream(file); ByteArrayOutputStream out = new ByteArrayOutputStream(); ParseIOUtils.copy(in, out); content = new String(out.toByteArray(), "UTF-8"); } finally { ParseIOUtils.closeQuietly(in); } assertEquals(TEST_STRING, content); }