From fb04e7c01d119c60632b4298d18fd93f3ccb3d79 Mon Sep 17 00:00:00 2001 From: Li Jun <buli@deloitte.com.cn> Date: 星期三, 06 四月 2022 10:32:05 +0800 Subject: [PATCH] 20220405DeployProduction --- force-app/main/default/classes/NFM115ControllerTest.cls | 24 ++++++++++++++++++++---- 1 files changed, 20 insertions(+), 4 deletions(-) diff --git a/force-app/main/default/classes/NFM115ControllerTest.cls b/force-app/main/default/classes/NFM115ControllerTest.cls index 14b3402..c711143 100644 --- a/force-app/main/default/classes/NFM115ControllerTest.cls +++ b/force-app/main/default/classes/NFM115ControllerTest.cls @@ -22,8 +22,16 @@ } static testMethod void testMethod1(){ - ID AgencyID = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Office').getRecordTypeId(); - Agency = new Account(RecordTypeId = AgencyID, Name = 'NFM115TestAgency', FSE_SP_Main_Leader__c = UserInfo.getUserId(), FSE_GI_Main_Leader__c = UserInfo.getUserId()); + Account account2 = new Account(); + account2.Name = 'test1缁忛攢鍟�'; + account2.RecordTypeId = '01210000000Qem1'; + insert account2; + Schema.RecordTypeInfo rti = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Office'); + if(rti == null){ + rti = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('office'); + } + ID AgencyID = rti.getRecordTypeId(); + Agency = new Account(ParentId = account2.Id, RecordTypeId = AgencyID, Name = 'NFM115TestAgency', FSE_SP_Main_Leader__c = UserInfo.getUserId(), FSE_GI_Main_Leader__c = UserInfo.getUserId()); insert Agency; Agency = [select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where Id = :Agency.Id]; @@ -47,8 +55,16 @@ } static testMethod void testMethod2(){ - ID AgencyID = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Office').getRecordTypeId(); - Agency = new Account(RecordTypeId = AgencyID, Name = 'NFM115TestAgency', FSE_SP_Main_Leader__c = UserInfo.getUserId(), FSE_GI_Main_Leader__c = UserInfo.getUserId()); + Account account2 = new Account(); + account2.Name = 'test1缁忛攢鍟�'; + account2.RecordTypeId = '01210000000Qem1'; + insert account2; + Schema.RecordTypeInfo rti = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Office'); + if(rti == null){ + rti = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('office'); + } + ID AgencyID = rti.getRecordTypeId(); + Agency = new Account(ParentId = account2.Id, RecordTypeId = AgencyID, Name = 'NFM115TestAgency', FSE_SP_Main_Leader__c = UserInfo.getUserId(), FSE_GI_Main_Leader__c = UserInfo.getUserId()); insert Agency; Agency = [select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where Id = :Agency.Id]; -- Gitblit v1.9.1