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/OnCallControllerTest.cls | 30 +++--------------------------- 1 files changed, 3 insertions(+), 27 deletions(-) diff --git a/force-app/main/default/classes/OnCallControllerTest.cls b/force-app/main/default/classes/OnCallControllerTest.cls index 3b9161f..9b1790b 100644 --- a/force-app/main/default/classes/OnCallControllerTest.cls +++ b/force-app/main/default/classes/OnCallControllerTest.cls @@ -3,42 +3,18 @@ @TestSetup static void makeData(){ TestDataUtility.CreatePIPolicyConfiguration('On_Call__c'); - - Account hospital = new Account(); - hospital.recordtypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('HP').getRecordTypeId(); - hospital.Name = 'test hospital'; - insert hospital; - List<Account> strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_GI']; - Account dep = new Account(); - dep.recordtypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Department_GI').getRecordTypeId(); - dep.Name = 'test dep'; - dep.ParentId = strategicDep[0].Id; - dep.Department_Class__c = strategicDep[0].Id; - dep.Hospital__c = hospital.Id; - insert dep; - On_Call__c onCall = new On_Call__c(); - onCall.segment__c = dep.Id; - onCall.Hospital__c = hospital.Id; - onCall.AWS_Data_Id__c = '1234567890'; - insert onCall; } static testMethod void testMethod1() { - On_Call__c onCall = [SELECT Id FROM On_Call__c LIMIT 1]; - Map<String,Object> smap = new Map<String,Object>(); - smap.put('object',onCall); - String bodyJson = JSON.serialize(smap); - - Test.setMock(HttpCalloutMock.class, new TestDataUtility.BaseHttpMock(bodyJson,'OK','200')); + String onCallJson = '{"Status_c__c":"璺熻繘涓�","segment__c":"'+'000000000000000'+'","OwnerId":"0050l000005fcnt","Responsible_Person_HP__c":"Test","Oncall_report_number_c__c":"Test","Caller_phone__c":"186435431212","Hospital__c":"'+'000000000000000'+'","Trable_occur_day_c__c":"2022/03/24 10:45","Taking_call_Time_c__c":"2022/03/24 10:45","First_ploblem_c__c":"","From_c__c":"","To_c__c":"","Oncall_Equipment__c":"000000000000000","Oncall_Product_manual__c":"","Customer_Problem_c__c":"","FinishDataTime__c":"","Customer_sigh_c__c":false,"Customer_sigh_day_c__c":"","AWS_Data_Id__c":"1234567890"}'; Test.startTest(); + On_Call__c onCall = new On_Call__c(); ApexPages.StandardController sc = new ApexPages.StandardController(onCall); OnCallController occ = new OnCallController(sc); Test.stopTest(); } static testMethod void testMethod2() { - Account acc = TestDataUtility.CreateAccounts(1)[0]; - Account pacc = [SELECT Id,Name,ParentId FROM Account WHERE Id =: acc.ParentId]; Test.startTest(); - String onCallJson = '{"Status_c__c":"璺熻繘涓�","segment__c":"'+acc.Id+'","OwnerId":"0050l000005fcnt","Responsible_Person_HP__c":"Test","Oncall_report_number_c__c":"Test","Caller_phone__c":"186435431212","Hospital__c":"'+pacc.ParentId+'","Trable_occur_day_c__c":"2022/03/24 10:45","Taking_call_Time_c__c":"2022/03/24 10:45","First_ploblem_c__c":"","From_c__c":"","To_c__c":"","Oncall_Equipment__c":"000000000000000","Oncall_Product_manual__c":"","Customer_Problem_c__c":"","FinishDataTime__c":"","Customer_sigh_c__c":false,"Customer_sigh_day_c__c":"","AWS_Data_Id__c":"1234567890"}'; + String onCallJson = '{"Status_c__c":"璺熻繘涓�","segment__c":"'+'000000000000000'+'","OwnerId":"0050l000005fcnt","Responsible_Person_HP__c":"Test","Oncall_report_number_c__c":"Test","Caller_phone__c":"186435431212","Hospital__c":"'+'000000000000000'+'","Trable_occur_day_c__c":"2022/03/24 10:45","Taking_call_Time_c__c":"2022/03/24 10:45","First_ploblem_c__c":"","From_c__c":"","To_c__c":"","Oncall_Equipment__c":"000000000000000","Oncall_Product_manual__c":"","Customer_Problem_c__c":"","FinishDataTime__c":"","Customer_sigh_c__c":false,"Customer_sigh_day_c__c":"","AWS_Data_Id__c":"1234567890"}'; OnCallController.saveOnCall(onCallJson,'1adf234dafa',true); OnCallController.saveOnCall(onCallJson,'1adf234dafa',false); Test.stopTest(); -- Gitblit v1.9.1