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
JimmyMacJimmyMac 

Test Method Which Uses Public Variable

Hi I am new to Apex, and  I need to create a Test  for a method that references a Public variable(ClientIdList) see below:

 

public Void getRb() {

List <laserapp3__Ben2__c> relatedBene = new List<laserapp3__Ben2__c> (

[
SELECT
name,
ownerid,
Policy_Number__c,
Insurance__c,
Financial_Account_Number__c,
laserapp3__Percentage__c,
laserapp3__Relationship__c,
laserapp3__First__c,
laserapp3__Last__c,
laserapp3__Account__c,
Financial_Account__c

FROM laserapp3__Ben2__c
where laserapp3__Account__c in :ClientIdList

order by Financial_Account_Number__c nulls last, Policy_Number__c
]
);
 
 Id myId;
 for (laserapp3__Ben2__c ar : relatedBene)
 {   
 
      myId = (Id)ar.get('laserapp3__Account__c');
      
     BeneMap.put(myId,getClientName(ar.laserapp3__Account__c));
 }
 
Rb = relatedBene;  
 
}

 

Can anyone please help me understand what the Test method should be to test this properly? THANKS!
 

Vinit_KumarVinit_Kumar

what is ClientIdList and Could you please post the whole code as how it is being used so that I can help.