nerdexam
Salesforce

PDII · Question #195

A developer wrote a trigger on Opportunity that will update a custom Last Sold Date field on the Opportunity's Account whenever an Opportunity is closed. In the test class for the trigger, the…

The correct answer is B. The test class has not re-queried the Account record after updating the Opportunity. See the full explanation below for the reasoning.

Question

A developer wrote a trigger on Opportunity that will update a custom Last Sold Date field on the Opportunity's Account whenever an Opportunity is closed. In the test class for the trigger, the assertion to validate the Last Sold Date field fails. What might be causing the failed assertion?

Options

  • AThe test class is not using System.runAs() to run tests as a Salesforce administrator
  • BThe test class has not re-queried the Account record after updating the Opportunity
  • CThe test class has not defined an Account owner when inserting the test data
  • DThe test class has not implemented seeAllData=true in the test method

How the community answered

(38 responses)
  • A
    8% (3)
  • B
    84% (32)
  • C
    3% (1)
  • D
    5% (2)

Community Discussion

No community discussion yet for this question.

Full PDII Practice