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
sfdc_danesfdc_dane 

Test Coverage Help

Any idea how to get a 100% testcov of this get set method?

 

    public List<Job_Offer__c> jobOfferList
    {
        get{
        jobOfferList = [Column1, Column2, Column3
                        From Job_Offer__c
                        Where Job__c =: jobId And (Status__c = 'Rejected' Or Status__c = 'Timed Out')
                        ORDER BY CreatedDate];
                       
        return jobOfferList;
       
        }
        set;
    }

Best Answer chosen by Admin (Salesforce Developers) 
UVUV

Try this way-

static testmethod void test()

{

ABC obj=new ABC();

List<Job_Offer__c> templist=obj.jobofferlist;

}

All Answers

UVUV

Set and Get the value of jobOfferList in your test class and it will give you 100% code coverage.

sfdc_danesfdc_dane

Sorry.. can u give me an example? thx

UVUV

Try this way-

static testmethod void test()

{

ABC obj=new ABC();

List<Job_Offer__c> templist=obj.jobofferlist;

}

This was selected as the best answer
sfdc_danesfdc_dane

Hi UV,

 

Awesome!! It works perfectly!! thx for the help! =D