I am trying to test some file related logic in an Android unit test, but whenever I call file.exists() it always returns false for some reason. Here is a boiled down example of a test case I have:
@Test
fun `some test case`() {
val file = File("/storage/emulated/0/Photo1234.jpg")
assertTrue(file.exists()) // Fails
}
}
Does anybody know what I'm doing wrong? I've also tried file.absoluteFile.exists() but that returns false also.
I figured it out. I was not calling
file.createNewFile().