I am getting this weird error while comparing Cron expressions but I am not sure what it is indicating.

System.AssertException: Assertion Failed: Expected: 0 0 12 1/1 12 ? 2022, Actual: 0 0 12 1/1 12 ? 2022

  • Bad unit test or extra space somewhere
    – kurunve
    Apr 21, 2017 at 8:13
  • Thanks, dude I figured it out. It was the extra space in starting off expression.
    – Ishan
    Apr 21, 2017 at 8:21
  • You shouldn't assert on the CRON string anyway... just remove this assertion entirely.
    – Adrian Larson
    Apr 21, 2017 at 10:58

1 Answer 1


When testing your scheduled jobs, asserting on the CRON string is going to far. You should just verify that the job got scheduled and leave it at that.

MySchedulable job = new MySchedulable();

    system.schedule('Job Name', cron, job);

system.assertEquals(1, [SELECT count() FROM CronTrigger], 'The job should be scheduled');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.