@Test public void deleteFile() throws Exception { assertEquals(4, Files.walk(testFolder).count()); Files .walk(testFolder) .filter(path -> "foo".equals(path.getFileName().toString())) .forEach(FileSystemUtils.deleteFile()); assertEquals(3, Files.walk(testFolder).count()); }
static Consumer<Path> deleteFile() { return pathFile -> { try { Files.delete(pathFile); } catch (IOException e) { throw new TDPException(UNABLE_TO_REMOVE_FOLDER_ENTRY, e, build().put("path", pathFile)); } }; }
FileSystemUtils { static Consumer<Path> deleteFile() { return pathFile -> { try { Files.delete(pathFile); } catch (IOException e) { throw new TDPException(UNABLE_TO_REMOVE_FOLDER_ENTRY, e, build().put("path", pathFile)); } }; } }
FileSystemUtils { static Consumer<Path> deleteFile() { return pathFile -> { try { Files.delete(pathFile); } catch (IOException e) { throw new TDPException(UNABLE_TO_REMOVE_FOLDER_ENTRY, e, build().put("path", pathFile)); } }; } private  FileSystemUtils(); }
FileSystemUtils { static Consumer<Path> deleteFile() { return pathFile -> { try { Files.delete(pathFile); } catch (IOException e) { throw new TDPException(UNABLE_TO_REMOVE_FOLDER_ENTRY, e, build().put("path", pathFile)); } }; } private  FileSystemUtils(); static String toId(FolderPath folderPath); static FolderPath fromId(String id); }
FileSystemUtils { static Consumer<Path> deleteFile() { return pathFile -> { try { Files.delete(pathFile); } catch (IOException e) { throw new TDPException(UNABLE_TO_REMOVE_FOLDER_ENTRY, e, build().put("path", pathFile)); } }; } private  FileSystemUtils(); static String toId(FolderPath folderPath); static FolderPath fromId(String id);  }