@isTest private class ConsumAutoCancelRequestBatchScheduleTest { static testMethod void testScheduler() { String FireTime = '0 0 0 3 9 ? 2099'; Test.startTest(); String jobId = system.schedule('ConsumAutoCancelRequestBatchScheduleTest', FireTime, new ConsumAutoCancelRequestBatchSchedule()); Test.stopTest(); CronTrigger ct = [SELECT Id, CronExpression, TimesTriggered, NextFireTime FROM CronTrigger WHERE id = :jobId]; // Verify the expressions are the same System.assertEquals(FireTime, ct.CronExpression); // Verify the job has not run System.assertEquals(0, ct.TimesTriggered); // Verify the next time the job will run System.assertEquals('2099-09-03 00:00:00', String.valueOf(ct.NextFireTime)); } }