@Test public void testCase() throws Exception { configure(); Exception thrown = null; try { CollectionFileWriter.write(fileName, content); } catch (Exception e) { thrown = e; } verify(thrown); }
public static void write(String fileName, Collection<? extends Object> entries) { if (fileName == null) { throw new IllegalArgumentException("Must specify a file name to write to"); } PrintWriter writer = null; File file = new File(fileName); try { file.mkdirs(); if (file.exists()) { file.delete(); } writer = new PrintWriter(new FileWriter(file), true); for (Object entry : entries) { writer.println(String.valueOf(entry)); } } catch (Exception e) { throw new RuntimeException("Problem writing to " + file.getAbsolutePath(), e); } finally { try { if(writer != null) { writer.close(); } } catch (Exception e) { } } }
CollectionFileWriter { public static void write(String fileName, Collection<? extends Object> entries) { if (fileName == null) { throw new IllegalArgumentException("Must specify a file name to write to"); } PrintWriter writer = null; File file = new File(fileName); try { file.mkdirs(); if (file.exists()) { file.delete(); } writer = new PrintWriter(new FileWriter(file), true); for (Object entry : entries) { writer.println(String.valueOf(entry)); } } catch (Exception e) { throw new RuntimeException("Problem writing to " + file.getAbsolutePath(), e); } finally { try { if(writer != null) { writer.close(); } } catch (Exception e) { } } } }
CollectionFileWriter { public static void write(String fileName, Collection<? extends Object> entries) { if (fileName == null) { throw new IllegalArgumentException("Must specify a file name to write to"); } PrintWriter writer = null; File file = new File(fileName); try { file.mkdirs(); if (file.exists()) { file.delete(); } writer = new PrintWriter(new FileWriter(file), true); for (Object entry : entries) { writer.println(String.valueOf(entry)); } } catch (Exception e) { throw new RuntimeException("Problem writing to " + file.getAbsolutePath(), e); } finally { try { if(writer != null) { writer.close(); } } catch (Exception e) { } } }  }
CollectionFileWriter { public static void write(String fileName, Collection<? extends Object> entries) { if (fileName == null) { throw new IllegalArgumentException("Must specify a file name to write to"); } PrintWriter writer = null; File file = new File(fileName); try { file.mkdirs(); if (file.exists()) { file.delete(); } writer = new PrintWriter(new FileWriter(file), true); for (Object entry : entries) { writer.println(String.valueOf(entry)); } } catch (Exception e) { throw new RuntimeException("Problem writing to " + file.getAbsolutePath(), e); } finally { try { if(writer != null) { writer.close(); } } catch (Exception e) { } } }  static void write(String fileName, Collection<? extends Object> entries); }
CollectionFileWriter { public static void write(String fileName, Collection<? extends Object> entries) { if (fileName == null) { throw new IllegalArgumentException("Must specify a file name to write to"); } PrintWriter writer = null; File file = new File(fileName); try { file.mkdirs(); if (file.exists()) { file.delete(); } writer = new PrintWriter(new FileWriter(file), true); for (Object entry : entries) { writer.println(String.valueOf(entry)); } } catch (Exception e) { throw new RuntimeException("Problem writing to " + file.getAbsolutePath(), e); } finally { try { if(writer != null) { writer.close(); } } catch (Exception e) { } } }  static void write(String fileName, Collection<? extends Object> entries);  }