test method for the getContentDocumentBase64 method in Apex
@isTest
static void testGetContentDocumentBase64() {
// Create a test ContentVersion
Blob bodyBlob = Blob.valueOf('Test File Content');
ContentVersion cv = new ContentVersion();
cv.Title = 'TestFile';
cv.PathOnClient = 'TestFile.jpg';
cv.VersionData = bodyBlob;
insert cv;
// Query ContentDocumentId from inserted ContentVersion
ContentVersion insertedCV = [SELECT ContentDocumentId FROM ContentVersion WHERE Id = :cv.Id LIMIT 1];
// Call the method with the ContentDocumentId
List<String> result = YourClassName.getContentDocumentBase64(new List<String>{insertedCV.ContentDocumentId});
// Verify the result is not null or empty
System.assertNotEquals(null, result);
System.assert(!result.isEmpty());
}
test method for the getContentDocumentBase64 method in Apex
Reviewed by dasfrogpractice
on
05:45
Rating:
No comments: