19626
2023-06-20 1ee9818f763b1910c24d52ebc61a715afea370bb
force-app/main/default/classes/NewAndEditLeadControllerTest.cls
@@ -33,9 +33,72 @@
        Test.stopTest();
    }
    static testMethod void testMethod2() {
        Lead leadTest = new Lead();
        leadTest.LastName = 'test';
        leadTest.Company = 'test';
        insert leadTest;
        String url = ApexPages.currentPage().getParameters().put('CF00N10000006ps6f_lkid','000000000000000');
        url = ApexPages.currentPage().getParameters().put('CF00N10000002CvC5_lkid','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();
    }
    static testMethod void testMethod3() {
        Lead leadTest = new Lead();
        String url = ApexPages.currentPage().getParameters().put('CF00N10000006ps6f_lkid','000000000000000');
        url = ApexPages.currentPage().getParameters().put('CF00N10000002CvC5_lkid','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();
    }
    static testMethod void testMethod4() {
        // Lead leadTest = new Lead();
        Lead leadTest = new Lead();
        leadTest.LastName = 'test';
        leadTest.Company = 'test';
        insert leadTest;
        Inquiry_form__c inquiryform = new Inquiry_form__c();
        inquiryform.Name = '2019102101';
        inquiryform.Request1__c = '需要报价';
        inquiryform.Product1__c = '超声';
        inquiryform.FSE_Owner__c  = UserInfo.getUserId();
        insert inquiryform;
        String url = ApexPages.currentPage().getParameters().put('CF00N1000000962np_lkid',inquiryform.id);
        url = ApexPages.currentPage().getParameters().put('RecordType','01210000000QiRf');
        Test.startTest();
        try{