Hi! I'm trying to mock the `<http://java.io|java.i...
# mockk
c
Hi! I'm trying to mock the
<http://java.io|java.io>.File.inputStream()
extension function, but the
FileInputStream
constructor still gets run.
Copy code
mockkStatic("<http://kotlin.io|kotlin.io>.FilesKt__FileReadWriteKt")
val fileInputStream = FileInputStream(realFileUri)
every { any<File>().inputStream() } returns fileInputStream
storage.readConfig() // calls file.inputStream()
The constructor of
FileInputStream
seems to think the mock operand is null and explicitly throws
NullPointerException
. Any ideas how best to resolve this?