Open hazendaz opened 9 years ago
Yes, jacoco has an issue with methods throwing exceptions: https://github.com/jacoco/eclemma/issues/61
But are you sure, that with catch-exception things are any better? I made test with fer and catch-exception and I can't see any difference. Jacoco doesn't report coverage in some situations either with cc or fer. For example:
public class Obj {
private String inner1() {
throw new RuntimeException();
}
private String inner2() {
return inner1();
}
public String outer() {
return inner2();
}
}
inner2 and outer will not be coveraged according to jacoco either with fer or cc. Can you show your example?
Anyway, I don't think that this lib should do something with this jacoco issue.
In the situations that I have, I always got coverage with catch-exception. My dislike there is only a reliance on a fast changing mockito these days. This (your) library doesn't have that specific issue. However, this might all be mute here soon as it appears assertj team is adding similar proxies to handle this. I'll keep this open for the time being until I can take a look at what they are doing. Might be useful anyways just mentioning that in case that is exactly what they are accomplishing. That library is pretty cool drop in replacement for hamcrest and it is growing pretty fast.
With catch-exception, I get code coverage on the test code completely. With this library, I lose that. I assume this is because the code under test that throws the exception is not wrapped as it is with catch-exception library. How hard would it be to add additional functionality to this library to resolve this issue? At the moment, this is the only real downside of switching to this library. The code otherwise feels more natural and still gives me a lot over bloated try catches. Thanks.