You need to sign in to do that
Don't have an account?
Kristiana Granger
Test class - How to cover method which returns list of records from metadata,
Here is code
public static List<RetentionPlan__mdt> fetchAllData() {
List<RetentionPlan__mdt> dataList = [Select id, Order__c ,
Retain__c, Limit__c,
SobjectAPIName__c , SobjectAPIName__r.QualifiedApiName,
Where__c
FROM RetentionPlan__mdt
WHERE isActive__c = true];
return dataList;
}
public static void operationDataStorageReduction(List<sobject> scope) {
Database.delete(scope, false);
}
---------------------------
So basicaly these two methods get call from batch class, (Delete records) Can any one guide me how to write testclass for these 2
public static List<RetentionPlan__mdt> fetchAllData() {
List<RetentionPlan__mdt> dataList = [Select id, Order__c ,
Retain__c, Limit__c,
SobjectAPIName__c , SobjectAPIName__r.QualifiedApiName,
Where__c
FROM RetentionPlan__mdt
WHERE isActive__c = true];
return dataList;
}
public static void operationDataStorageReduction(List<sobject> scope) {
Database.delete(scope, false);
}
---------------------------
So basicaly these two methods get call from batch class, (Delete records) Can any one guide me how to write testclass for these 2
Try this code.
Hope this helps you
Let me know if this helps you. Kindly mark it as solved so that it may help others in future.
Thanks and Regards