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
Parth SrivastavaParth Srivastava 

How can i cover list of getter in test class

public class ProjectDashboardClass {

Public List<Order__c> OrderList{
    get {
    return [Select id, Project__r.Project_Name__c,Actual_Production_Start_Date__c, Actual_Production_End_Date__c, Italian_Port_Arrival_Date__c, USA_Port_Arrival_Date__c, Marine_Broker_Arrival_Date__c, Cust_Delivery_Date__c, Name From Order__c];     
    }}
    
}

Please suggest as i am unable to get 100% code coverage
Steven NsubugaSteven Nsubuga
@isTest
public class ProjectDashboardClassTest {

 @isTest static void testGetter() {
    
    ProjectDashboardClass pdc = new ProjectDashboardClass();
	List<Order__c> orders = pdc.OrderList;
	System.assert(orders != null);
 }
}

 
Raj VakatiRaj Vakati
Try this 
 
@isTest
public class ProjectDashboardClassTest {

 @isTest static void testGetter() {
    Order__c order = new Order__c() ;
	order.Name ='Test' ;
	insert order ; 
	
    ProjectDashboardClass pdc = new ProjectDashboardClass();
	List<Order__c> orders = pdc.OrderList;
	System.assert(orders != null);
 }
}