本文整理了Java中org.assertj.core.api.AbstractFileAssert.canRead()
方法的一些代码示例,展示了AbstractFileAssert.canRead()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractFileAssert.canRead()
方法的具体详情如下:
包路径:org.assertj.core.api.AbstractFileAssert
类名称: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));
}
内容来源于网络,如有侵权,请联系作者删除!