Skip to main content
Hi,

 

I have wrote an apex test class but not getting  code coverage.

 

Someone, guide me to write an test class.

 

public class TriggerHandlerOnEmployee {

 

public static boolean RecursionHandler = true;

 

public void detailOfEmployee(List<Employee__c> EList){

 

        List<String> emailList = new List<String>();

 

        List<User> userList=new List<User>();

 

    for(Employee__c empobj:Elist){

 

                emailList.add(empObj.Email_Id__c);

 

            }

 

            Map<String, User> m = new Map<String , User>();

 

            for(User usr : [Select FirstName, LastName, Phone, Email from User where Email IN:emailList]){

 

                    m.put(usr.Email, usr);

 

           }

 

            for(Employee__c em:Elist){

 

                User us = new User();

 

                us=m.get(em.Email_Id__c);

 

                us.Phone=em.Phone__c;

 

                us.FirstName=em.Name;

 

                us.LastName=em.Last_Name__c;

 

                us.Email=em.Email_Id__c;

 

                userList.add(us);

 

            }

 

        

 

        update userList;

 

    }

 

}

 

 
3 respuestas
0/9000