@isTest
public with sharing class eSignFormFileUploadControllerTest {
    static testMethod void testMethod1() {
        // TestDataUtility.CreatePIPolicyConfiguration('Document');
        TestDataUtility.CreatePIPolicyConfiguration();
        Account acc = new Account(Name = 'test');
        Map<String,Object> accMap = new Map<String,Object>();
        accMap.put('Account',acc);
        accMap.put('object','vjdoneqvds');
        String mapJson = JSON.serialize(accMap);

        Contact con = TestDataUtility.CreateContacts(1)[0];

        Test.setMock(HttpCalloutMock.class, new TestDataUtility.BaseHttpMock(mapJson,'OK','200'));

        Test.startTest();
        ApexPages.StandardController sc = new ApexPages.StandardController(con);
        eSignFormFileUploadController fuc = new eSignFormFileUploadController(sc);

        String msg = fuc.PIPL_Input_PDF_Error_Msg;
        Document doc = fuc.documentData;
        eSignFormFileUploadController.Response fur = new eSignFormFileUploadController.Response();
        fur.message = '';

       // eSignFormFileUploadController.saveFile('Contact','123','456',fuc.parentId);

        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.ParentRecordId__c =fuc.parentId;
        file.AWS_File_Key__c = '123';
        insert file;

        //eSignFormFileUploadController.saveFile('Contact','123','456',fuc.parentId);
        fuc.refreshFiles();
        fuc.parentId = '';
        fuc.refreshFiles();
        try{
            delete file;
        }catch(Exception e){
            system.debug('Exception from delete file:'+e.getmessage());
        }
        Test.stopTest();
    }
    static testMethod void testMethod2() {
        TestDataUtility.CreatePIPolicyConfiguration('Document');
        Account acc = new Account(Name = 'test');
        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'));

        Test.startTest();
        // throw new DMLException('insert false for test');
        //eSignFormFileUploadController.saveFile('','','','');

        Test.stopTest();
    }
}