@isTest public class AssetPowerBIScheduleTest { static testMethod void Test01() { // This test runs a scheduled job at midnight Sept. 3rd. 2022 String CRON_EXP = '0 0 0 3 9 ? 2022'; SS_Batch_Column_Mapping__c oppMapping = new SS_Batch_Column_Mapping__c(Name = 'asset', SS_TableName__c = 'asset_Power_BI__c'); oppMapping.From_Column_001__c = 'Name'; oppMapping.SS_Column_001__c = 'Name'; insert oppMapping; System.Test.startTest(); // Schedule the test job String jobId = system.schedule('AssetPowerBISchedule', CRON_EXP, new AssetPowerBISchedule()); // Get the information from the CronTrigger API object CronTrigger ct = [SELECT Id, CronExpression, TimesTriggered, NextFireTime FROM CronTrigger WHERE id = :jobId]; // Verify the expressions are the same System.assertEquals(CRON_EXP, ct.CronExpression); // Verify the job has not run System.assertEquals(0, ct.TimesTriggered); // Verify the next time the job will run System.assertEquals('2022-09-03 00:00:00', String.valueOf(ct.NextFireTime)); System.Test.stopTest(); } }