小编Ale*_*yuk的帖子

代码覆盖最终阻止

我有以下代码构造:

try {
   //some code
}
catch(CustomException custExc) {
  //log
}
catch(CustomException2 custExc2) {
  //log
}
catch(Exception exc) {
  //log
}
finally {
  //some code
} 
Run Code Online (Sandbox Code Playgroud)

我编写了单元测试:第一个是在没有抛出异常时执行的情况(仅执行try块代码,最后是块代码),另外3个是其中哪个是一次覆盖每个catch块(执行try块,catch之一)阻止,最后阻止).问题是Eclipse Emma插件显示我没有覆盖finally块.任何想法为什么会发生?

java unit-testing emma try-catch

10
推荐指数
2
解决办法
6907
查看次数

标签 统计

emma ×1

java ×1

try-catch ×1

unit-testing ×1