@Test public void testWriteToFile() { File fileToWrite = createDummyFile(); String fileContent = "content"; fileManager.writeToFile(fileToWrite, fileContent); assertThat(fileToWrite.exists(), is(true)); }
public void writeToFile(File file, String fileContent) { if (!file.exists()) { try { FileWriter writer = new FileWriter(file); writer.write(fileContent); writer.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { } } }
FileManager { public void writeToFile(File file, String fileContent) { if (!file.exists()) { try { FileWriter writer = new FileWriter(file); writer.write(fileContent); writer.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { } } } }
FileManager { public void writeToFile(File file, String fileContent) { if (!file.exists()) { try { FileWriter writer = new FileWriter(file); writer.write(fileContent); writer.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { } } }  }
FileManager { public void writeToFile(File file, String fileContent) { if (!file.exists()) { try { FileWriter writer = new FileWriter(file); writer.write(fileContent); writer.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { } } }  void writeToFile(File file, String fileContent); String readFileContent(File file); boolean exists(File file); void clearDirectory(File directory); void writeToPreferences(Context context, String preferenceFileName, String key,
      long value); long getFromPreferences(Context context, String preferenceFileName, String key); }
FileManager { public void writeToFile(File file, String fileContent) { if (!file.exists()) { try { FileWriter writer = new FileWriter(file); writer.write(fileContent); writer.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { } } }  void writeToFile(File file, String fileContent); String readFileContent(File file); boolean exists(File file); void clearDirectory(File directory); void writeToPreferences(Context context, String preferenceFileName, String key,
      long value); long getFromPreferences(Context context, String preferenceFileName, String key);  }