NCMBLocalFile { static void writeFile(File writeFile, JSONObject fileData) throws NCMBException { checkNCMBContext(); try { FileOutputStream out = new FileOutputStream(writeFile); out.write(fileData.toString().getBytes("UTF-8")); out.close(); } catch (IOException e) { throw new NCMBException(e); } }    }
@Test public void writeFile() throws Exception { String jsonString = "{\"key\":\"value\"}"; File file = NCMBLocalFile.create("Test"); Assert.assertFalse(file.exists()); NCMBLocalFile.writeFile(file, new JSONObject(jsonString)); Assert.assertTrue(file.exists()); }