You need to sign in to do that
Don't have an account?
Darshana
How to cover Catch block in my test class ?
It covers try block just by calling this method in my testClass but how can i cover my catch block?
public static Boolean funcName(CustObj__c obj){
//refId will be null
try{
CusObj2__c msg = className.fun(id,string);
msg.field1 = '1234';
insert msg;
return true;
}catch(Exception Ex){
throw new InvalidDataException('error msg');
}
return false;
}
public static Boolean funcName(CustObj__c obj){
//refId will be null
try{
CusObj2__c msg = className.fun(id,string);
msg.field1 = '1234';
insert msg;
return true;
}catch(Exception Ex){
throw new InvalidDataException('error msg');
}
return false;
}
OR try simply