@isTest
|
public with sharing class BatchFileUploadControllerTest {
|
|
@TestSetup
|
static void makeData(){
|
List<String> strList= new List<String>();
|
strList.add('Document');
|
TestDataUtility.CreatePIPolicyConfigurations(strList);
|
}
|
|
static testMethod void testMethod1() {
|
StaticParameter.EscapeNFM001AgencyContractTrigger = true;
|
StaticParameter.EscapeNFM001Trigger = true;
|
StaticParameter.EscapeOpportunityBefUpdTrigger = true;
|
StaticParameter.EscapeOppandStaTrigger = true;
|
Oly_TriggerHandler.bypass(ContactTriggerHandler.class.getName());
|
Oly_TriggerHandler.bypass(AgencyHospitalHandler.class.getName());
|
Oly_TriggerHandler.bypass(Product2Handler.class.getName());
|
Oly_TriggerHandler.bypass(ESignFormHandler.class.getName());
|
Oly_TriggerHandler.bypass(AssetHandler.class.getName());
|
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();
|
|
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;
|
|
BatchFileUploadController.saveFile('Contact','123','456','','true');
|
try{
|
delete file;
|
}catch(Exception e){
|
system.debug('Exception from delete file:'+e.getmessage());
|
}
|
Test.stopTest();
|
}
|
|
static testMethod void testMethod2() {
|
StaticParameter.EscapeNFM001AgencyContractTrigger = true;
|
StaticParameter.EscapeNFM001Trigger = true;
|
StaticParameter.EscapeOpportunityBefUpdTrigger = true;
|
StaticParameter.EscapeOppandStaTrigger = true;
|
Oly_TriggerHandler.bypass(ContactTriggerHandler.class.getName());
|
Oly_TriggerHandler.bypass(AgencyHospitalHandler.class.getName());
|
Oly_TriggerHandler.bypass(Product2Handler.class.getName());
|
Oly_TriggerHandler.bypass(ESignFormHandler.class.getName());
|
Oly_TriggerHandler.bypass(AssetHandler.class.getName());
|
Test.startTest();
|
BatchFileUploadController bfc = new BatchFileUploadController();
|
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;
|
BatchFileUploadController.deleteFile(file.Id);
|
Test.stopTest();
|
}
|
}
|