HttpCalloutMockUtil Class
Contains a method to send fake HTTP callouts for classes in the Auth namespace.
Use the setHttpMock method in this class to test HTTP callouts when implementing the Auth.JWTBearerTokenExchange and Auth.JWTUtil classes.
For the Auth.JWTBearerTokenExchange class, mock callouts to the OAuth token endpoint when using the JWTBearerTokenExchange method.
For the Auth.JWTUtil class, mock callouts to the identity provider’s JSON Web Key Set (JWKS) endpoint when using the validateJWTWithKeysEndpoint method.
For more information on mocking HTTP callouts, see Testing HTTP Callouts by Implementing the HttpCalloutMock Interface.
The following are methods for HttpCalloutMockUtil.
-
Mocks an HTTP callout using an implementation of the
System.HttpCalloutMockinterface.
Mocks an HTTP callout using an implementation of the System.HttpCalloutMock interface.
public static void setHttpMock(System.HttpCalloutMock mock)
-
mock:
Type: System.HttpCalloutMock
A class that implements the System.HttpCalloutMock interface to return a fake HTTP response for a given request to the OAuth token endpoint or a JWKS endpoint on an external identity provider, depending on your use case.
Type: void