You need to sign in to do that
Don't have an account?

How do I write a test class for this
How Do I make a test case for this
public String ourl {get;set;} public String url {get;set;} Blob content; public NewPdfQuote() { url = ApexPages.currentPage().getParameters().get('qotId'); generateNewQuotePDF(); } public QuoteDocument generateNewQuotePDF(){ ourl = '/apex/QuotePDF?id=' + url ; System.debug('ourl ' + ourl); PageReference pr = Page.QuotePDF; pr.getParameters().put('id', url); System.debug('saveQuote() Quote: ' + url); if (!Test.isRunningTest()) content = pr.getContentAsPDF(); else content = Blob.valueOf('Unit Test Attachment Body'); //emailURL = '/_ui/core/email/author/EmailAuthor?p3_lkid=' + urlId + '&doc_id=' + record.Id + '&retURL=%2F' + urlId ; return NULL; } public PageReference sendQuote() { QuoteDocument doc1 = new QuoteDocument(Document = content, QuoteId = url); // Database.SaveResult insertResult = Database.Insert(doc, false); insert doc1; return NULL; }

Thank you, but now I get the error System.DmlException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []