ExternalServiceTest Class

Provides methods to test an external service's asynchronous callouts, enables sending a mock request, asserts the expected request payload, then triggers the mocked external service’s asynchronous callback response.

Namespace

System

Usage

See Create Unit Testing for Asynchronous Callouts in the "Extend Salesforce with Clicks, Not Code" Help Guide.

ExternalServiceTest Methods

An instance of the ExternalServiceTest method is used when the test class triggers a mocked external service’s callback response. You can access ExternalServiceTest through Test.getExternalService()

The following are methods for ExternalServiceTest.

sendCallback(request)

Sends the HTTP request back as an external service asynchronous response.

Signature

public System.HttpResponse sendCallback(System.HttpRequest request)

1System.ExternalServiceTest, sendCallback, [System.HttpRequest], System.HttpResponse

Parameters

request
Type: System.HttpRequest

Return Value

Type: System.HttpResponse