Sample Test Class:
@isTest
private class CollaborationGroupFeedTest {
static testMethod void test() {
CollaborationGroup cg = new CollaborationGroup(Name = ‘Test’, CollaborationType = ‘Public’);
insert cg;
FeedItem FI = new FeedItem(Body = ‘Test’, ParentId = cg.Id);
insert FI;
CollaborationGroupFeed CGrpFeed = [ SELECT Body, Type FROM CollaborationGroupFeed ];
system.debug(‘Output is ‘ + CGrpFeed);
Test.setCreatedDate(CGrpFeed.Id, System.now.addMonths(-4));
}
@isTest
private class CollaborationGroupFeedTest {
static testMethod void test() {
CollaborationGroup cg = new CollaborationGroup(Name = ‘Test’, CollaborationType = ‘Public’);
insert cg;
FeedItem FI = new FeedItem(Body = ‘Test’, ParentId = cg.Id);
insert FI;
CollaborationGroupFeed CGrpFeed = [ SELECT Body, Type FROM CollaborationGroupFeed ];
system.debug(‘Output is ‘ + CGrpFeed);
Test.setCreatedDate(CGrpFeed.Id, System.now.addMonths(-4));
}
}