I have an apex trigger which fires a platform event. And in the platform event trigger, it creates a big object.

My unit test code is pretty simple and looks like below:

    Account acc = DataFactory.generateSingleAccount();

    insert acc;

    List<Object_Feed_Store__b> objFeedList = [Select Id, DomainEntityId__c From Object_Feed_Store__b];
    System.assertEquals(1, objFeedList.size());

I checked the code coverage, the platform event trigger is fired successfully, and the below line is successfully executed:


During normal testing, I have verified the big object is successfully created. But in this scenario, when I query that, the big object is not there. So the assertion failed in my unit test.

I would assume this is due to creation of big object is an asynchronous process even if I have used insertImmediate. But I am not sure how to make that completed in my unit test. Any suggestions?


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.