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
PARISE RAVIKIRANPARISE RAVIKIRAN 

System.AssertException: Assertion Failed: Expected: true, Actual: false Class.LeadTriggerUtilityTest.updateDuplicateLeadsForScoreAndOptOutInsTest: line 1596, column 1

@isTest
    static void updateDuplicateLeadsForScoreAndOptOutInsTest(){
        User elqIntUser = [Select Id from User where username = :Label.Eloqua_Integration_User_Name limit 1];
        
        Test.startTest();
        System.runAs(elqIntUser) {
            Lead sfdcLead6 = CreateLead('John', 'Lead 3', OptInOptOutScore, 'Docusign', 'United States');
            sfdcLead6.Enagement_Score__c = 10;
            sfdcLead6.Profile_Score__c = 5;
            sfdcLead6.Hard_Opt_In__c = true;
            LeadTriggerControl.executeAfterUpdate = true;
            Database.DMLOptions dml3 = new Database.DMLOptions();
            dml3.DuplicateRuleHeader.AllowSave = true;
            Database.SaveResult sr3 = Database.insert(sfdcLead6, dml3);
        }
        Test.stopTest();

        Lead[] leads = GetLeadsByEmail(OptInOptOutScore);
        System.assertEquals(3, leads.size(), leads.size());

        for (Lead l : leads) {
            system.assertEquals(true, l.Hard_Opt_In__c);
            system.assertEquals(10, l.Enagement_Score__c);
            system.assertEquals(5, l.Profile_Score__c);

        }
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Parise,

You are getting the value of Hard_Opt_In__c as False. But in the assert statement you are expecting the vallue as  True. Can you check if the assert is correct ?

Let me know if you face any issues.

If this solution helps, Please mark it as best answer.

Thanks,