Create FeedComment Record in Apex Test Class
Biswajeet
October 3, 2020 No Comments on Create FeedComment Record in Apex Test Class
Sample Code:
//Parent Record Account acc = new Account(Name = 'Test Account'); insert acc; //Create Related Feed Item Record FeedItem fi = new FeedItem(ParentId = acc.Id, Body = 'Test Body'); insert fi; //Create Feed Comment Record FeedComment fc = new FeedComment(FeedItemId = fi.Id, CommentBody = 'Test Comment'); insert fc; //Get Feed Comment Record FeedComment objFC = [Select Id, CommentBody, FeedItemId, ParentId FROM FeedComment LIMIT 1]; //Check Feed Comment Parent Id System.assertEquals(objFC.ParentId, acc.Id);