private void deleteAllFiles(File dir) {
    assertDirectoryIsValid(dir);

    try {
      Files.walk(dir.toPath())
          .filter(path -> !path.equals(dir.toPath()))
          .forEach(path -> {
        try {
          Files.delete(path);
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      });
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
Deletes all files in the given directory.
@param dir the directory to delete files from.
ambry-file-transfer/src/test/java/com/github/ambry/filetransfer/handler/StoreFileCopyHandlerIntegTest.java