You need to sign in to do that
Don't have an account?
Internal Partner
BatchSize must not be null: Error by testing a Batch Scheduler test class
Hi all,
I have the following Scheduler apex class:
Where CS_Example__c is a custom setting with the following custom field:
Batch_Limit__c --> Number (18,0)
When testing the test calls I get the following error:
I could not correct this so far. Can someone advise me what exactly is not letting run the test successfully so I can correct it?.
I have the following Scheduler apex class:
public class Example_Scheduler implements Schedulable { public void execute(SchedulableContext sc){ Example_Batch batch1 = new Example_Batch(); Database.executebatch(batch1,batch1.lim); } }and the following corresponding test class:
@isTest public class Example_Scheduler_Test { static testMethod void testMethod1() { insert new CS_Example__c(Batch_limit__c = 100, Name = 'Test'); Test.StartTest(); Example_Scheduler sh1 = new Example_Scheduler(); String sch = '0 0 20 * * ?'; system.schedule('Test check', sch, sh1); Test.stopTest(); } }
Where CS_Example__c is a custom setting with the following custom field:
Batch_Limit__c --> Number (18,0)
When testing the test calls I get the following error:
System.InvalidParameterValueException: batchSize must not be null. StackTrace: Class.Example_Scheduler.execute: line 5, column 1
I could not correct this so far. Can someone advise me what exactly is not letting run the test successfully so I can correct it?.
Test class
And in test class you need to insert CS_Example__c custom settings objects