NOTE : This question is not duplicate.Please go through code once.
Here is the situation -
I am calling this method from my test class, and here My_obj__c
records are getting created and added in list, which list I insert later in "TRY
" block (so point is I am not able to generate an exception-by making list empty or something like that from test Class)
private boolean mymethod(){
My_obj__c obj = new My_obj__c(name='test');
List<My_obj__c> lst = new List<My_obj__c>();
lst.add(obj);
try{
insert lst;
}
catch(Exception e){
/////////// 15 lines code --- need to cover
}
}
Any Solution, suggestions, help. Please reply.
catch (DmlException e)
orcatch (Exception e)
?