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
Bharat Seth 12Bharat Seth 12 

Need Help with Test Class Asap

Can anyone help me write Test Class for below Apex Class.

public class CheckSalesTeam {
    public static boolean IsSalesTeam=false;
    public static Boolean profileApprover(){
        List<Profile> profileList = New List<Profile>([SELECT Name FROM PROFILE WHERE Id = :UserInfo.getProfileId() LIMIT 1]);
        if(profileList[0].Name !='Sales Approver')
            IsSalesTeam=True; 
        
        return  IsSalesTeam;
    }
    
}
Best Answer chosen by Bharat Seth 12
Prakhar Saxena 19Prakhar Saxena 19
Hi Bharat,

Since you are not passing any parameter in the method, you can simply call the method in Test class like this:
 
@isTest
public class CheckSalesTeamTest {
    @isTest
    static void testProfileApprover(){
        CheckSalesTeam.profileApprover();
    }
}