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
Atul Singh 87Atul Singh 87 

getting error in Test code Coverage

Hi All how do i write test class for this? I am getting error : "System.NullPointerException: Attempt to de-reference a null object" 
Code: 

public Boolean isExistingOktaUser(String UserEmail){
        Boolean isExistingUser=false;
        Boolean goAhead = true;
        userLoginAddress = '';
        if(ACN_Utilities.CheckNullOrEmpty(UserEmail)){
            goAhead = false;
        }
     
Nikhil SutharNikhil Suthar
"Attempt to de-reference a null object" term refers to there is no object initiated while you writing test class for above code..
Kindly initiate object using 'new' .
Example:
Contact con = new Contact();

 
Atul Singh 87Atul Singh 87
@Nikhil i have used this: 

 Btx_UserProvisionHelper test = new Btx_UserProvisionHelper();  
        List<User> UserEmail =[select Email from User Where Id= :usr.Id];
        Boolean isExitOktaUser = test.isExistingOktaUser(UserEmail[0].Email);