StaticResourceCalloutMock Class

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

System

Use the methods in this class to set the response properties for testing HTTP callouts.

The following are constructors for StaticResourceCalloutMock.

Creates a new instance of the StaticResourceCalloutMock class.

public StaticResourceCalloutMock()

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

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

public Void setHeader(String headerName, String headerValue)

Type: Void

Sets the specified static resource, which contains the response body.

public Void setStaticResource(String resourceName)

Type: Void

Sets the specified HTTP status for the response.

public Void setStatus(String httpStatus)

Type: Void

Sets the specified HTTP status for the response.

public Void setStatusCode(Integer httpStatusCode)

Type: Void