public static void checkPathExists(Path path, String argName) {
    checkNotNull(path, argName);
    checkArgument(Files.exists(path), "Path %s (%s) does not exist.", argName,
        path);
  }
@Test
  public void testCheckPathExists() throws Exception {
    Path tempFile = Files.createTempFile("foo", "bar");
    Path tempDir = tempFile.getParent();
    Path notFound = Paths.get("<not-found>");

    // Should not throw.
    Validate.checkPathExists(tempFile, "tempFile");
    Validate.checkPathExists(tempDir, "tempDir");

    // Verify it throws.

    intercept(IllegalArgumentException.class, "'nullArg' must not be null",
        () -> Validate.checkPathExists(null, "nullArg"));

    intercept(IllegalArgumentException.class,
        "Path notFound (<not-found>) does not exist",
        () -> Validate.checkPathExists(notFound, "notFound"));

    intercept(IllegalArgumentException.class, "must point to a directory",
        () -> Validate.checkPathExistsAsDir(tempFile, "tempFile"));

    intercept(IllegalArgumentException.class, "must point to a file",
        () -> Validate.checkPathExistsAsFile(tempDir, "tempDir"));

  }