MultiStaticResourceCalloutMock Class

Utility class used to specify a fake response using multiple resources for testing HTTP callouts.

Namespace

System

Usage

Use the methods in this class to set the response properties for testing HTTP callouts. You can specify a resource for each endpoint.

MultiStaticResourceCalloutMock Constructors

The following are constructors for MultiStaticResourceCalloutMock.

MultiStaticResourceCalloutMock()

Creates a new instance of the System.MultiStaticResourceCalloutMock class.

Signature

public MultiStaticResourceCalloutMock()

MultiStaticResourceCalloutMock Methods

The following are methods for MultiStaticResourceCalloutMock. All are instance methods.

setHeader(headerName, headerValue)

Sets the specified header name and value for the fake response.

Signature

public Void setHeader(String headerName, String headerValue)

Parameters

headerName
Type: String
headerValue
Type: String

Return Value

Type: Void

setStaticResource(endpoint, resourceName)

Sets the specified static resource corresponding to the endpoint. The static resource contains the response body.

Signature

public Void setStaticResource(String endpoint, String resourceName)

Parameters

endpoint
Type: String
resourceName
Type: String

Return Value

Type: Void

setStatus(httpStatus)

Sets the specified HTTP status for the response.

Signature

public Void setStatus(String httpStatus)

Parameters

httpStatus
Type: String

Return Value

Type: Void

setStatusCode(httpStatusCode)

Sets the specified HTTP status code for the response.

Signature

public Void setStatusCode(Integer httpStatusCode)

Parameters

httpStatusCode
Type: Integer

Return Value

Type: Void