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
Priya MishraPriya Mishra 

Method is not getting cover in the test class

Hi All i need help for the below lines to cover in the test class can you please help me to cover the class.

   public void autoPopulateSrcAccount(){
        if(rih.Source_Inventory__c != null)
        {         
           MedConnect__Inventory_Header__c invh =[select id,MedConnect__Location__c from MedConnect__Inventory_Header__c where Id =: rih.Source_Inventory__c];
           rih.Source_Account__c = invh.MedConnect__Location__c;
        }       
     }
    public void autoPopulatedesAccount(){
         if(rih.Destination_Inventory__c != null)
        {
           MedConnect__Inventory_Header__c invh =[select id,MedConnect__Location__c from MedConnect__Inventory_Header__c where Id =: rih.Destination_Inventory__c];
           rih.Destination_Account__c = invh.MedConnect__Location__c; 
        }
    }


thanks in Advance.
AnkaiahAnkaiah (Salesforce Developers) 
Hi Priya,

insert the test data for MedConnect__Inventory_Header__c  object and call the class method in test class like classname.autoPopulateSrcAccount();

If this helps, Please mark it as best answer.

Thanks!!
Priya MishraPriya Mishra
Thanks for reply can you pls write some sample here.

 
dipen joedipen joe
Great Post! Thank you for visiting here. https://tractorsinfo.com/onshift-login/