You need to sign in to do that
Don't have an account?

Please help me to write test class for below Apex code
public with sharing class MessageTemplatesCtrl {
@TestVisible
private MessageTemplatesCtrl() { /** controller class, non-constructable */ }
@AuraEnabled(cacheable=true)
public static List<QuickText> getQuickTextTemplates(List<String> folderNames, List<String> categories){
// null checks
if(folderNames == null || folderNames.size() == 0)
throw new AuraHandledException('folderNames argument may not be null or an empty array');
List<QuickText> templates = (List<QuickText>) Database.query(
'SELECT FIELDS(Standard) FROM QuickText WHERE Folder.DeveloperName IN :folderNames' +
((categories == null || categories.size() == 0) ? '' : ' AND Category IN :categories')
);
return templates;
}
}
@TestVisible
private MessageTemplatesCtrl() { /** controller class, non-constructable */ }
@AuraEnabled(cacheable=true)
public static List<QuickText> getQuickTextTemplates(List<String> folderNames, List<String> categories){
// null checks
if(folderNames == null || folderNames.size() == 0)
throw new AuraHandledException('folderNames argument may not be null or an empty array');
List<QuickText> templates = (List<QuickText>) Database.query(
'SELECT FIELDS(Standard) FROM QuickText WHERE Folder.DeveloperName IN :folderNames' +
((categories == null || categories.size() == 0) ? '' : ' AND Category IN :categories')
);
return templates;
}
}
Fcukin Flava