Li Jun
2022-04-06 fb04e7c01d119c60632b4298d18fd93f3ccb3d79
force-app/main/default/classes/CampaignMemberServiceControllerTest.cls
@@ -1,7 +1,11 @@
@isTest
private class CampaignMemberServiceControllerTest {
    @testSetup static void testSetupMethod() {
    @testSetup
    static void makeData(){
        TestDataUtility.CreatePIPolicyConfiguration('Contact');
    }
    static void testSetupMethod() {
        RecordType rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'Hp'];
        List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName IN ('Department_GI', 'Department_BF') order by DeveloperName desc];
@@ -28,7 +32,7 @@
        depart2.Department_Class__c = dept[1].Id;
        depart2.Hospital__c         = acc.Id;
        insert new Account[] {depart1, depart2};
        Test.startTest();
        Contact con = new Contact();
        con.LastName = 'lastname2';
        con.FirstName = 'firstname2';
@@ -111,11 +115,11 @@
        upsert cmList;
        Test.stopTest();
    }
    @isTest static void test_method_one() {
        testSetupMethod();
        list<Campaign> camlist = [select id from campaign];
        Campaign cam = camlist[0];
        PageReference page = new PageReference('/apex/CampaignMemberService?id=' + cam.Id);
@@ -148,6 +152,7 @@
    }
    @isTest static void test_method_two() {
        testSetupMethod();
        list<Campaign> camlist = [select id from campaign];
        Campaign cam1 = camlist[0];
        RecordType rectCA = [select Id from RecordType where IsActive = true and SobjectType = 'Campaign'
@@ -166,10 +171,10 @@
        Contact con1 = new Contact();
        con1.LastName = 'testname2';
        con1.FirstName = 'firstname2';
        con1.LastName = 'testname2V2';
        con1.FirstName = 'firstname2V2';
        con1.Email = 'olympustest0331@sunbridge.com';
        con1.MobilePhone = '999999199';
        con1.MobilePhone = '999999199V2';
        con1.Work_Location_manual__c = 'location2';
        con1.Post_picklist__c = '部长';
        con1.Job_Category_picklist__c = '销售推广';