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
Krishna Sahu 1Krishna Sahu 1 

Please help to write test class on after update trigger

 public static void mapBirthdayFieldsOnEducationSession(map<Id,Lead> newLeadMap, map<Id,Lead> oldLeadMap){
        map<Id,Lead> newConvertedIdMap = new map<Id,Lead>();
        for(Lead listLead : newLeadMap.values()){
            if(listLead.isConverted && listLead.ConvertedAccountId !=null && listLead.HealthCloudGA__BirthDate__c !=null){
                newConvertedIdMap.put(listLead.ConvertedAccountId,listLead );
            } 
        }
        if(!newConvertedIdMap.isEmpty()){
            List<Account> listAccount = [SELECT Id , PersonBirthdate FROM Account WHERE Id IN : newConvertedIdMap.keySet()];
            for(Account account : listAccount){
                Account.PersonBirthdate = newConvertedIdMap.get(account.Id).HealthCloudGA__BirthDate__c;
            }
            update listAccount ;
        }
    }
CharuDuttCharuDutt
Hii Krishna
Try Below Code
@isTest
public class leadTriggerTesClass{
	@isTest
    public static void testLeadConv() {  
          
        Lead objLead = new Lead( FirstName = 'Test', 
                                 LastName = 'Sample', 
                                 Company = 'Testing Sample Co',
                                 HealthCloudGA__BirthDate__c=system.today() );  
        insert objLead;  
          
        Database.LeadConvert lc = new database.LeadConvert();  
        lc.setLeadId( objLead.Id );  
        lc.setDoNotCreateOpportunity( true );  
        lc.setConvertedStatus( 'Closed - Converted' );  
          
        Database.LeadConvertResult lcr = Database.convertLead(lc, false);  
          
        system.debug( 'Errors are ' + lcr.getErrors() );  
          
        system.assert( lcr.isSuccess() );  
          
    }  
}
Please Mark It As best Answer If It Helps
Thank You!
Krishna Sahu 1Krishna Sahu 1
Hi Charu
Your code is not working
AnkaiahAnkaiah (Salesforce Developers) 
Hi Krishna,

Refer the below link.
https://developer.salesforce.com/forums/?id=9060G000000I6VnQAK

Thanks!!