我在我的组织中有一个 CaseComment 对象的触发器,其中只有一行代码来调用另一个顶点类的静态方法。但是触发器的覆盖率为 0%。我编写了一个测试类来获得覆盖率,但它根本不起作用。谁能告诉我为什么它没有覆盖触发器以及如何覆盖它?提前致谢。
触发代码是
trigger CaseCommentTrigger on CaseComment (after Insert) {
CaseCommentTriggerUtil.notifyCaseRequestorAndCreator(Trigger.New);
}
我的测试课是
@isTest
public with sharing class CaseCommentTriggerTest {
@isTest
public static void createCaseComment() {
Case tCase = new Case();
tCase.Status = 'New';
tCase.Description = 'Test Description';
tCase.Origin = 'Email';
tCase.Priority = 'Low';
INSERT tCase;
CaseComment tComment = new CaseComment();
tComment.ParentId = tCase.Id;
tComment.CommentBody = 'Some Comment';
tComment.IsPublished = TRUE;
INSERT tComment;
}
}