StaticResourceCalloutMock Class
Utility class used to specify a fake response for testing HTTP callouts.
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
StaticResourceCalloutMockclass.
Creates a new instance of the StaticResourceCalloutMock class.
public StaticResourceCalloutMock()
The following are methods for StaticResourceCalloutMock. All are instance methods.
-
setHeader(headerName, headerValue)
Sets the specified header name and value for the fake response.
-
setStaticResource(resourceName)
Sets the specified static resource, which contains the response body.
-
Sets the specified HTTP status for the response.
-
Sets the specified HTTP status for the response.
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)
- resourceName: Type: String
Type: Void
Sets the specified HTTP status for the response.
public Void setStatus(String httpStatus)
- httpStatus: Type: String
Type: Void
Sets the specified HTTP status for the response.
public Void setStatusCode(Integer httpStatusCode)
- httpStatusCode: Type: Integer
Type: Void