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
Jonathan Wolff 7Jonathan Wolff 7 

Help with test class for apex

Hello I need a test class for the following code, could you help me with it?
 
global class AutoHandler implements Auth.RegistrationHandler{
class RegHandlerException extends Exception {}
global User createUser(Id portalId, Auth.UserData data){
// authenticated users are found by the email in their authentication token
User u = new User();
String email= data.email;
List<User> userList = [Select Id, Name, Email, UserName From User Where (Email =: email) AND isActive = true ];
if(userList != null && userList.size() > 0) {
return userList.get(0);
} else {
throw new RegHandlerException('Cannot find user with email:'+ data.email);
}
}
global void updateUser(Id userId, Id portalId, Auth.UserData data){
// user profile data is updated from authentication token data
User u = new User(id=userId);
u.lastName = data.lastName;
u.firstName = data.firstName;
update(u);
}
}

Greetings,Jonathan
AbhinavAbhinav (Salesforce Developers) 
Check this:

https://salesforce.stackexchange.com/questions/244788/how-do-i-write-an-apex-unit-test

https://salesforce.stackexchange.com/questions/244794/how-do-i-increase-my-code-coverage-or-why-cant-i-cover-these-lines

Thanks!