Activity Forums Salesforce® Discussions Why the statement "System.assertEquals(0, lt.size(), 'Tasks exist before job has run');" is used in test schedule class?

  • Anurag

    Member
    September 4, 2018 at 1:30 pm

    Hi Shradha,

    It simply compares the the expected value (in this case '0') with the actual value (in this case 'lt.size') and throws an error which is ‘Tasks exist before job has run' in case it is false. Actually it is verifying that the scheduled job has not run yet before the task.

     

  • shariq

    Member
    September 19, 2018 at 12:07 am

    Hi,

    Main use of this is to unit test the data, that is the actual data to correct data. If not then it throws and errosr which can be custom as well as standard.

    Hope this helps.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos