| | |
| | | strList.add('Contact'); |
| | | strList.add('Inquiry_form__c'); |
| | | TestDataUtility.CreatePIPolicyConfigurations(strList); |
| | | Lead leadTest = TestDataUtility.CreateLead(1)[0]; |
| | | Contact cont = TestDataUtility.CreateContacts(1)[0]; |
| | | Inquiry_form__c iqf = TestDataUtility.CreateInquiryform(1)[0]; |
| | | } |
| | | static testMethod void testMethod1() { |
| | | |
| | | Test.setMock(HttpCalloutMock.class, new TestDataUtility.CreateMetaDataUtilityHttpMock()); |
| | | Lead leadTest = [SELECT Id FROM Lead Limit 1]; |
| | | Contact cont = [SELECT Id FROM Contact Limit 1]; |
| | | Inquiry_form__c iqf = [SELECT Id FROM Inquiry_form__c Limit 1]; |
| | | |
| | | Test.startTest(); |
| | | Lead leadTest = new Lead(); |
| | | Contact cont = new Contact(); |
| | | ApexPages.StandardController con = new ApexPages.StandardController(leadTest); |
| | | NewAndEditLeadController lead = new NewAndEditLeadController(con); |
| | | |
| | | String leadJson = JSON.serialize(leadTest); |
| | | 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 testMethod2() { |
| | | Lead leadTest = [SELECT Id FROM Lead Limit 1]; |
| | | Contact cont = [SELECT Id,AccountId FROM Contact Limit 1]; |
| | | Inquiry_form__c iqf = [SELECT Id,Contact_Id__c FROM Inquiry_form__c Limit 1]; |
| | | |
| | | String url = ApexPages.currentPage().getParameters().put('CF00N1000000962np_lkid',iqf.id); |
| | | url = ApexPages.currentPage().getParameters().put('RecordType','01210000000QiRaAAK'); |
| | | url = ApexPages.currentPage().getParameters().put('CF00N10000006ps6f_lkid',iqf.Contact_Id__c); |
| | | url = ApexPages.currentPage().getParameters().put('CF00N10000002CvC5_lkid',cont.AccountId); |
| | | |
| | | Test.startTest(); |
| | | Test.setMock(HttpCalloutMock.class, new TestDataUtility.CreateMetaDataUtilityHttpMock()); |
| | | ApexPages.StandardController lds = new ApexPages.StandardController(new Contact()); |
| | | NewAndEditLeadController ld = new NewAndEditLeadController(lds); |
| | | Test.stopTest(); |
| | | } |
| | | static testMethod void testMethod3() { |
| | | Lead leadTest = new Lead(); |
| | | Contact cont = [SELECT Id, AccountId FROM Contact Limit 1]; |
| | | |
| | | String url = ApexPages.currentPage().getParameters().put('CF00N10000006ps6f_lkid',cont.id); |
| | | 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.setMock(HttpCalloutMock.class, new TestDataUtility.CreateMetaDataUtilityHttpMock()); |
| | | |
| | | Test.startTest(); |
| | | ApexPages.StandardController con = new ApexPages.StandardController(leadTest); |
| | | NewAndEditLeadController lc = new NewAndEditLeadController(con); |
| | | String jsonString = '["Department_Class__c"]'; |
| | | system.debug('jsonString:'+JSON.deserializeUntyped(jsonString)); |
| | | NewAndEditLeadController.queryAccount(jsonString, cont.AccountId); |
| | | 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(); |
| | | } |
| | | } |