nerdexam
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

PDII question #310 exhibit 1
PDII question #310 exhibit 2

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)
  • A
    11% (5)
  • B
    80% (36)
  • C
    2% (1)
  • D
    7% (3)

Community Discussion

No community discussion yet for this question.

Full PDII Practice