【发布时间】:2015-04-10 05:18:17
【问题描述】:
给定代码:
public void foo(int age,boolean smart) {
if (age>18 && smart) { // <--- This is the part that should be covered
doSomething()
}
}
使用 JUnit 我测试 foo(15,true) 和 foo(25,true)
IntelliJ 将报告条件行已完全覆盖(绿色),但它没有。
在使用 Jacoco 的 Eclipse 中,该行被正确标记为部分覆盖,并且条件为黄色。
IntelliJ 有没有办法在条件级别提供覆盖?
【问题讨论】:
标签: unit-testing intellij-idea junit code-coverage jacoco