try{
//do something
if(Test.isRunningTest())
Integer i = 9/0;
}catch(Exception e){
// something here
}
This way try/cach blovk would get covered in one shot.
Other not so easy way is to design your data/queries in a way that try block executes in some cases while it fails in other cases, that way try/catch blocks would get covered.
Mark this as Best Answer, if this helps solve your problem.
This way try/cach blovk would get covered in one shot.
Other not so easy way is to design your data/queries in a way that try block executes in some cases while it fails in other cases, that way try/catch blocks would get covered.
Mark this as Best Answer, if this helps solve your problem.