Professional Documents
Culture Documents
SFDC 001
SFDC 001
}
}
Test.startTest();
MyClass.asyncCall();
Test.stopTest();
• Follow the same rules as with DML calls: Enclose the portion of your code that performs the callout within
Test.startTest and Test.stopTest statements. The Test.startTest statement must appear before the
Test.setMock statement. Also, the asynchronous calls must not be part of the Test.startTest/Test.stopTest
block.
MyClass.asyncCall();
Test.startTest();
Test.setMock(..); // Takes two arguments
MyClass.mockCallout();
Test.stopTest();
Asynchronous calls that occur after mock callouts are allowed and don’t require any changes in test methods.
See Also:
Callout Limits and Limitations
Crypto Class
The methods in the Crypto class provide standard algorithms for creating digests, message authentication codes, and signatures,
as well as encrypting and decrypting information. These can be used for securing content in Force.com, or for integrating with
external services such as Google or Amazon WebServices (AWS).
627
Reference Apex Classes
decryptWithManagedIV String Blob Decrypts the blob IVAndCipherText using the specified
algorithmName algorithm and private key. Use this method to decrypt
blobs encrypted using a third party application or the
Blob privateKey
encryptWithManagedIV method.
Blob
Valid values for algorithmName are:
IVAndCipherText
• AES128
• AES192
• AES256
628
Reference Apex Classes
• AES128
• AES192
• AES256
encryptWithManagedIV String Blob Encrypts the blob clearText using the specified
algorithmName algorithm and private key. Use this method when you
want Salesforce to generate the initialization vector for
Blob privateKey
you. It is stored as the first 128 bits (16 bytes) of the
Blob clearText encrypted blob. Use either third-party applications or
the decryptWithManagedIV method to decrypt blobs
encrypted with this method. Use the encrypt method
if you want to generate your own initialization vector.
Valid values for algorithmName are:
• AES128
• AES192
• AES256
629
Reference Apex Classes
generateDigest String Blob Computes a secure, one-way hash digest based on the
algorithmName supplied input string and algorithm name. Valid values
for algorithmName are:
Blob input
• MD5
• SHA1
• SHA-256
• SHA-512
630
Reference Apex Classes
req.setMethod('GET');
631