FileUtils { public static void writeFile(String dataToWrite, File file) throws IOException { BufferedWriter bw = new BufferedWriter(new FileWriter(file)); bw.write(dataToWrite); bw.flush(); bw.close(); }  static String readFileAsString(File file); static void writeFile(String dataToWrite, File file);  }
@Test public void testWritingFile() { try { FileUtils.writeFile(TEST_DATA, FILE); if (FILE.exists()) FILE.delete(); } catch (IOException e) { e.printStackTrace(); } }