I'm having issues returning values in a Custom setting (Type = List) when I'm instantiating a batch class, and I'm not sure why.
I'm doing an upsert in my test class and confirming via system debug that the values are inserted.
//Create Custom Setting
RoundRobinAssignments__c RoundRobin = new RoundRobinAssignments__c(
Name = 'Master', OpportunityNonPackageLeads__c = 5,
OpportunityPackageLead__c =10);
upsert RoundRobin;
List <RoundRobinAssignments__c> thresholdTEST = [SELECT id,OpportunityPackageLead__c,
OpportunityNonPackageLeads__c
FROM RoundRobinAssignments__c];
System.debug('thresholdTEST: '+ thresholdTEST);
In my batch class, I've written the below (I've tried the select statement that has been commented out too)
//List <RoundRobinAssignments__c> threshold = [SELECT id,OpportunityPackageLead__c,OpportunityNonPackageLeads__c FROM RoundRobinAssignments__c];
RoundRobinAssignments__c threshold = RoundRobinAssignments__c.getValues('Master');
System.debug('threshold: '+ threshold);
Thoughts?
update from comments:
Result: 23:08:14:286 USER_DEBUG [81]|DEBUG|allData: {}
Calling Batch Class:
//execute the batch
Test.startTest();
Database.executeBatch(new BatchOpportunityOwnerAssignment());
Test.stopTest();
Map<String, RoundRobinAssignments__c> allData = RoundRobinAssignments__c.getAll(); system.debug('allData: ' + allData);
and can you post more of the unit test class to show how the batch class is being called?