Exception finally块中异常的Junit覆盖率
我试图在finally块中模拟close方法。因此,例外情况也包含在覆盖范围内Exception finally块中异常的Junit覆盖率,exception,mockito,response,junit4,finally,Exception,Mockito,Response,Junit4,Finally,我试图在finally块中模拟close方法。因此,例外情况也包含在覆盖范围内 Respose response = null; ..... finally { try { response.close(); }catch (IOException exp) { System.out.println(exp); } } junit覆盖范围未涵盖SOP Respose response = null; ..... finally { try { respo
Respose response = null;
.....
finally {
try {
response.close();
}catch (IOException exp) {
System.out.println(exp);
}
}
junit覆盖范围未涵盖SOP
Respose response = null;
.....
finally {
try {
response.close();
}catch (IOException exp) {
System.out.println(exp);
}
}
单元测试代码段:
您的问题是不能模拟void方法吗?模拟void方法: