Created
June 25, 2019 10:55
-
-
Save conrjac/132a6732a688c4e86b3d8124283fc2e9 to your computer and use it in GitHub Desktop.
IdeaCommentTriggerHandlerTest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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