@isTest private class Sfdc2SapDealersContractBatchTest { //新增经销商和契约 @isTest static void insertContactTest(){ ControllerUtil.EscapeNFM001Trigger = true; StaticParameter.EscapeNFM001Trigger = true; StaticParameter.EscapeAccountTrigger = true; StaticParameter.EscapeNFM001AgencyContractTrigger = true; List rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; if (rectCo.size() == 0) { return; } List rectContract = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '契約']; if (rectCo.size() == 0) { return; } //经销商 Account myAccount1 = new Account(name='Testaccount001', Dealer_discount__c =20, RecordTypeId = rectCo[0].Id, Sap2sfdcDealers_ModifycationLogo__c = '' ); insert myAccount1; //经销商有效合同 Account myAccount2 = new Account(name='Testaccount002', RecordTypeId = rectContract[0].Id, Contract_Decide_Start_Date__c = Date.today().addDays(-1), Contract_Decide_End_Date__c =Date.today().addDays(1), Agent_Ref__c =myAccount1.Id, ParentId =myAccount1.Id); insert myAccount2; Account acc = [select Name,id,Agency_With_EffectiveContract__c,Sap2sfdcDealers_ModifycationLogo__c from Account where id = :myAccount1.Id ]; if(acc.Name !='Testaccount0012'){ myAccount1.Name = 'Testaccount0012'; myAccount1.Sap2sfdcDealers_ModifycationLogo__c = '1'; } update myAccount1; System.assertEquals('Testaccount0012',myAccount1.Name); System.assertEquals('1',myAccount1.Sap2sfdcDealers_ModifycationLogo__c); // 2021-03-11 mzy add SFDC合并调查 start Database.executeBatch(new Sfdc2SapDealersContractBatch(true)); // 2021-03-11 mzy add SFDC合并调查 end } }