• shahida
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
Hi, 

I am new to Salesforce Apex and I have a Signature Handler Class that is used to save a signature image to the Referral Record. I am unable to write a test class for the below code? Can someone help me with this please? 


public without sharing class SignatureHandler {
    @AuraEnabled 
    public static void saveSign(String base64Data, String contentType, String recordId) { 
        //List<Account> lstAcc=[SELECT Id,Name FROM Account WHERE Name='SalesforceScool' limit 1];        
           system.debug('&&&&&&' + recordId);
        base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');        
        Attachment a = new Attachment();
        a.parentId = recordId;
        a.Body = EncodingUtil.base64Decode(base64Data);        
        a.Name = 'Signature.png';
        a.ContentType = contentType;        
        insert a;        
    }
 }