From 37963a4f1dafc7e8accd8b28204ed1e6b7e29e9d Mon Sep 17 00:00:00 2001 From: 张宇恒 <bxyun0@163.com> Date: 星期五, 11 三月 2022 20:17:26 +0800 Subject: [PATCH] NFM701_703_707 --- force-app/main/default/classes/NFM701ControllerHandlerTest.cls | 149 ++++++++----------------------------------------- 1 files changed, 26 insertions(+), 123 deletions(-) diff --git a/force-app/main/default/classes/NFM701ControllerHandlerTest.cls b/force-app/main/default/classes/NFM701ControllerHandlerTest.cls index dc1b650..82ff717 100644 --- a/force-app/main/default/classes/NFM701ControllerHandlerTest.cls +++ b/force-app/main/default/classes/NFM701ControllerHandlerTest.cls @@ -1,136 +1,39 @@ @isTest private class NFM701ControllerHandlerTest { - @testSetup - static void makeTestRepair() { - + + static testMethod void testMethod1() { + ControllerUtil.EscapeNFM001Trigger = true; + // ControllerUtil.EscapeMaintenanceContractAfterUpdateTrigger = true; + // StaticParameter.EscapeNFM001Trigger = true; + // StaticParameter.EscapeNFM001AgencyContractTrigger = true; + // StaticParameter.EscapeNFM001AgencyContractTrigger2 = true; + // StaticParameter.EscapeMaintenanceContractAfterUpdateTrigger = true; + - List < RecordType > rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' + + List < RecordType > rectCo00 = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌' ]; - if (rectCo.size() == 0) { - throw new ControllerUtil.myException('not found 鐥呴櫌 recodetype'); - } - List < RecordType > rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' - and Name = '鎴︾暐绉戝鍒嗛 娑堝寲绉�' - ]; - if (rectSct.size() == 0) { - throw new ControllerUtil.myException('not found 鎴︾暐绉戝鍒嗛 鍛煎惛绉� recodetype'); - } - List < RecordType > rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' - and Name = '瑷虹檪绉� 娑堝寲绉�' - ]; - if (rectDpt.size() == 0) { - throw new ControllerUtil.myException('not found 瑷虹檪绉� 娑堝寲绉� recodetype'); - } - // 銉嗐偣銉堛儑銉笺偪 - Account company = new Account(); - company.RecordTypeId = rectCo[0].Id; - company.Is_Active__c = '鏈夊姽'; - company.Name = 'NFM105TestCompany'; - company.AwaitToSendAWS__c = true; - upsert company; - - Account section = [Select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where ParentId =: company.Id and RecordTypeId =: rectSct[0].Id]; - - Account depart = new Account(); - depart.RecordTypeId = rectDpt[0].Id; - depart.Name = '*'; - depart.Department_Name__c = 'NFM105TestDepart'; - depart.ParentId = section.Id; - depart.Department_Class__c = section.Id; - depart.Hospital__c = company.Id; - upsert depart; - - company.Site = '娴嬭瘯鍙樻洿鍒悕1'; - - upsert company; - - List < RecordType > rectDpt2 = [select Id from RecordType where IsActive = true and SobjectType = 'Account' - and DeveloperName = 'Agency' - ]; - if (rectDpt.size() == 0) { - throw new ControllerUtil.myException('not found 瑷虹檪绉� 娑堝寲绉� recodetype'); - } - ControllerUtil.EscapeNFM001Trigger = true; - StaticParameter.EscapeNFM001AgencyContractTrigger2 = true; - Account company2 = new Account(); - company2.RecordTypeId = rectDpt2[0].Id; - company2.Name = 'NFM105TestCompany'; - upsert company2; - - License_Information__c lic = new License_Information__c(); - lic.name = 'Test20181204'; - lic.LicenseType__c = '鍖荤枟鍣ㄦ缁忚惀璁稿彲璇�'; - lic.BusinessLicense__c = '20180522'; - lic.ValidFrom__c = date.newinstance(2018, 05, 22); - lic.ValidTo__c = date.newinstance(2018, 05, 22); - lic.Scope3__c = '6815;6822;6823;6825'; - lic.IsInquire__c = false; - lic.LicenseAndAccount__c = company2.Id; - insert lic; - License_Information__c lic1 = new License_Information__c(); - lic1.name = 'Test20190111'; - lic1.LicenseType__c = '绗簩绫诲尰鐤楀櫒姊扮粡钀ュ妗堝嚟璇�'; - lic1.BusinessLicense__c = '20190522'; - lic1.ValidFrom__c = date.newinstance(2018, 05, 21); - lic1.ValidTo__c = date.newinstance(2018, 05, 21); - lic.IsInquire__c = false; - lic1.Scope__c = '6815;6822;6823;6825'; - lic1.LicenseAndAccount__c = company2.Id; - insert lic1; - - List < RecordType > rectDptAgencyContract = [select Id from RecordType where IsActive = true and SobjectType = 'Account' - and DeveloperName = 'AgencyContract' - ]; - if (rectDptAgencyContract.size() == 0) { - return; - } - - Account AagencyContractAccount = new Account(); - AagencyContractAccount.RecordTypeId = rectDptAgencyContract[0].Id; - AagencyContractAccount.Contract_Decide_Start_Date__c = System.today(); - AagencyContractAccount.Contract_Decide_End_Date__c = System.today(); - AagencyContractAccount.Contract_End_Date__c = Date.today(); - AagencyContractAccount.Name = '*'; - AagencyContractAccount.Department_Name__c = 'NFM701TestDepart'; - AagencyContractAccount.ParentId = company2.Id; - AagencyContractAccount.Agent_Ref__c = company2.Id; - AagencyContractAccount.ET_SP_Dealer__c = true; - // AagencyContractAccount.RecordType.DeveloperName = 'HP'; - upsert AagencyContractAccount; - - - // List < BatchIF_Transfer__c > transfers = new List < BatchIF_Transfer__c > (); - // BatchIF_Transfer__c transfer = new BatchIF_Transfer__c(); - // transfer.Table__c = 'Account'; - // transfer.Column__c = 'RecordTypeId'; - // transfer.External_Value__c = rectDpt[0].Id; - // transfer.Internal_Value__c = '娑堝寲绉�'; - // insert transfer; - // BatchIF_Log__c iflog = new BatchIF_Log__c(); - // iflog.Log__c = '{"GeDatas":{"Monitoring":{"TransmissionDateTime":"20211231104929","Text":"","Tag":"MSGH","Sender":"SFDC","Receiver":"OBPM","NumberOfRecord":"1","MessageType":"NFM701","MessageGroupNumber":"20211231104929"},"GeData":[{"StateMaster":"灞辫タ鐪�","LinkedHospitalMCode":null,"IsMerge":false,"IsActive":true,"HospitalName":"澶忓幙绗簩浜烘皯鍖婚櫌","HospitalMCode":"360437","Grade":"浜岀骇涔�","DataType":"Hospital","CityMaster":"杩愬煄甯�","Address":"灞辫タ鐪佽繍鍩庡競澶忓幙杩愬煄鍦板尯澶忓幙鍖楄"}]}}'; - // iflog.Type__c = '701test'; - // insert iflog; - } - static testMethod void testMethod1() { - List < Account > userList = [select id from Account]; Test.startTest(); - Integer i = 0; - List < Id > idList = new List < Id > (); - for (Account user: userList) { - idList.add(user.Id); - user.Is_Active__c = '鏈夋晥'; - user.Name = user.Name + i; - i++; - } + Account hospital = new Account(); + hospital.RecordTypeId = rectCo00[0].Id; + // hospital.Is_Active__c = '鏈夊姽'; + hospital.Name = 'hospital'; + // hospital.RecordType.DeveloperName = 'HP'; + hospital.Is_Active__c = '鐒″姽'; + hospital.Ban_On_Use_Reason__c = '312343'; + hospital.AwaitToSendAWS__c = true; + insert hospital; + List < String > accountIdList = new List < String >(); + accountIdList.add(hospital.Id); BatchIF_Log__c iflog = new BatchIF_Log__c(); iflog.Log__c = 'test start \n'; insert iflog; - upsert userList; - // NFM701Controller.callout(iflog.Id, idList); - - + hospital.Is_Active__c = '鏈夊姽'; + upsert hospital; + // NFM701Controller.callout(iflog.Id, accountIdList); + // Database.executeBatch(new Sfdc2PoAccountBatch(accountIdList),100); Test.stopTest(); } } \ No newline at end of file -- Gitblit v1.9.1