From 4cf305347ea6f6a73e03fa9427a3de80ca35ae7a Mon Sep 17 00:00:00 2001 From: buli <137736985@qq.com> Date: 星期一, 25 四月 2022 14:37:30 +0800 Subject: [PATCH] SSBGEnhancement0425 --- force-app/main/default/classes/NewAndEditContactControllerTest.cls | 31 ++++++++++++++++++++++++++++++- 1 files changed, 30 insertions(+), 1 deletions(-) diff --git a/force-app/main/default/classes/NewAndEditContactControllerTest.cls b/force-app/main/default/classes/NewAndEditContactControllerTest.cls index 15bfa27..697641a 100644 --- a/force-app/main/default/classes/NewAndEditContactControllerTest.cls +++ b/force-app/main/default/classes/NewAndEditContactControllerTest.cls @@ -6,7 +6,10 @@ } static testMethod void NewAndEditContactController() { Test.setMock(HttpCalloutMock.class, new TestDataUtility.CreateMetaDataUtilityHttpMock()); - Contact con = TestDataUtility.CreateContacts(1)[0]; + // Contact con = TestDataUtility.CreateContacts(1)[0]; + Account acc = TestDataUtility.CreateAccounts(1)[0]; + Contact con = new Contact(); + String url = ApexPages.currentPage().getParameters().put('retURL','/'+acc.Id); Test.startTest(); ApexPages.StandardController sc = new ApexPages.StandardController(con); @@ -15,6 +18,32 @@ String qisJson = '{"AccountId":"0010l00001Q1r4e","OwnerId":"0050l0000061MOe","Department":"","MobilePhone":"***********","Title":"","Phone":"","Salutation":"","LastName":"***","Fax":"","ContactEnglishName__c":"","OtherPhone":"","ManagementCode_Ext__c":"","Email":"*****@company.com","isBatch__c":false,"TechnicalServiceCreated__c":false,"IsNew__c":false,"isServiceCreate__c":false,"Postcode__c":"**********","Address1__c":"**********","Address2__c":"","Address3__c":"","EnglishAddress__c":"","ProductSegmentBS__c":false,"ProductSegmentRVI__c":false,"ProductSegmentIE__c":false,"ProductSegmentNDT__c":false,"ProductSegmentANI__c":false,"StatusD__c":"Draft","ContactStatus__c":"Active","CancelReason__c":"","Remark__c":"","Phone_Encrypted__c":"","OtherPhone_Encrypted__c":"","MobilePhone_Encrypted__c":"64bd0db056d0bfd21fae76cc5dbdf4d1","PhoneD_Encrypted__c":null,"OtherPhoneD_Encrypted__c":null,"MobilePhoneD_Encrypted__c":null,"Email_Encrypted__c":"68fda69bb586ec70073b015fbff6c19420b838c523e79c9737c6fe095fd5cc55","EmailD_Encrypted__c":null,"FaxD_Encrypted__c":null,"Address3D_Encrypted__c":null,"Address1D_Encrypted__c":null,"Address3_Encrypted__c":"","Address2D_Encrypted__c":null,"Address1_Encrypted__c":"2df1bc4bf3800c5e05e3d9f394c3446567d1f05482d2295650b7b50e9e4aa97a92338985c9693f576e1e6df667aaee46","EnglishAddress_Encrypted__c":"","ContactEnglishName_Encrypted__c":"","Title_Encrypted__c":"","TitleD_Encrypted__c":null,"PostcodeD_Encrypted__c":null,"Postcode_Encrypted__c":"ecec26168c09cf090b8b4a95ca524a61","LastName_Encrypted__c":"dcce196c4cfc273a83777852ddd486ab","PhoneD__c":null,"OtherPhoneD__c":null,"MobilePhoneD__c":null,"EmailD__c":null,"FaxD__c":null,"Address3D__c":null,"Address2D__c":null,"Address1D__c":null,"TitleD__c":null,"PostcodeD__c":null,"AWS_Data_Id__c":"962006242048344064"}'; NewAndEditContactController.saveContact(qisJson,'avgwshDFcxAS',False); NewAndEditContactController.saveContact(qisJson,'avgwshDFcxAS',True); + + qis.PageLoad(); Test.stopTest(); } + /*static testMethod void testMethod3() { + + Test.setMock(HttpCalloutMock.class, new TestDataUtility.CreateMetaDataUtilityHttpMock()); + // Contact contactTest = TestDataUtility.CreateContacts(1)[0]; + Account acc = TestDataUtility.CreateAccounts(1)[0]; + //Account acc1 = [SELECT Id,Name FROM Account WHERE RecordType.DeveloperName = 'Office' OR RecordType.DeveloperName = 'AgencyContact' OR RecordType.DeveloperName = 'Agency' Limit 1]; + String accrecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId(); + Account acc1 = new Account(Name = 'testacc1',RecordTypeId = accrecordTypeId); + insert acc1; + + + String recordTypeId = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Account').getRecordTypeId(); + String url = ApexPages.currentPage().getParameters().put('RecordType',recordTypeId); + url = ApexPages.currentPage().getParameters().put('accid',acc1.Id); + url = ApexPages.currentPage().getParameters().put('con4_lkid',acc1.Id); + + Test.startTest(); + ApexPages.StandardController con = new ApexPages.StandardController(new Contact()); + NewAndEditContactController cont = new NewAndEditContactController(con); + // cont.rtTypeId + + cont.PageLoad(); + Test.stopTest(); + }*/ } \ No newline at end of file -- Gitblit v1.9.1