dave08
06/10/2018, 5:37 PMresolve
extension from Kotlin stdlib on a File? I tried this, but it still seems to call the Kotlin code:
fun mockFile() = mockk<File>().apply {
every { resolve(any<File>()) } answers { mockk<File>(relaxed = true).apply {
every { path } returns "this.txt"
} }
}
// Gives
path must not be null
java.lang.IllegalStateException: path must not be null
at kotlin.io.FilesKt__FilePathComponentsKt.isRooted(FilePathComponents.kt:81)
at kotlin.io.FilesKt__UtilsKt.resolve(Utils.kt:400)
ghedeon
06/10/2018, 5:38 PMoleksiyp
06/10/2018, 9:10 PMmockkStatic("kotlin.io.FilesKt__UtilsKt")
val file = File("abc")
every {
file.resolve("def")
} returns File("ghi")
println(File("abc").resolve("def"))