正解:B
The developer should write a class that implements the HTTPCalloutMock interface to provide test coverage for the Apex code that calls out to an external system. The HTTPCalloutMock interface enables you to inject fake responses into the callout response in a test method, so that you can isolate your Apex logic from any dependency on the external system. The interface has one method, respond, that returns a predefined HTTPResponse object when the Apex code calls the HTTPRequest.send method. By using the HTTPCalloutMock interface, you can test your Apex code without actually calling the external system, which saves time and avoids hitting callout limits. The other options are not valid ways to mock a callout in a test method. The HTTPCalloutMock interface is not a class, so it cannot be extended. The WebserviceMock interface is used to mock a SOAP web service callout, not a RESTful HTTP callout. The WebserviceMock interface is also not a class, so it cannot be extended either. References:
* Apex Developer Guide: Testing HTTP Callouts by Implementing the HttpCalloutMock Interface, pages
1-2
* Trailhead: Platform Developer I Certification Study Guide: Apex Testing, unit 6