i am new to kotlin, junit5 and mockk. i am writing unit test cases for a function which belongs to companion object of a class. how to write unit test cases for this.
class CommonUtility {
companion object {
@Throws(SecurityException::class)
fun initializeFilePath(filePath: String) {
val directory = File(filePath)
if (!directory.exists()) {
try {
directory.mkdir()
} catch (ex: SecurityException) {
throw SecurityException("$filePath was not created in system", ex)
}
log.info("Created the directory $filePath")
}
}
}
}
can anyone give me one example of unit test that can be written for this function.