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
dlCamelotdlCamelot 

Test Class for FeedItem Errors

Created 85% of a test class that covers CollaborationGroups and FeedItems created.  How can I test that an error is properly being displayed on a FeedItem as it's created?  

Trigger Portion I'm trying to cover:
FeedItem List --> AddError

Best answer gets voted on!
Shashikant SharmaShashikant Sharma
For valiation or cases where you are testing errors you should use
try {
// write code to make validation happen
}
catch( DMLException e ) {
// assert the error message