I have a trigger which passes the list of objects to a queueable method, the queueable method performs the DML on the related parent/child objects.

In my test class when I insert a record, the trigger is calling the queueable method. However, when I query the related object to assert, it doesn't return the updated value from the queueable.

My code is something like this

public class AccountTriggerhandler{
   system.enqueueJob(new enqueueJob(childRecordstoBeUpdated));

public static void testMethod(){
   Insert Account;
  • Is there more to your code? You haven't created any account records in your test to insert an account? – J.koh Dec 19 '18 at 20:56
  • I have a whole set of classes, I have just posted the way it is implemented. The logs do show that the child records are being updated by queueable method but I'm not sure why the assert is returning null. – cartman Dec 19 '18 at 21:01
  • 4
    Maybe edit your post to include an assert line (i assume after the stopTest) so we know exactly what youre looking to check? – battery.cord Dec 19 '18 at 21:13
  • @battery.cord that was it, I feel so stupid. My assert was inside stoptest. – cartman Dec 19 '18 at 21:19

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.