Can you please help me to write a test class for the blow code:
public class retrieveOpenSafetyObservations {
private ApexPages.StandardSetController controller;
public List<Safety_Observation__c> getOutbaseSafetyObservations() {
return [SELECT Id, Name, Title__c, Priority__c, Risk_Factor_Ranking__c,Contractor__c,Status__c
FROM Safety_Observation__c WHERE Status__c = 'Open' order by id desc limit 10];
}}
here is what I have so far:
@isTest
public class testRetrieveOpenSafetyObservation{
static testMethod void testOpenSafetyOb(){
retrieveOpenSafetyObservations oso = new retrieveOpenSafetyObservations(
Safety_Observation__c SafObse = new Safety_Observation__c(
Basic_Risk_Factors__c ='Design',
Cause_Category__c = '1 Equipment and Material problems',
Cause_Code_Sub_Category__c = '3E other Human Error not specified here',
Contractor__c = 'a0fg0000000u09l',
Contributing_Factors__c = 'qwert',
Customer_Name__c = '001g0000007q9Z9',
Description__c = 'bla bla',
Human_Factor_Domain__c = 'Staffing Issue (Workload etc.)',
Human_Factors__c = 'Alarms',
Performance_Improvment_Factors__c = 'Organisational Change',
Priority__c = 'Low',
Risk_Factor_Ranking__c = '2',
SO_Number_Name__c = 'Test',
Status__c = 'Open',
Title__c = 'Test'
);
insert SafObse ; );
}
}