Salesforce
PDII · Question #310
Consider the following code snippet: A developer created the following test class to provide the proper code coverage for the snippet above: However, when the test runs, no data is returned and the…
The correct answer is B. Implement the setFixedSearchResuits method in the test class. See the full explanation below for the reasoning.
Question
Consider the following code snippet:
A developer created the following test class to provide the proper code coverage for the snippet above:
However, when the test runs, no data is returned and the assertion fails. Which edit should the developer make to ensure the test class runs successfully?
Exhibits
Options
- AEnclose the method call within Test.startTest () and Test.stopTest ().
- BImplement the setFixedSearchResuits method in the test class.
- CImplement the seeAllData=true attribute in the @IsTest annotation.
- DImplement the without sharing keyword in the searchFeature Apex class.
How the community answered
(45 responses)- A11% (5)
- B80% (36)
- C2% (1)
- D7% (3)
Community Discussion
No community discussion yet for this question.

