Mockk Kotlin 中的分支覆盖

Branches coverage in Mockk Kotlin

我在 Kotlin 中使用 mockk 库。我正在报道分支机构。我是测试新手。有人能告诉我如何覆盖所有分支吗?在下面给出的示例中,它有两个对象,一个是 id 为 string,另一个是隐藏的名称是 list。谢谢

谁能解释一下 12 个分支 是干什么用的?

我只能数到 9,但我可能漏掉了一些东西:

!id.isNullOrEmpty() Reason !xxx.isNullOrEmpty() Reason
TRUE id is not null and not empty TRUE xxx is not null and not empty
TRUE id is not null and not empty FALSE xxx is empty
TRUE id is not null and not empty FALSE xxx is null
FALSE id is null TRUE xxx is not null and not empty
FALSE id is empty TRUE xxx is not null and not empty
FALSE id is null FALSE xxx is null
FALSE id is null FALSE xxx is empty
FALSE id is empty FALSE xxx is null
FALSE id is empty FALSE xxx is empty