You need to sign in to do that
Don't have an account?
Streepie24
Testmethod for else-if constructions
if(a==1){ ... } else if(a==2){ ... } else if(a==3){ ... }
How to test such a construction in a testmethod ?
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
if(a==1){ ... } else if(a==2){ ... } else if(a==3){ ... }
How to test such a construction in a testmethod ?
we need to test each case individually to get 100% code coverage.
For example if we have method calculateA(Integer a) in a class SampleClass. And the method has a logic like:
if(a==1){
...
}
else if(a==2){
...
}
else if(a==3){
...
In the TestMethod we should have like:
SampleClass sc = new SampleClass();
sc.calculateA(1);
sc.calculateA(2);
sc.calculateA(3);
.....
hope it helps