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
Andrew Hoban 6Andrew Hoban 6 

Test Class that returns a SOQL Statement

Hi all,

I am having trouble creating a test class in the example below. I have never created a test class for a return SOQL Statement.

Any help would be appreciated. Thanks

My Class:
public class ITCheckList  {

public List<Match_Day_Check_List__c> getITCheckList(){
 
return [SELECT Handshake_Event_Setup__c, Access_Manager_Checks__c, Wifi_Setup__c, Ground_Catering_Till_Checks__c, Poll_Steward_System__c, Turnstile_Checks__c, 
                Press_Wifi_Checks__c, Set_Phone_Times_Fan_Centre__c, Check_Sodexo_Epos_Servers__c, IT_Systems_Readiness_PC__c, HR_Readiness_Percent__c, Stadium_Readiness_PC_1__c, 
                Steward_Comms_Checks_Complete_PC__c, Overall_Completion_Matchday__c,Lighting_to_all_areas_of_Sports_Ground__c, Fire_Alarm_System__c, Public_Address_System__c, CCTV_System__c,
                 Internal_External_Phone_System__c, Turnstile_Control_Counting_System__c, Door_Holding_Mechanism_System__c, Entry_Signage_Changed__c, H_S_Assessment_of_Broadcaster_Operation__c,
                 Set_Heating_Air_Con_in_Lounges__c, First_Aid_Room_Check__c FROM Match_Day_Check_LIst__c
                WHERE Name = 'Everton V West Ham United Goodison Park EPL 2013-05-12'];
    }
}

 
Best Answer chosen by Andrew Hoban 6
Anoop yadavAnoop yadav
Hi,

Try with the below code.
@isTest(seeAllData = true)
public class TestITCheckList{
	
	public static testMethod void testMethod(){
		Match_Day_Check_LIst__c mdc = new Match_Day_Check_LIst__c();
		mdc.Name = 'Everton V West Ham United Goodison Park EPL 2013-05-12';
		insert mdc;
		
		ITCheckList itc = new ITCheckList();
		itc.getITCheckList();	
	}
}