You need to sign in to do that
Don't have an account?
Abhishek Singh 88
test class for catch block
Hi Developers,
I have written test class but it is not covering catch block.
APex class is here.
RF_Exception_Util is a class and createException is a static method. from here we are storing exception in some custom object.
Any suggestion will be appriciated.
I have written test class but it is not covering catch block.
APex class is here.
try { history.Status__c='success'; history.Description__c=myPlainText; //if(newIncident !=null) history.Incident__c=newIncident.ID; if(user != null && user.size() > 0) history.account__c=user[0].BMCServiceDesk__Account_Name__c; //emailhistory.add(history); insert history; } catch(Exception ex){ myPlainText = ''; RF_Exception_Util.createException('McKesson','handleInboundEmail','McKessonNewIncidentCreation',ex.getMessage(),null); }
RF_Exception_Util is a class and createException is a static method. from here we are storing exception in some custom object.
Any suggestion will be appriciated.
Please create a data so that it will throw an error while inserting "HISTORY" record.
if Possible please provide the required field and exception class you have written to help you more on this.
Thanks,
Gaurav
Here is exception class, i have written
Hi Abhishek,
We need to figure out how we can fail a record to insert in History object, so that it will throw an exception.
For eg: if this is an custom object for Email History, please do not populate parentId field and mark this field as required. Then it will throw error.
Thanks,
Gaurav
if the issue is resolved, please close it.
Thanks,
Gaurav