the function I am testing,
class FileUtility {
companion object {
@JvmStatic
fun deleteFile(filePath: String) {
try {
val file = getFileObject(filePath)
file.delete()
} catch (ex :Exception) {
log.error("Exception while deleting the file", ex)
}
}
}
}
Unit test,
@Test
fun deleteFileTest() {
val filePath = "filePath"
val file = mockk<File>()
every { getFileObject(filePath) } returns file
deleteFile(filePath)
verify { file.delete() }
}
getting the following error on running this test case
io.mockk.MockKException: Missing calls inside every { ... } block.
is this any bug or am I writing wrong test case?