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
40
41
42
43
44
@isTest
public with sharing class FileBatchDeleteControllerTest {
    @TestSetup
    static void makeData(){
        List<String> strList= new List<String>();
        strList.add('Document');
        TestDataUtility.CreatePIPolicyConfigurations(strList);
    }
    static testMethod void testMethod1() {
        Test.startTest();
        FileAddress__c file = new FileAddress__c();
        PIHelper.PIIntegration pI=PIHelper.getPIIntegrationInfo('Document');
        file.DownloadLink__c =pI.undeleteUrl+'123'+'&fileName='+'Contact';
        file.FileName__c ='Contact';
        file.ViewLink__c =pI.queryUrl+'123';
        file.AWS_File_Key__c = '123';
        insert file;
        List<String> idList = new List<String>();
        idList.add(file.Id);
        FileBatchDeleteController.fileSFDelete(idList);
        Test.stopTest();
    }
 
    static testMethod void testMethod2() {
        Account acc = TestDataUtility.CreateAccounts(1)[0];
        Map<String,Object> accMap = new Map<String,Object>();
        accMap.put('Account',acc);
        accMap.put('object','vjdoneqvds');
        String mapJson = JSON.serialize(accMap);
        Test.setMock(HttpCalloutMock.class, new TestDataUtility.BaseHttpMock(mapJson,'OK','200'));
        FileAddress__c file = new FileAddress__c();
        PIHelper.PIIntegration pI=PIHelper.getPIIntegrationInfo('Document');
        file.DownloadLink__c =pI.undeleteUrl+'123'+'&fileName='+'Contact';
        file.FileName__c ='Contact';
        file.ViewLink__c =pI.queryUrl+'123';
        file.AWS_File_Key__c = '123';
        insert file;
        List<String> keyList = new List<String>();
        keyList.add(file.AWS_File_Key__c);
        Test.startTest();
        FileBatchDeleteController.fileAWSDelete(keyList);
        Test.stopTest();
    }
}