You need to sign in to do that
Don't have an account?
Austin Henson
New to Salesforce Development and need help writing a test class for this Apex Class
Hi all I am new to the Salesforce development side and am wondering how to create a test class for the below Apex Class I have written. I understand I need to create test data in the test class, but I am not sure how to test out the last part of this class which is calling another Apex Class from a managed package that exports Contact records to a 3rd platform. Any help and guidance would be much appreciated.
global class ExportBackgroundCheckCompleteToGolden { @InvocableMethod(label='Export Background Check Completed Volunteers To Golden' description='Exports contacts who have completed their background check with Sterling Volunteers to Golden' category='Contact') public static List<Contact> BackgroundCheckCompleteToGolden(List<Contact> contacts) { List<Contact> exported = new List<Contact>(); if ((contacts == null) || (contacts.size() == 0)) { System.debug('No contacts'); return exported; } else { System.debug('There are ' + contacts.size() + ' contacts.'); } for (Contact contact: contacts) { if ((contact != null) && (contact.VVSA__VV_Status__c == 'Eligible')) { exported.add(contact); } } if (exported.size() > 0) { goldenapp.ExportToGoldenBatch.runSyncJob(exported, 'Background Check Completed'); } return exported; } }
All Answers