You need to sign in to do that
Don't have an account?
Jonathan Wolff 7
Help with test class for apex
Hello I need a test class for the following code, could you help me with it?
Greetings,Jonathan
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
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!