mbonnin
01/07/2024, 2:51 PMshouldBeAFile()
passes on missing files?
// This seems to pass
"nonExistent".toPath().shouldBeAFile()
There is also shouldExist()
but I find this surprising that shouldBeAFile()
doesn't check for existence of the fileLeoColman
01/07/2024, 3:06 PMmbonnin
01/07/2024, 3:21 PMLeoColman
01/07/2024, 3:23 PMfun aFile(): Matcher<Path> = object : Matcher<Path> {
override fun test(value: Path): MatcherResult = MatcherResult(
!Files.isDirectory(value),
{ "File $value should be a directory" },
{ "File $value should not be a directory" })
}
mbonnin
01/07/2024, 3:24 PMPath.isRegularFile()
, maybe it's just a matter of using this one?LeoColman
01/07/2024, 3:35 PM