Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
MockFunctionInvocationFactory Class
Namespace
Usage
To mock Salesforce Functions testing, implement an appropriate mock response in the respond(functionName,payload) method of the FunctionInvokeMock interface. During mock testing of a Salesforce Functions, the Apex runtime sends the response specified in the respond() method, rather than invoking the function itself. Appropriate success and error messages can be configured with the createSuccessResponse(invocationId,message) and createErrorResponse(invocationId,functionsErrorType,errorMsg) methods.
MockFunctionInvocationFactory Methods
The following are methods for MockFunctionInvocationFactory.
createErrorResponse(invocationId, functionsErrorType, errMsg)
Signature
public static functions.FunctionInvocation createErrorResponse(String invocationId, functions.FunctionErrorType functionsErrorType, String errMsg)
Parameters
- invocationId: Type: String The ID associated with a call to either the synchronous or asynchronous Function.invoke() method.
- functionsErrorType: Type: FunctionErrorType Enum The error type of FunctionInvocationError.
- errMsg: Type: String The error message.