google/truth

FileSubject to test actual file methods

kostasdrakonakis opened this issue · 1 comments

Truth does not provide FileSubject class in order to test actual methods from File such as exists() or isDirectory(), e.t.c.

I believe that something like this should exist so we avoid currently doing something like this:

val jarDependencyDir = File(project.jarDir())
val artifact = File("$jarDependencyDir${File.separator}${artifactName()}")
assertThat(jarDependencyDir).isNotNull()
assert(jarDependencyDir.exists())
assert(jarDependencyDir.isDirectory)
assertThat(artifact).isNotNull()
assert(artifact.exists())
assert(artifact.isFile)

and replace it with this:

val jarDependencyDir = File(project.jarDir())
val artifact = File("$jarDependencyDir${File.separator}${artifactName()}")
assertThat(jarDependencyDir).isNotNull()
assertThat(jarDependencyDir).exists()
assertThat(jarDependencyDir).isDirectory()
assertThat(artifact).isNotNull()
assertThat(artifact).exists()
assertThat(artifact).isFile()

Thanks. We have some discussions about this underway, but it may take a few months before we complete them. Also, we may start with Path, leaving File for future consideration. You can follow #334 and #172 for updates.