@isTest
|
private class AssetUseInfoScheduleTest {
|
|
@isTest
|
static void test_method_one() {
|
String CRON_EXP = '0 0 0 3 9 ? 2032';
|
|
System.Test.startTest();
|
// Schedule the test job
|
String jobId = system.schedule('AssetUseInfoScheduleTest', CRON_EXP, new AssetUseInfoSchedule());
|
// 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('2032-09-03 00:00:00', String.valueOf(ct.NextFireTime));
|
}
|
|
@isTest
|
static void test_checkDate() {
|
Date d331 = date.newInstance(2020, 3, 31);
|
Date d630 = date.newInstance(2020, 6, 30);
|
Date d930 = date.newInstance(2020, 09, 30);
|
Date d1231 = date.newInstance(2020, 12, 31);
|
Date d1130 = date.newInstance(2020, 11, 30);
|
|
AssetUseInfoSchedule controller = new AssetUseInfoSchedule();
|
controller.checkDate(d331);
|
controller.checkDate(d630);
|
controller.checkDate(d930);
|
controller.checkDate(d1231);
|
controller.checkDate(d1130);
|
|
}
|
|
}
|