代码覆盖率错过了有关测试异常的说明

时间:2014-10-06 05:50:46

标签: java code-coverage

   @Test
   public void testNullPointerException() {
      thrown = false;
      IntList list = null;
      IntList sublist = new IntList(null);
      IntList newList = new IntList(2, 2, 4);
      try {
         actual = OrderedIntListUtility.replaceAll(list, sublist, newList);
      } catch(NullPointerException e) {
         thrown = true;
      }
   }

Java代码覆盖率告诉我在此特定测试中有一些错过的指令。我不知道这里错过的指示在哪里。请帮忙。谢谢。

1 个答案:

答案 0 :(得分:1)

来自eclemma文档 - http://www.eclemma.org/jacoco/trunk/doc/counters.html

Instructions (C0 Coverage) - The smallest unit JaCoCo counts are single Java byte code instructions. Instruction coverage   
provides information about the amount of code that has been executed or missed. This metric is 
completely independent from source formatting and always available, even in absence of debug 
information in the class files.