public static boolean deleteFileOrDirectory(File f) throws IOException {
    if (f.exists()) {
      if (f.isDirectory()) {
        File[] children = f.listFiles();
        if (children == null) {
          throw new IOException("Error listing files of the directory " + f.getAbsolutePath());
        }
        for (File c : children) {
          deleteFileOrDirectory(c);
        }
      }
      if (!f.delete()) {
        throw new IOException("Failed to delete file: " + f);
      }
      return true;
    } else {
      return false;
    }
  }
Set the registry as {@code toSet} ensure that this is the one that is returned by {@link #getMetricRegistry()}
@param toSet the metric registry to set to.
ambry-test-utils/src/main/java/com/github/ambry/clustermap/MockClusterMap.java