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
Jasril Dane CaliwagJasril Dane Caliwag 

hi everyone please help me to make a test class on my class

here is my code:
 
global static String setExperienceId(String expId) {    
        // Return null if there is no error, else it will return the error message 
        try {
            if (expId != null) {
                Site.setExperienceId(expId);               
            }
            return null; 
        } catch (Exception ex) {
            return ex.getMessage();            
        }        
    }

 
Akshay_DhimanAkshay_Dhiman
Hi Jasril,

Please try the below test class:
 
@isTest
private class SetExpecive_test {
    static testMethod void isTest(){        
        test.startTest();
        SetExpeciveClass.setExperienceId('');
        test.stopTest();        
    } 
    static testMethod void isTest1(){
        
        test.startTest();
        SetExpeciveClass.setExperienceId(NULL);
        test.stopTest();
        
    } 
}


Please make it best if it helps you.

 

Thanks,
Akshay