@isTest private class LogAutoSendScheduleProductTest { @isTest static void test_LogAutoSendScheduleProduct() { Datetime addOneM = System.now().addMinutes(2); String CRON_EXP = '0 ' + addOneM.minute() + ' ' + addOneM.hour() + ' ' + addOneM.day() + ' ' + addOneM.month() + ' ? ' + addOneM.year(); LogAutoSendScheduleProduct.assignOneMinute(); CronTrigger oldcron = [select Id, CronJobDetail.Name from CronTrigger where CronExpression = :CRON_EXP and CronJobDetail.Name like 'LogAutoSendProduct%']; // Verify the next time the job will run System.assertEquals('LogAutoSendProduct' + CRON_EXP, oldcron.CronJobDetail.Name); } }