Quantcast
Channel: Active questions tagged feeditem+community+chatter-feed - Salesforce Stack Exchange
Viewing all articles
Browse latest Browse all 5

Setup ConnectApi.FeedElementPage with message mentions for Test (setTestGetFeedElementsFromFeed)

$
0
0

I have a class that uses ConnectApi.ChatterFeeds.getFeedElementsFromFeed and from the result page I extract the mentioned users.

This is working as intended but now I have to create a test for this and I can't figure out how to prepare a FeedElementPage containing a FeedItem that has a body with a mention.

Here is what I have

        ConnectApi.FeedItem feedItem = new ConnectApi.FeedItem();         ConnectApi.FeedBody body = new ConnectApi.FeedBody();          body.messageSegments = new List<ConnectApi.MessageSegment>();        ConnectApi.TextSegment text1 = new ConnectApi.TextSegment();        text1.text = 'Hi {';        body.messageSegments.add(text1);        ConnectApi.MentionSegment mention = new ConnectApi.MentionSegment();        mention.name = bob.FirstName +''+ bob.LastName;        //mention.record = ; <======  no idea how to setup        body.messageSegments.add(mention);        ConnectApi.TextSegment text2 = new ConnectApi.TextSegment();        text1.text = '}, have you finished testing?';        body.messageSegments.add(text2);        ((ConnectApi.FeedElement) feedItem).body = body;

I cannot find a way to populate the record which is a ConnectApi.ActorWithId object.


Viewing all articles
Browse latest Browse all 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>