org.uberfire.java.nio.file.Files.isSameFile()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(110)

本文整理了Java中org.uberfire.java.nio.file.Files.isSameFile()方法的一些代码示例,展示了Files.isSameFile()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Files.isSameFile()方法的具体详情如下:
包路径:org.uberfire.java.nio.file.Files
类名称:Files
方法名:isSameFile

Files.isSameFile介绍

暂无

代码示例

代码示例来源:origin: kiegroup/appformer

@Override
public boolean isSameFile(final Path path,
             final Path path2)
    throws IllegalArgumentException, IOException, SecurityException {
  return Files.isSameFile(path,
              path2);
}

代码示例来源:origin: kiegroup/appformer

@Test
public void isSameFileNull3() {
  assertThatThrownBy(() -> Files.isSameFile(null, null))
      .isInstanceOf(IllegalArgumentException.class)
      .hasMessage("Parameter named 'path' should be not null!");
}

代码示例来源:origin: kiegroup/appformer

@Test
public void isSameFileNull1() {
  final Path path = Files.createTempFile("foo", "bar");
  assertThatThrownBy(() -> Files.isSameFile(path, null))
      .isInstanceOf(IllegalArgumentException.class)
      .hasMessage("Parameter named 'path2' should be not null!");
}

代码示例来源:origin: kiegroup/appformer

@Test
public void isSameFileNull2() {
  final Path path = Files.createTempFile("foo", "bar");
  assertThatThrownBy(() -> Files.isSameFile(null, path))
      .isInstanceOf(IllegalArgumentException.class)
      .hasMessage("Parameter named 'path' should be not null!");
}

代码示例来源:origin: kiegroup/appformer

@Test
public void isSameFile() {
  final Path path = Files.createTempFile("foo", "bar");
  assertThat(Files.isSameFile(path,
                Paths.get(path.toString()))).isTrue();
  assertThat(Files.isSameFile(path,
                Files.createTempFile("foo", "bar"))).isFalse();
  assertThat(Files.isSameFile(newTempDir(),
                newTempDir())).isFalse();
  final Path dir = newTempDir();
  assertThat(Files.isSameFile(dir,
                Paths.get(dir.toString()))).isTrue();
  assertThat(Files.isSameFile(Paths.get("/path/to/some/place"),
                Paths.get("/path/to/some/place"))).isTrue();
  assertThat(Files.isSameFile(Paths.get("/path/to/some/place"),
                Paths.get("/path/to/some/place/a"))).isFalse();
}

相关文章