声纳 - 分支覆盖问题是因为JUnit4中的预期?

时间:2015-03-17 10:53:42

标签: sonarqube sonarqube-5.0

我有一个JUnit 4测试,它检查我正在测试的代码是否抛出异常。测试如下:

@Test(expected = AmqpRejectAndDontRequeueException.class)
    public void getChannelKeysThrowsAmqpRejectAndDontRequeueExceptionIfProcessIdIsMissing() {
    processNameBasedRouter.getChannelKeys(new GenericMessage<Object>(new Machine()));
}

在SonarQube中出现了一个问题,因为没有覆盖分支。在我看来,这个分支是覆盖的,如果我在IntelliJ中运行测试,我得到100%的覆盖率。我认为这是因为JUnit4中的预期异常检查还是有其他原因吗?

enter image description here

0 个答案:

没有答案