+ Start a Discussion
sk3501.3915272120779841E12sk3501.3915272120779841E12 

Test class

Hi i would like to create test class for this class please let me know how to create test class for this class.

global class BatchHelperForMigrationData{
    global BatchHelperForMigrationData(){
    }
    global BatchHelperForMigrationData(AsyncApexJob a, String cls){
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        String[] toAddresses = new String[] {a.Createdby.Email};
        mail.setToAddresses(toAddresses);
        mail.setSubject('Record Transefer Status: '+a.status);
        mail.setPlainTextBody('The Batch Apex job processed for '+cls + ' Total Success '+a.TotalJobItems +
            ' batches with '+a.NumberOfErrors + ' failures. ');
        Messaging.sendEmail(New Messaging.SingleEmailMessage[] {mail});    
    }
}
PratikPratik (Salesforce Developers) 
Hi,

You can refer to the code sample:
https://developer.salesforce.com/page/Code_Sample_-_Testing_Email_Services_with_Inbound_Attachments

Thanks,
Pratik