CRT-450 Exam QuestionsBrowse all questions from this exam

CRT-450 Exam - Question 267


A developer wrote Apex code that calls out to an external system using REST API.

How should a developer write the test to prove the code is working as intended?

Show Answer
Correct Answer: BC

To write a test for Apex code that calls out to an external system using REST API, the developer should use the HTTPCalloutMock interface. This interface can be implemented to create a mock response for the HTTP request, allowing the developer to test the callout without actually making a real HTTP request. Extending HTTPCalloutMock is incorrect because HTTPCalloutMock is an interface, not a class.

Discussion

1 comment
Sign in to comment
SS1121Option: B
Jun 19, 2024

Correct Answer is B. HTTPCalloutMock is an interface. https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_interface_httpcalloutmock.htm