为 Select 语句创建测试类 [英] Creating a test class for a Select Statement
本文介绍了为 Select 语句创建测试类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道你是否可以帮助我.我正在努力为下面的代码创建一个测试类.任何帮助将不胜感激.
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.
非常感谢
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'
];
}
}
推荐答案
我很困惑开这门课的真正要求是什么.可能你已经发布了它的非常简短的版本.无论如何,您可以为此使用以下测试类(未经测试).
I'm confused what's the real requirement of having this class. May be you have posted very short version of it. Anyway you can use below test class(untested) for this.
@isTest
private class TestMatchReadyImage {
@isTest
static testMethod void testConstructor() {
Match_Day_Check_List__c mdckl = new Match_Day_Check_List__c()
mdckl.Name = 'Everton V West Ham United Goodison Park EPL 2013-05-12';
// populate if any other fields you need to
insert mdckl;
// make assertions for the unit test
System.assert((new MatchReadyImage()).obj != null);
}
}
这篇关于为 Select 语句创建测试类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文