Salesforce Platform Developer I (legacy) — Question 136
A developer wrote Apex code that calls out to an external system.
How should a developer write the test to provide test coverage?
Answer options
- A. Write a class that implements the HTTPCalloutMock interface.
- B. Write a class that extends HTTPCalloutMock.
- C. Write a class that extends WebserviceMock.
- D. Write a class that implements the WebserviceMock interface.
Correct answer: A
Explanation
The correct answer is A because implementing the HTTPCalloutMock interface allows the developer to simulate HTTP responses, which is essential for testing callouts without making actual requests. Options B, C, and D are incorrect as they either extend classes that do not provide the necessary mock behavior for HTTP callouts or relate to web service mocks, which are not relevant in this context.