You need to sign in to do that
Don't have an account?
Andrew Fisher 28
help with test class please!_
Can anyone help me with a Test class for this code please ?
Apex Class
public class OpptyCloseTimerCntrl {
@AuraEnabled
public static Date fetchOpptyCloseDate(String recId){
Opportunity opp = [select End_of_Quarter__c from Opportunity where id =: recId];
system.debug('Close Date: ' +opp.End_of_Quarter__c);
return opp.End_of_Quarter__c;
}
}
Apex Class
public class OpptyCloseTimerCntrl {
@AuraEnabled
public static Date fetchOpptyCloseDate(String recId){
Opportunity opp = [select End_of_Quarter__c from Opportunity where id =: recId];
system.debug('Close Date: ' +opp.End_of_Quarter__c);
return opp.End_of_Quarter__c;
}
}
Try Below Test Class Please Mark It As Mark it As Best Answer If It Helps
Thank You!
All Answers
Try Below Test Class Please Mark It As Mark it As Best Answer If It Helps
Thank You!
Your a superstar many thanks !
I made a slight amend to it as the End of Quarter is a formula field, but you got me on the right track !
@isTest
public Class OpptyCloseTimerCntrlTest{
@isTest
public static void UnitTest(){
Opportunity opp = new opportunity();
Opp.Name = 'Test Opp';
Opp.StageName = 'Closed Won';
Opp.CloseDate = System.TOday();
insert opp;
OpptyCloseTimerCntrl.fetchOpptyCloseDate(opp.Id);
}
}
Thanks so much, now 100% Coverage :)