function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
pujapuja 

: Error: Compile Error: Invalid type: FeedPost

I created a test class but it gives a compilation error : Error: Compile Error: Invalid type: FeedPost at line 20 column 31

Please Help:

 

@isTest

private class TestChatterPostOnOpprty {

public static testMethod void unitTest() {

Opportunity opp = new Opportunity(
Name='Test',
StageName='Prospecting',
CloseDate=Date.today()
);
insert opp;

FeedItem fd= new FeedItem(
Body = 'aaaaa#nextstep @rrr eeeeeeeeee #nextstep',
parentId = opp.id
);
insert fd;

FeedPost feedPo = new FeedPost(
FeedItemId = fd.Id
);
insert feedPo;

opportunityFeed effdPo = new opportunityFeed(
FeedPostId = feedPo.Id
);
insert effdPo;

List<opportunityFeed> oppFeedList = new List<opportunityFeed>();


}
}