高章伟
2022-02-18 8b5f4c6c281cfa548f92de52c8021e37aa81901e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
@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();
        
    }
}