I have this method:

public Id doPostAlerts(List<Product2> productList){
    List<ConnectApi.AnnouncementInput> announcementInputList = new List<ConnectApi.AnnouncementInput>();
    for ( Product2 product : productList ){
        ConnectApi.TextSegmentInput textSegmentInput = this.createTextSegmentInput(product);
        ConnectApi.MessageBodyInput messageBodyInput = this.createMessageBodyInput(textSegmentInput);
    return System.enqueueJob(new AnnouncementQueueable(announcementInputList)); 

I would like to make an Apex Unit or Integration test which asserts that this what it is expected to do.


  1. System.enqueueJob() returns null during test.
  2. Even executing the above method between Test.startTest() and Test.stopTest() does not seem to add anything to the expected CollaborationGroupFeed.

Any ideas how I can make some useful assertions about the above code?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.