Exam PDII Topic 4 Question 145 Discussion

Actual exam question for Salesforce's PDII exam
Question #: 145
Topic #: 4
An Apex trigger and Apex class increment a counter, Edit __C, any time the Case is changed.

Suggested Answer: C Vote an answer

Based on the trigger and class code, the change that should be made to the test method is option C. This option adds the Test.startTest() and Test.stopTest() methods to the test method, and moves the delete statement and the second query inside the Test.startTest() and Test.stopTest() block. This way, the test method can force the asynchronous @future method to execute and update the Edit__c field before the assertion. Option A would not work, as it does not use the Test.startTest() and Test.stopTest() methods to wait for the @future method to finish. Option B would not work, as it uses the Test.startTest() and Test.stopTest() methods incorrectly, and does not move the delete statement and the second query inside the block. Option D would not work, as it does not use the Test.startTest() and Test.stopTest() methods at all, and also changes the assertion to an incorrect value. Reference: [Testing Asynchronous Apex], [Test Class]

by Hunter at Apr 25, 2025, 11:57 AM

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Nick name: Submit Cancel
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

Contact Us

If you have any question please leave me your email address, we will reply and send email to you in 12 hours.

Our Working Time: ( GMT 0:00-15:00 ) From Monday to Saturday

Support: Contact now 

日本語 Deutsch 繁体中文 한국어