public static long sizeOf(Path path) throws IOException {
    SizeVisitor visitor = new SizeVisitor();
    Files.walkFileTree(path, visitor);
    return visitor.size;
  }
@Test
  public void sizeOf_throws_IOE_if_path_does_not_exist() throws IOException {
    Path path = temporaryFolder.newFile().toPath();
    Files.delete(path);

    assertThatThrownBy(() -> FileUtils2.sizeOf(path))
      .isInstanceOf(IOException.class);
  }