class FakeFile(val path: String) {
def exists(): Boolean = {
if (path.endsWith(".zip")) {
return true
} else {
return true
}
}
def delete(): Unit = {}
}
/**
* Unit tests can run without a full Play application.
*/
class FileSystemSpec extends PlaySpec {
"zipTaskIfNotExist" should {
"return true without errors" in {
val fs = new FileSystem {
override val File = FakeFile
}
val result = fs.zipTaskIfNotExist("github", "hello", "zz")
result must equal(true)
}
}
}
}
[error] /home/jason/Desktop/stormwind.io/test/unit/services/FileSystemSpec.scala:53:31: not found: value FakeFile
[error] override val File = FakeFile
[error] ^
[error] one error found
AccessDeniedError
means you don't have permission to write to that folder. This is not coming from better-file but from the JDK std lib itself (in the case of I/O from the OS itself)
.store
to specify the compression method for an individual ZIP file entry, and set it to STORED.
cannonicalFile
is expressed like this:
def canonicalFile: File =
toJava.getCanonicalFile.toScala