Apex Specialist - Challenge 6

Test Scheduling logic

Hi Rangers ,

Great going !!! Time to move forward with step 5,

1. Apex Class

  • Go to Developer Console >>> File >>> Open >>> Apex Class 

  • Click on WarehouseSyncScheduleTest class >>> Open

A template of the apex class will be opened, write your code there-
public class WarehouseSyncScheduleTest {
    @isTest static void WarehousescheduleTest(){
        String scheduleTime = '00 00 01 * * ?';
        Test.setMock(HttpCalloutMock.class, new WarehouseCalloutServiceMock());
        String jobID=System.schedule('Warehouse Time To Schedule to Test',
scheduleTime, new WarehouseSyncSchedule());
        //Contains schedule information for a scheduled job. CronTrigger is similar
to a cron job on UNIX systems.
        // This object is available in API version 17.0 and later.
        CronTrigger a=[SELECT Id FROM CronTrigger where NextFireTime > today];
        System.assertEquals(jobID, a.Id,'Schedule ');

Save it

Run Test

Finally we are ready to verify the challenge !!! Congrats, rangers for completing the Apex specialist superbadge.

Hope you enjoyed it.

Happy Trailblazing!!!!!


Popular posts from this blog

Release Management - I

Creating Fields in bulk