FastFileUtility extends FileUtility { public static void closeQuietly(Channel channel) { try { if (channel != null) { channel.close(); } } catch (IOException e) { } }  static void copyFile(String srcFile, String newFile); static void closeQuietly(Channel channel); static void closeQuietly(FileInputStream stream); static void closeQuietly(FileOutputStream stream);  }
@Test public void testCloseQuietly001() throws Exception { Channel channel = new Channel() { public void close() throws IOException { } public boolean isOpen() { return false; } }; FastFileUtility.closeQuietly(channel); }
@Test public void testCloseQuietly002() throws Exception { Channel channel = new Channel() { public void close() throws IOException { throw new IOException(); } public boolean isOpen() { return false; } }; FastFileUtility.closeQuietly(channel); }
@Test public void testCloseQuietly011() throws Exception { URL srcUrl = this.getClass().getResource("/testdata/test01.txt"); FileInputStream channel = new FileInputStream(srcUrl.getPath()); FastFileUtility.closeQuietly(channel); }
@Test public void testCloseQuietly012() throws Exception { URL srcUrl = this.getClass().getResource("/testdata/test01.txt"); FileInputStream channel = new FileInputStream(srcUrl.getPath()) { @Override public void close() throws IOException { throw new IOException(); } }; FastFileUtility.closeQuietly(channel); }
@Test public void testCloseQuietly021() throws Exception { URL srcUrl = this.getClass().getResource("/testdata/test01.txt"); String srcFile = srcUrl.getPath(); String newFile = srcFile.replaceAll("01", "01A"); File newFileCheck = new File(newFile); if (newFileCheck.exists()) { newFileCheck.delete(); } FileOutputStream channel = new FileOutputStream(newFile); FastFileUtility.closeQuietly(channel); }
@Test public void testCloseQuietly022() throws Exception { URL srcUrl = this.getClass().getResource("/testdata/test01.txt"); String srcFile = srcUrl.getPath(); String newFile = srcFile.replaceAll("01", "01A"); File newFileCheck = new File(newFile); if (newFileCheck.exists()) { newFileCheck.delete(); } FileOutputStream channel = new FileOutputStream(newFile) { @Override public void close() throws IOException { throw new IOException(); } }; FastFileUtility.closeQuietly(channel); }