NCMBLocalFile { static JSONObject readFile(File readFile) throws NCMBException { checkNCMBContext(); JSONObject json = new JSONObject(); try { BufferedReader br = new BufferedReader(new FileReader(readFile)); String information = br.readLine(); if (information == null) { return json; } br.close(); json = new JSONObject(information); } catch (IOException | JSONException | NullPointerException e) { throw new NCMBException(e); } return json; }    }
@Test public void readFile() throws Exception { String jsonString = "{\"key\":\"value\"}"; File file = NCMBLocalFile.create("Test"); NCMBLocalFile.writeFile(file, new JSONObject(jsonString)); Assert.assertEquals(jsonString, NCMBLocalFile.readFile(file).toString()); }