Last active
February 24, 2020 17:43
-
-
Save vspruyt-sol/213df54816994b6dd181015aceccd24c to your computer and use it in GitHub Desktop.
Unit test: Internal Salesforce Error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Throws Internal Salesforce Error | |
try { | |
insert new ContentDocumentLink(); | |
} catch (Exception exceptionInstance){ | |
} | |
//Deploys without errors | |
try { | |
ContentVersion cv = new ContentVersion(); | |
cv.Title = 'Test'; | |
cv.PathOnClient = 'Test'; | |
cv.VersionData = Blob.valueOf('Test'); | |
//Also triggers ContentDocument & ContentDocumentLink trigger, can't insert ContentDocument directly | |
insert cv; | |
} catch (Exception exceptionInstance) { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment