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

x33g5p2x  于11个月前 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(35)

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

AbstractFileAssert.canRead介绍

[英]Verifies that the actual File can be read by the application.

Example:

File tmpFile = File.createTempFile("tmp", "txt"); 
File tmpDir = Files.createTempDirectory("tmp").toFile(); 
// assertions will pass 
assertThat(tmpFile).canRead(); 
assertThat(tmpDir).canRead(); 
tmpFile.setReadable(false); 
tmpDir.setReadable(false); 
// assertions will fail 
assertThat(tmpFile).canRead(); 
assertThat(tmpDir).canRead();

[中]验证应用程序是否可以读取实际文件。
例子:

File tmpFile = File.createTempFile("tmp", "txt"); 
File tmpDir = Files.createTempDirectory("tmp").toFile(); 
// assertions will pass 
assertThat(tmpFile).canRead(); 
assertThat(tmpDir).canRead(); 
tmpFile.setReadable(false); 
tmpDir.setReadable(false); 
// assertions will fail 
assertThat(tmpFile).canRead(); 
assertThat(tmpDir).canRead();

代码示例

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

private void loadExpectedDataSerializables() throws Exception {
 this.expectedDataSerializablesFile = getResourceAsFile("sanctionedDataSerializables.txt");
 assertThat(this.expectedDataSerializablesFile).exists().canRead();
 this.expectedDataSerializables =
   CompiledClassUtils.loadClassesAndMethods(this.expectedDataSerializablesFile);
}

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

public void loadExpectedSerializables() throws Exception {
 this.expectedSerializablesFile =
   getResourceAsFile(getModuleClass(), expectedSerializablesFileName);
 assertThat(this.expectedSerializablesFile).exists().canRead();
 this.expectedSerializables =
   CompiledClassUtils.loadClassesAndVariables(this.expectedSerializablesFile);
}

代码示例来源:origin: neo4j/neo4j-ogm

@Test
public void testAutoIndexDumpCreatesIndex() throws IOException {
  File file = File.createTempFile("test", ".cql");
  file.deleteOnExit();
  Configuration configuration = getBaseConfiguration()
    .autoIndex("dump")
    .generatedIndexesOutputDir(file.getParent())
    .generatedIndexesOutputFilename(file.getName())
    .build();
  sessionFactory.runAutoIndexManager(configuration);
  assertThat(file).exists().canRead();
  assertThat(contentOf(file))
    .contains(Arrays.stream(expectedIndexDefinitions).map(d -> "CREATE " + d).toArray(String[]::new));
}

相关文章