---
schema_version: "1"
id: 8ac3c67344a3faea71fb79ac4281af71864c6d3020584a7929796bcee4f810d5
title: StaticResourceCalloutMock Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_methods_system_staticresourcecalloutmock.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_staticresourcecalloutmock.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 290bca5b194e4d3ac70d1daf1ee144fe481dc0544c46b6c8defbb7e88aed79bb
description: Utility class used to specify a fake response for testing HTTP callouts.Creates a new instance of the StaticResourceCalloutMock class.Sets the specified header name and value for the fake response.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.
---
# StaticResourceCalloutMock Class

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

## Namespace

[System](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_System.htm "The System namespace provides classes and methods for core Apex functionality.")

## Usage

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

- **[StaticResourceCalloutMock Constructors](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_staticresourcecalloutmock.htm#apex_System_StaticResourceCalloutMock_constructors)**
- **[StaticResourceCalloutMock Methods](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_staticresourcecalloutmock.htm#apex_System_StaticResourceCalloutMock_methods)**

## StaticResourceCalloutMock Constructors

The following are constructors for StaticResourceCalloutMock.

- **[StaticResourceCalloutMock()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_staticresourcecalloutmock.htm#apex_System_StaticResourceCalloutMock_ctor)**  
    Creates a new instance of the StaticResourceCalloutMock class.

### StaticResourceCalloutMock()

Creates a new instance of the StaticResourceCalloutMock class.

#### Signature

public StaticResourceCalloutMock()

## StaticResourceCalloutMock Methods

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

- **[setHeader(headerName, headerValue)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_staticresourcecalloutmock.htm#apex_System_StaticResourceCalloutMock_setHeader)**  
    Sets the specified header name and value for the fake response.
- **[setStaticResource(resourceName)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_staticresourcecalloutmock.htm#apex_System_StaticResourceCalloutMock_setStaticResource)**  
    Sets the specified static resource, which contains the response body.
- **[setStatus(httpStatus)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_staticresourcecalloutmock.htm#apex_System_StaticResourceCalloutMock_setStatus)**  
    Sets the specified HTTP status for the response.
- **[setStatusCode(httpStatusCode)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_staticresourcecalloutmock.htm#apex_System_StaticResourceCalloutMock_setStatusCode)**  
    Sets the specified HTTP status for the response.

### 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](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")
- **headerValue**: Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

#### Return Value

Type: Void

### setStaticResource(resourceName)

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

#### Signature

public Void setStaticResource(String resourceName)

#### Parameters

- **resourceName**: Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

#### Return Value

Type: Void

### setStatus(httpStatus)

Sets the specified HTTP status for the response.

#### Signature

public Void setStatus(String httpStatus)

#### Parameters

- **httpStatus**: Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

#### Return Value

Type: Void

### setStatusCode(httpStatusCode)

Sets the specified HTTP status for the response.

#### Signature

public Void setStatusCode(Integer httpStatusCode)

#### Parameters

- **httpStatusCode**: Type: [Integer](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_integer.htm#apex_methods_system_integer "Contains methods for the Integer primitive data type.")

#### Return Value

Type: Void