A developer wrote a class named AccountHistoryManager that relies on field history tracking. The class has a static method called getAccountHistory that takes in an Account as a parameter and returns a list of associated AccountHistory object records. The following test fails: What should be done to make this test pass?

QuestionsCategory: Certified Platform Developer IIA developer wrote a class named AccountHistoryManager that relies on field history tracking. The class has a static method called getAccountHistory that takes in an Account as a parameter and returns a list of associated AccountHistory object records. The following test fails: What should be done to make this test pass?
Admin Staff asked 4 months ago
A developer wrote a class named AccountHistoryManager that relies on field history tracking. The class has a static method called getAccountHistory that takes in an Account as a parameter and returns a list of associated AccountHistory object records.
The following test fails:
 Image
What should be done to make this test pass?

A. The test method should be deleted since this code cannot be tested.

B. Create AccountHistory records manually in the test setup and write a query to get them.

C. Use Test.isRunningTest() in getAccountHistory() to conditionally return fake AccountHistory records.

D. Use @isTest (SeeAllData=true) to see historical data from the org and query for AccountHistory records.








 

Suggested Answer: C





This question is in Certified Platform Developer II Exam
For getting Salesforce Certified Platform Developer II











Disclaimers:
The website is not related to, affiliated with, endorsed or authorized by Salesforce. 
Trademarks, certification & product names are used for reference only and belong to Salesforce.
The website does not contain actual questions and answers from Salesforce's Certification Exams.

Recommended

Welcome Back!

Login to your account below

Create New Account!

Fill the forms below to register

Retrieve your password

Please enter your username or email address to reset your password.