Ryan
@isTest
public class Test_EchoSign2 {
static testmethod void testechosign(){
Account ac = new Account(RecordTypeId = [SELECT Id, SobjectType, Name FROM Recordtype WHERE Name = 'Prospect/Client' AND SobjectType = 'Account' LIMIT 1].Id);
ac.Name = 'TestAcnt';
ac.Type = 'Prospect';
insert ac;
Contact con = new Contact(RecordTypeId = [SELECT Id,SObjectType,Name FROM RecordType WHERE Name = 'Prospect/Client' AND SobjectType = 'Contact' LIMIT 1].Id);
con.LastName = 'testLastName';
con.AccountId = ac.Id;
con.Email = 'ryan.greene@outlook.com';
con.LeadSource = 'Unknown';
insert con;
List<Id> conid = new List<Id>();
conid.add(con.Id);
EchoSign.SendPdf(conid);
}
}
Hi,The problem should be here: EchoSign.SendPdf(conid);Have you got the source code of a class named EchoSign ?You have something like that with a class EchoSign instead of SendAgreementDocument : https://forums.adobe.com/thread/1699108You are using a wrapper (provided) to send the agreement and some line of code in Apex in this provided wrapper cannot pass a Salesforce test (perhaps, I don't have seen your class EchoSign)Example: pdfPage.getContentAsPDF(); cannot work directly for a test so it is replaced by pdfBody = blob.valueOf('Unit.Test'); when a test is running.That means that you can't test the class as long as the "bad" parts are not isolated and replaced when a test is running. That is not the test class but the tested class below:
https://developer.salesforce.com/forums/?id=906F0000000BZBmIAORegards// Build page reference for contract PDF & attach to the contract record
pageReference pdfPage = Page.ContractPDF;
pdfPage.getParameters().put('ContractId',pContractId);
blob pdfBody;
if(Test.isRunningTest()) {
pdfBody = blob.valueOf('Unit.Test');
} else {
pdfBody = pdfPage.getContentAsPDF();
}