org.assertj.core.api.AbstractPathAssert.isAbsolute()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(63)

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

AbstractPathAssert.isAbsolute介绍

[英]Assert that the tested Path is absolute (the path does not have to exist).

Note that the fact that a path is absolute does not mean that it is Path#normalize(): /foo/.. is absolute, for instance, but it is not normalized.

Examples:

// unixFs is a Unix FileSystem 
// The following assertion succeeds: 
assertThat(unixFs.getPath("/foo/bar")).isAbsolute(); 
// The following assertion fails: 
assertThat(unixFs.getPath("foo/bar")).isAbsolute(); 
// windowsFs is a Windows FileSystem 
// The following assertion succeeds: 
assertThat(windowsFs.getPath("c:\\foo")).isAbsolute(); 
// The following assertions fail: 
assertThat(windowsFs.getPath("foo\\bar")).isAbsolute(); 
assertThat(windowsFs.getPath("c:foo")).isAbsolute(); 
assertThat(windowsFs.getPath("\\foo\\bar")).isAbsolute();

[中]断言测试路径是绝对路径(路径不必存在)。
请注意,路径是绝对的这一事实并不意味着它是路径#normalize():/foo/。。例如,它是绝对的,但不是标准化的。
示例:

// unixFs is a Unix FileSystem 
// The following assertion succeeds: 
assertThat(unixFs.getPath("/foo/bar")).isAbsolute(); 
// The following assertion fails: 
assertThat(unixFs.getPath("foo/bar")).isAbsolute(); 
// windowsFs is a Windows FileSystem 
// The following assertion succeeds: 
assertThat(windowsFs.getPath("c:\\foo")).isAbsolute(); 
// The following assertions fail: 
assertThat(windowsFs.getPath("foo\\bar")).isAbsolute(); 
assertThat(windowsFs.getPath("c:foo")).isAbsolute(); 
assertThat(windowsFs.getPath("\\foo\\bar")).isAbsolute();

代码示例

代码示例来源:origin: apache/geode

@Test
 public void returnedWriterHasAbsolutePathToBaselineDirectory() {
  Properties properties = new Properties();
  properties.setProperty(TYPE, FILE_SYSTEM.getType());
  properties.setProperty(TIMESTAMP, "yyyy-MM-dd-HH-mm-ss");
  properties.setProperty(TARGET_DIR, "targetDir");
  properties.setProperty(BASELINE_DIR, "baselineDir");

  BackupWriter writer = FILE_SYSTEM.createWriter(properties, "memberId");

  Path absoluteBaseLineDirectory = Paths.get("baselineDir").toAbsolutePath();
  assertThat(writer.getBaselineDirectory()).isAbsolute().isEqualTo(absoluteBaseLineDirectory);
 }
}

代码示例来源:origin: de.pfabulist.lindwurm/niotest

@Test
public void testKidsOfAbsoluteDirAreAbsolute() throws Exception {
  try( DirectoryStream<Path> kids = Files.newDirectoryStream( getNonEmptyDir() ) ) {
    for( Path kid : kids ) {
      assertThat( kid ).isAbsolute();
    }
  }
}

代码示例来源:origin: de.pfabulist.lindwurm/niotest

@Test
public void testToAbsoluteProducesAnAbsolutePath() throws Exception {
  assertThat( relABC().toAbsolutePath() ).isAbsolute();
}

代码示例来源:origin: de.pfabulist.lindwurm/niotest

@Test
public void testResolveOfAbsoluteIsAbsolute() throws Exception {
  assertThat( absAB().resolve( nameA() ) ).isAbsolute();
}

代码示例来源:origin: de.pfabulist.lindwurm/niotest

@Test
@Category( WorkingDirectoryInPlaygroundTree.class )
public void testToRealPathReturnsAnAbsolutePath() throws Exception {
  assertThat( relativize( getFile() ).toRealPath() ).isAbsolute();
}

代码示例来源:origin: de.pfabulist.lindwurm/niotest

@Test
public void testgetParentOfAbsoluteIsAbsolute() throws Exception {
  assertThat( childGetParent( absAB() ) ).isAbsolute();
}

代码示例来源:origin: de.pfabulist.lindwurm/niotest

@Test
public void testRootOfAbsolutePathIsAbsolute() throws Exception {
  assertThat( absAB().getRoot() ).isAbsolute();
}

相关文章