+ Start a Discussion
Chandan Sagar 9Chandan Sagar 9 

Please help me to write test class for below Apex code

  public with sharing class MessageTemplatesCtrl {
   private MessageTemplatesCtrl() { /** controller class, non-constructable */ }

    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;

GreyGorilla VaporGreyGorilla Vapor
First You got a great blog. I will be interested in more similar topics. I see you got really very useful topics, I will be always checking your blog thanks.

Fcukin Flava