@isTest
|
private class QLMAttachmentPreviewControllerTest {
|
|
static testMethod void testMethod1() {
|
|
Tender_information__c Ten = new Tender_information__c();
|
Ten.Name = '123456';
|
Ten.ProjectId__c = '38_99df2844cf784982acdc61d00d7a7dbb';
|
insert Ten;
|
|
list<Attachment> attachmentList = new list<Attachment>();
|
Attachment attach = new Attachment();
|
attach.Name = 'A-65224941-20200923--1.docx';
|
Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body');
|
attach.body = bodyBlob;
|
attach.parentId = Ten.id;
|
attach.ContentType = 'application/pdf';
|
attachmentList.add(attach);
|
|
// insert attach;
|
Attachment attach1 = new Attachment();
|
attach1.Name = 'H-65224945-20200928--15.jpg';
|
Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body');
|
attach1.body = bodyBlob1;
|
attach1.parentId = Ten.id;
|
attach1.ContentType = 'application/pdf';
|
attachmentList.add(attach1);
|
|
insert attachmentList;
|
|
PageReference page = new PageReference('/apex/QLMAttachmentPreview?parentId=' + Ten.id);
|
System.Test.setCurrentPage(page);
|
QLMAttachmentPreviewController apc = new QLMAttachmentPreviewController();
|
//初始化测试
|
apc.gethtmlvalue();
|
apc.init();
|
|
}
|
}
|