+ Start a Discussion
sumit dsumit d 

Test class for session trigger helper

Hi All,
 I have a trigger and helper class. i want to write test class for it.
My helper class is given below:-
public without sharing class SessionTriggerHelper {
    public static List<Session__c> newSession = new List<Session__c>();
    public static List<Session__c> oldSession = new List<Session__c>(); 
    public static Map<Id, Session__c> newMapSession =new Map<Id, Session__c>();
    public static Map<Id, Session__c> oldMapSession =new Map<Id, Session__c>();
    public static boolean runTrigger = TRUE;
    public static void createWebinar(){
        for(Session__c ss : newSession){
            if(ss.rie__Zoom_URL__c == Null && ss.rie__Session_Status__c == 'Ready to Publish'){
                String zoomUserId = '';
                if(ss.rie__ZoomUserId__c != Null){
                   zoomUserId = ss.rie__ZoomUserId__c; 
                   zoomUserId = 'BhN6PRjkQW-iUc8-8-aTSw'; 
                Map<String, Object> reqMap = new Map<String, Object>();
                Map<String, Object> recurrenceMap = new Map<String, Object>();
                recurrenceMap.put('type' , 1);
                recurrenceMap.put('repeat_interval' , 1);
                recurrenceMap.put('end_date_time' , ss.rie__Session_End_Time__c);
                Map<String, Object> settingMap = new Map<String, Object>();
                settingMap.put('host_video' , 'true');
                settingMap.put('panelists_video' , 'true');
                settingMap.put('practice_session' , 'true');
                settingMap.put('hd_video' , 'true');
                settingMap.put('approval_type' , 0);
                settingMap.put('registration_type' , 2);
                settingMap.put('audio' , 'both');
                settingMap.put('auto_recording' , 'none');
                settingMap.put('enforce_login' , 'false');
                settingMap.put('close_registration' , 'true');
                settingMap.put('show_share_button' , 'true');
                settingMap.put('allow_multiple_devices' , 'false');
                settingMap.put('registrants_email_notification' , 'true');
                reqMap.put('topic', ss.Name);
                reqMap.put('type', 5);
                reqMap.put('start_time', ss.rie__Date_Time__c);
                reqMap.put('duration', '60');
                reqMap.put('timezone', 'America/Los_Angeles');
                reqMap.put('password', ss.rie__Meeting_Password__c);
                reqMap.put('agenda', 'Test Webinar');
                reqMap.put('settings', settingMap);
                String  reqBody = JSON.serialize(reqMap);
                ZoomService.createWebinar(reqBody, zoomUserId, ss.Id);
Can anyone help me with this test class? How to write test class for this helper?
AbhishekAbhishek (Salesforce Developers) 
Hi Sumit,

Try the suggestions as per the article,




Which might help you.