@Istest public class lexConsumApplyControllerTest { static testMethod void testMethod01(){ // 学会 List recordTypeIds = new List(); recordTypeIds.add(Schema.SObjectType.Campaign.getRecordTypeInfosByDeveloperName().get('Society').getRecordTypeId()); //学会/会议 Campaign campaign01 = new Campaign(); campaign01.RecordTypeId = recordTypeIds.get(0); campaign01.StartDate = Date.newInstance(2020,10,29); campaign01.Name = 'Test'; campaign01.EndDate = Date.newInstance(2020,10,30); campaign01.Status = '草案中'; campaign01.Is_LendProduct__c = '是'; campaign01.PlanBackData__c = Date.newInstance(2020,11,30); //计划撤展日期 campaign01.LoadNum__c = '3D主机*2; BF-290镜子*4; CV-170*1; CV-190*6;'; //计划出借备品信息 campaign01.HostName__c = '1'; campaign01.cooperatorCompany__c = '1'; insert campaign01; //耗材备品申请 Consum_Apply__c ca = new Consum_Apply__c(); ca.Name = 'XXXX-YYYY_ZZZZ_1'; ca.Status__c = '批准'; ca.Campaign__c = campaign01.id; ca.DataMigration_Flag__c = true; insert ca; lexConsumApplyController.init(ca.id); Consum_Apply_Equipment_Set__c caes = new Consum_Apply_Equipment_Set__c(); caes.Consum_Apply__c = ca.Id; caes.Consum_Start_Date__c = Date.today().addDays(20); caes.DataMigration_Flag__c = true; insert caes; lexConsumApplyController.getLength1(ca.id); lexConsumApplyController.getLength2(ca.id); lexConsumApplyController.getSet(caes.id); } }