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.
ConnectorTestUtil Class
Namespace
Usage
Use this class for connector-based test accelerators. You can invoke it only from within an Apex test.
Example
This example creates an instance of a connected app, gets a value, and checks whether the value is correct. The test is simply a row inserted in the database table.
1@isTest
2 private class SCIMCreateUserPluginTest {
3 public static void callPlugin(Boolean validInputParams) {
4
5 //Create an instance of a connected app
6 ConnectedApplication capp =UserProvisioning.ConnectorTestUtil.createConnectedApp('TestApp');
7 Profile p = [SELECT Id FROM Profile WHERE Name='Standard User'];
8 //Create a user
9 User user = new User(username='testuser1@scimuserprov.test', Firstname= 'Test', Lastname='User1', email='testuser1@testemail.com',
10 FederationIdentifier='testuser1@testemail.com', profileId= p.Id, communityNickName='tuser1', alias='tuser', TimeZoneSidKey='GMT',
11 LocaleSidKey='en_US', EmailEncodingKey='ISO-8859-1', LanguageLocaleKey='en_US');
12 //insert user into a row in the database table
13 insert user;
14 //Create a UPR
15 UserProvisioningRequest upr = new UserProvisioningRequest(appname = capp.name, connectedAppId=capp.id, operation='Create',
16 state='New', approvalStatus='NotRequired',salesforceUserId=user.id);
17
18 //Insert the UPR to test the flow end to end
19 insert upr;
20 }}ConnectorTestUtil Method
The ConnectorTestUtil class has 1 method.
createConnectedApp(connectedAppName)
Signature
public static ConnectedApplication createConnectedApp(String connectedAppName)
Parameters
-
connectedAppName:
Type: String
Name of the connected app to test for provisioning.
Return Value
Type: ConnectedApplication
The instance of the connected app to test for provisioning.