From eeb7c0a2d6f037d515bb822d739036b69c4dc73a Mon Sep 17 00:00:00 2001 From: 沙世明 <shashiming@prec-tech.com> Date: 星期五, 08 四月 2022 17:14:12 +0800 Subject: [PATCH] Merge branch 'master' of http://47.92.229.245:8089/r/OlyMEBG --- force-app/main/default/classes/NewAndEditLeadControllerTest.cls | 63 +++++++++++++++++++++++++++++++ 1 files changed, 63 insertions(+), 0 deletions(-) diff --git a/force-app/main/default/classes/NewAndEditLeadControllerTest.cls b/force-app/main/default/classes/NewAndEditLeadControllerTest.cls new file mode 100644 index 0000000..81b8b34 --- /dev/null +++ b/force-app/main/default/classes/NewAndEditLeadControllerTest.cls @@ -0,0 +1,63 @@ +/* + * Author: Guo, Aline Yaying + * Created Date: 03/22/2022 + * Purpose: Test Class + * History: + * 03/22/2022 - Guo, Aline Yaying - Initial Code. + * + * */ +@isTest +private class NewAndEditLeadControllerTest { + @TestSetup + static void makeData(){ + List<String> strList= new List<String>(); + strList.add('Lead'); + strList.add('Contact'); + strList.add('Inquiry_form__c'); + TestDataUtility.CreatePIPolicyConfigurations(strList); + } + static testMethod void testMethod1() { + + Test.startTest(); + Lead leadTest = new Lead(); + Contact cont = new Contact(); + ApexPages.StandardController con = new ApexPages.StandardController(leadTest); + NewAndEditLeadController lead = new NewAndEditLeadController(con); + + String leadJson = '{"RecordTypeId":"01210000000QiRaAAK","Lead_No__c":"IN-JS-2022040127183","Status":"鏈窡杩�","Hospital_Name__c":"0011000000VAPEt","Department_Class__c":"0011000000V9bh5","Salutation":"","LastName":"***","Contact_Name__c":"0031m00000DHrkV","Cancel_Reason__c":"","Phone":"","Opp_Name_Search__c":"000000000000000","Email":"","Opp_Name__c":"Test","owner_not_automatically_update__c":false,"Purchase_Plan__c":"鏈�(鏃犻绠�)","Lead_Inquiry_form__c":"000000000000000","Opportunity_Division__c":"璇环","LeadSource":"鐢佃瘽","Campaign__c":"000000000000000","urgent__c":false,"SI_PromoteInquiry__c":false,"Request__c":"","Request_Detail__c":"","Opportunity_stage__c":"棰勭畻娌℃湁鎵瑰噯","Close_Forecasted_Date__c":"2022/04/01","Purchase_Reason__c":"鏇存柊","Sales_Method__c":"鍗曚竴鏉ユ簮閲囪喘","Fund_Basis__c":"閵�琛岃硣閲�","Purchase_Type__c":"涓�鑸紩鍚�","Company":"姹熻嫃鐪佷汉姘戝尰闄� 鍛煎惛绉� 鍛煎惛绉�","Name_Encrypted__c":"48a2693f6bf73d16e0abd48caf7fb756","Phone_Encrypted__c":"","Email_Encrypted__c":"","AWS_Data_Id__c":"959584917346320385"}'; + NewAndEditLeadController.saveLead(leadJson,'avgwshDFcxAS',False); + NewAndEditLeadController.saveLead(leadJson,'avgwshDFcxAS',True); + + Test.stopTest(); + } + + static testMethod void testMethod3() { + Lead leadTest = new Lead(); + String url = ApexPages.currentPage().getParameters().put('CF00N10000006ps6f_lkid','000000000000000'); + // ApexPages.currentPage().getParameters().put('CF00N10000002CvC5_lkid','000000000000000'); + // ApexPages.currentPage().getParameters().put('CF00N10000002CvC5','000000000000000'); + // ApexPages.currentPage().getParameters().put('CF00N10000002CvC5','000000000000000'); + + + + url = ApexPages.currentPage().getParameters().put('RecordType','01210000000QiRf'); + Test.startTest(); + try{ + NewAndEditLeadController.ControllerUtil(); + ApexPages.StandardController con = new ApexPages.StandardController(leadTest); + NewAndEditLeadController lc = new NewAndEditLeadController(con); + String jsonString = '["Department_Class__c"]'; + system.debug('jsonString:'+JSON.deserializeUntyped(jsonString)); + String token = lc.awsToken; + String AWSDataId = lc.AWSDataId; + String AWSDataIdInquiryForm = lc.AWSDataIdInquiryForm; + String contactId = lc.contactId;//For Lookup field + String contactsInfo = lc.contactsInfo ;//key sfid;value awsid + Inquiry_form__c ifc = lc.ifc; + NewAndEditLeadController.queryAccount(jsonString, '000000000000000'); + }catch(Exception e){ + system.debug('Exception from query account:'+e.getMessage()); + } + Test.stopTest(); + } +} \ No newline at end of file -- Gitblit v1.9.1