답변 1개
Hi Nishant,Use the below test class you will get the 100% for both the Classes:@istestpublic class WS_ZipUtil_Test { static testmethod void TestAttachmentById() { Account a = new Account(Name='newAcct'); Test.startTest(); insert a; Attachment attach=new Attachment(); attach.Name='Unit Test Attachment'; Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body'); attach.body=bodyBlob; attach.parentId=a.Id; attach.ContentType = 'application/msword'; attach.IsPrivate = false; attach.Description = 'Test'; insert attach; String resp = WS_ZipUtil.getAttachmentById(attach.Id); } static testmethod void TestAttachmentByNullId() { Id sfdcId; String resp = WS_ZipUtil.getAttachmentById(sfdcId); }}Thanks, Maharajan.C