Coverage reports are supposed to be reviewed by human beings. Core code has to have 100% coverage (maybe excluding crazy exceptions). Getters and setters don't need to be covered at all.
The funny part of clover is that it is too damn "clever" it will think that you miss the coverage if you have code like below but only test the "if" branch (coverage) if (true) { doSomething(); } It will be complaining that you miss testing "if(false)" even you want to do nothing.
m*t
4 楼
Are you sure? I thought if (true) would always get optimized away these days.
do
【在 s******e 的大作中提到】 : The funny part of clover is that it is too damn "clever" : it will think that you miss the coverage if you have code like below but : only test the "if" branch (coverage) : if (true) : { : doSomething(); : } : It will be complaining that you miss testing "if(false)" even you want to do : nothing.
s*e
5 楼
I really did not mean the literal value "true" when I said if(true). I meant something evaluated to be true. If your question is about the evaluated expression. Yes I am sure.
Q*g
6 楼
nothing special here. line coverage vs branch coverage
do
【在 s******e 的大作中提到】 : The funny part of clover is that it is too damn "clever" : it will think that you miss the coverage if you have code like below but : only test the "if" branch (coverage) : if (true) : { : doSomething(); : } : It will be complaining that you miss testing "if(false)" even you want to do : nothing.
s*e
7 楼
well you will feel it "very special" if you have a team policy of 100% coverage, and for the case where you need to mockito many, many things to test the nonexisting branch.
m*t
8 楼
Well... no... if it's a branch that really could go either way, then you gotta test both. I agree that it can be painful, compounded by a 100% coverage policy, but it doesn't sound reasonable to blame the tool for reporting it.
【在 s******e 的大作中提到】 : well you will feel it "very special" if you have a team policy of 100% : coverage, and for the case where you need to mockito many, many things to : test the nonexisting branch.