fun <T : Path> Expect<T>.notToBeReadable(): Expect<T>
(source)
Expects that the subject of this
expectation (a Path) is not readable;
meaning that there is a file system entry at the location the Path points to and
that the current thread does not have the permission to read from it.
This assertion resolves symbolic links. Therefore, if a symbolic link exists at the location the subject points to, search will continue at the location the link points at.
This assertion is not atomic with respect to concurrent file system operations on the paths the assertion works on. Its result, in particular its extended explanations, may be wrong if such concurrent file system operations take place.
assertIf(ifPosixSupported) {
val writeOnlyPermissions =
PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("-w--w--w-"))
val readyWritePermissions =
PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rw-rw-rw-"))
val writeOnlyDir = tempDir.newDirectory("write_only_dir", writeOnlyPermissions)
val writeOnlyFile = tempDir.newFile("write_only_file", writeOnlyPermissions)
val readWriteDir = tempDir.newDirectory("read_write_dir", readyWritePermissions)
val readWriteFile = tempDir.newFile("read_write_file", readyWritePermissions)
expect(writeOnlyDir).notToBeReadable()
expect(writeOnlyFile).notToBeReadable()
fails {
expect(readWriteDir).notToBeReadable()
}
fails {
expect(readWriteFile).notToBeReadable()
}
fails {
expect(readWriteDir).notToBeReadable()
}
}
fails {
expect(Paths.get("non_existing_dir")).notToBeReadable()
}
Return
an Expect for the subject of this
expectation.
Since
0.17.0