You need to sign in to do that
Don't have an account?
JoshTonks
test class for a record count
Hi,
I am trying o do a record count on a specific criteria which i have working. However the issue I have is I dont know how to write a test class for it. Ive mainly worked with lists up until now which i can write a test class for. I have attached the apex class below would someone be able to give me some direction on what i need to put in the test class.
I am trying o do a record count on a specific criteria which i have working. However the issue I have is I dont know how to write a test class for it. Ive mainly worked with lists up until now which i can write a test class for. I have attached the apex class below would someone be able to give me some direction on what i need to put in the test class.
public class UnitCount { public Integer getC2630Counter(){ return [SELECT count() FROM Unit_Value__c WHERE Unit_Type__c =: 'LMU-2630' AND Stock_Status__c =: 'OFFICE' AND Account__c = '0010E00000DHfef' AND Status__c =: 'New Stock' ]; } }
use below test class for 100% coverge :
additional note : and try to avoid hard coded account id in SOQL query, which is not best coding practice.
Thanks, let us know if it helps you
All Answers
Hi,
Please let me know from where this class is called.
use below test class for 100% coverge :
additional note : and try to avoid hard coded account id in SOQL query, which is not best coding practice.
Thanks, let us know if it helps you