I have run EclEmma for coverage on my JUnit Test Cases and have reached up to 100% on some. However, on the ones that are 82% or 95% covered, there is a message next to my code that says "1 of 2 branches missed" and I can't seem to solve this issue.
After looking over my classes, I noticed that this message only appears next to my if-statements, and that is what's keeping my tests from being 100% covered.
I guess I'm asking if anyone knows how to test an if-statement in JUnit, so that neither branch is missed.
This is the code I'm trying to test:
private double height;
public void setHeight(double height){
if(height <=0){
this.height = 0;
}
else{
this.height = height;
}
}//method close
( I am using JUnit 4 )