function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Chandan Sagar 9Chandan Sagar 9 

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;
    }

}
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