에 대한 테스트 클래스 저는 Apex Development에서 새로 왔습니다. 내 Apex 트리거에 대한 TestClass를 작성하고 싶습니다.Apex의 테스트 클래스
당신과 함께 내 코드를 공유하고있다 :
trigger ClosedOpportunityTrigger on Opportunity (before update) {
for(Opportunity o:Trigger.New) {
if(o.Probability==100 && o.Invoiced__c == true)
{
Attachment a = new Attachment();
try {
a = [Select Id, Name from Attachment where ParentId =:o.Id];
}
catch(Exception e) {
a = null;
}
if (a == null)
o.addError('Add an attachment before you close the Opportunity');
}
}
}
안녕하세요, Tim, 오류가 발생했습니다 : "오류 : 컴파일 오류 : 예기치 않은 토큰 'void'. 행 2 열 15 \t" –
감사합니다. 정말 많이 변경되었습니다. 괜찮습니다. –
논리가있는 의사 코드가 더 많았습니다. 그것의 뒤에, 나는 또한 당신이 당신의 방아쇠에있는 당신의 catch 블록이 잘못되었다고 말하면서 마지막에 나의 노트를 보았기를 바랍니다. –