Skip to content

Instantly share code, notes, and snippets.

@conrjac
Created June 25, 2019 10:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conrjac/132a6732a688c4e86b3d8124283fc2e9 to your computer and use it in GitHub Desktop.
Save conrjac/132a6732a688c4e86b3d8124283fc2e9 to your computer and use it in GitHub Desktop.
IdeaCommentTriggerHandlerTest
@isTest
private class IdeaCommentTriggerHandlerTest {
@testSetup static void testDataGenerator() {
Idea i = new Idea();
i.Title = 'Test Idea';
i.Body = 'Test Idea Body';
i.CommunityId = [SELECT Id FROM Community LIMIT 1].id;
insert i;
}
static testMethod void testInsertandUpdateComment() {
Idea i = [Select Id, CommunityId FROM Idea WHERE Title = 'Test Idea'];
IdeaComment ic = new IdeaComment();
ic.IdeaId = i.id;
ic.CommentBody = 'A test comment';
insert ic;
ic.CommentBody = 'I changed my mind';
update ic;
List<IdeaComment> ics = [SELECT Id FROM IdeaComment WHERE IdeaId = :i.id];
System.assert(!ics.isEmpty());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment