The problem statement is
A method that has a zero fault that you can write a test suite to that has 100% statement coverage but doesn't find the fault and another test suite that has 100% branch coverage that does reveal the fault?
Here is the method I wrote for the same
public faultyMethod1(int x, int y) {
int X =x;
int Y = y;
if (Y !=0){
Z = X/Y;
} else {
System.out.println("Sorry. That's an DiviDeByZeroException");
}
}
faultyMethod1 (1,2);
faultyMethod1 (2,0);
The above code to achieve test suite that has 100% branch coverage that does reveal the fault"
What about test suite to that has 100% statement coverage but doesn't find the fault ?
See Question&Answers more detail:os