@isTest private class NFM609FiledDownloadBatchTest { // 测试Case附件下载 static testMethod void testMethod1() { Case cas = new Case(); // cas.complaintID__c = 'test202193'; cas.Status = '草案中'; cas.AttachmentDownload__c = true; cas.AttachmentLink__c = 'https://albsylfw.s3.cn-northwest-1.amazonaws.com.cn/20211220/14/11/30/greaterthan12/5e8cb69e-f935-48f5-825e-b8344d60f6d4.zip'; cas.AttachmentName__c = '测试附件下载'; insert cas; // NFM609Schedule.assignOneMinute('Case'); Database.executeBatch(new NFM609FiledDownloadBatch('Case'), 1); Test.setMock(HttpCalloutMock.class, new FiledDownloadHttpCallMock()); } // 测试报修子单附件下载 static testMethod void testMethod2() { RepairSubOrder__c subOrder = new RepairSubOrder__c(); subOrder.AttachmentDownload__c = true; subOrder.AttachmentLink__c = 'https://albsylfw.s3.cn-northwest-1.amazonaws.com.cn/20211220/14/11/30/lessthan12/5e8cb69e-f935-48f5-825e-b8344d60f6d4.zip'; subOrder.AttachmentName__c = '测试附件下载'; insert subOrder; // NFM609Schedule.assignOneMinute('Case'); Database.executeBatch(new NFM609FiledDownloadBatch('RepairSubOrder__c'), 1); Test.setMock(HttpCalloutMock.class, new FiledDownloadHttpCallMock()); } // 测试NFM609Schedule static testMethod void testMethod3() { RepairSubOrder__c subOrder = new RepairSubOrder__c(); subOrder.AttachmentDownload__c = true; subOrder.AttachmentLink__c = 'https://albsylfw.s3.cn-northwest-1.amazonaws.com.cn/20211220/14/11/30/lessthan12/5e8cb69e-f935-48f5-825e-b8344d60f6d4.zip'; subOrder.AttachmentName__c = '测试附件下载'; insert subOrder; // Database.executeBatch(new NFM609FiledDownloadBatch('RepairSubOrder__c'), 1); NFM609Schedule.assignOneMinute('RepairSubOrder__c'); Test.setMock(HttpCalloutMock.class, new FiledDownloadHttpCallMock()); } }