test-class

Creating a test class for a Select Statement

*爱你&永不变心* 提交于 2019-12-04 06:20:40
问题 I was wondering if you could help me. I am strugging to create a test class for the code below. Any help would be appreciated. Many thanks public class MatchReadyImage { public Match_Day_Check_List__c obj {get; set; } public MatchReadyImage(){ obj = [ Select Id, Match_Day_Ready_Status__c From Match_Day_Check_List__c Where Name = 'Everton V West Ham United Goodison Park EPL 2013-05-12' ]; } } 回答1: You just need to create a test data which will be selected by your code, because the data from

Creating a test class for a Select Statement

无人久伴 提交于 2019-12-02 10:35:39
I was wondering if you could help me. I am strugging to create a test class for the code below. Any help would be appreciated. Many thanks public class MatchReadyImage { public Match_Day_Check_List__c obj {get; set; } public MatchReadyImage(){ obj = [ Select Id, Match_Day_Ready_Status__c From Match_Day_Check_List__c Where Name = 'Everton V West Ham United Goodison Park EPL 2013-05-12' ]; } } You just need to create a test data which will be selected by your code, because the data from Org is not available in test context. After that you have to instantiate MatchReadyImage class and validate