Skip to content

Instantly share code, notes, and snippets.

@vspruyt-sol
Last active February 24, 2020 17:43
Show Gist options
  • Save vspruyt-sol/213df54816994b6dd181015aceccd24c to your computer and use it in GitHub Desktop.
Save vspruyt-sol/213df54816994b6dd181015aceccd24c to your computer and use it in GitHub Desktop.
Unit test: Internal Salesforce Error
//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