May 2019
Intermediate to advanced
546 pages
12h 41m
English
A second interface that can be used in Salesforce for testing web service callouts is the HttpCalloutMock interface. A class that implements this interface needs to implement the HttpResponse method (HttpRequest). Just like the access modifier, this must be a public class with the public method respond. You can use this interface for each other callout scenario between Salesforce and a web service (such as the SOAP and REST services):
global class MockResponse implements HttpCalloutMock { global HTTPResponse respond(HTTPRequest req) { // Create a fake response (HttpResponse class) with response values and return this response }}
When we use this type of mock interface, we need to call the class in our test method this. The ...
Read now
Unlock full access