@isTest public with sharing class LexOPDSupplementaryControllerTest { @isTest static void testMethod1(){ RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ]; List rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName IN ('Department_GI', 'Department_BF') order by DeveloperName desc]; // 病院を作る Account hospital = new Account(); hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id; hospital.Name = 'test hospital'; insert hospital; // 戦略科室を得る Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH']; // 診療科を作る Account dep = new Account(); dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id; dep.Name = 'test dep'; dep.AgentCode_Ext__c = '9999998'; dep.ParentId = strategicDep[0].Id; dep.Department_Class__c = strategicDep[0].Id; dep.Hospital__c = hospital.Id; insert dep; Opportunity opp1 = new Opportunity( Name='testOpp1', StageName='引合', CloseDate=Date.today(), AccountId=dep.Id, Competitor__c ='A', Click_Close_Date__c = null, RecordType = rectOpp ); insert opp1; OPDPlan__c opd = new OPDPlan__c(); opd.Status__c = '草案中'; opd.OPDPlan_ImplementDate__c = Date.today().addDays(5); opd.NoOpp_Reason__c = 'HCP对应'; opd.OPDType__c = '科室'; insert opd; LexOPDSupplementaryController.init('123'); LexOPDSupplementaryController.init(opd.Id); LexOPDSupplementaryController.getTheOPDPlan('真的'); LexOPDSupplementaryController.getTheOPDPlan(opd.Id); LexOPDSupplementaryController.init2(opd.Id); LexOPDSupplementaryController.init2('1231233'); LexOPDSupplementaryController.NewAndUpdateOPDStatus(opd.Id); LexOPDSupplementaryController.NewAndUpdateOPDStatus('12323232'); LexOPDSupplementaryController.init3('12323232'); LexOPDSupplementaryController.init3(opd.Id); LexOPDSupplementaryController.reapplyFindOPD('12323232'); LexOPDSupplementaryController.reapplyFindOPD(opd.Id); LexOPDSupplementaryController.initNewOPDButton(dep.Id); LexOPDSupplementaryController.initNewOPDButton('12323'); LexOPDSupplementaryController.initCancleSumbit('123'); LexOPDSupplementaryController.initCancleSumbit(opd.Id); LexOPDSupplementaryController.initReportSubmit('123'); LexOPDSupplementaryController.initReportSubmit(opd.Id); LexOPDSupplementaryController.cloneOPD(opd.Id); LexOPDSupplementaryController.cloneOPD('123'); LexOPDSupplementaryController.getRecordTypeByNameAndSobject('办事处','Account'); LexOPDSupplementaryController.getRecordTypeByNameAndSobject('123','12323'); //LexOPDPostPoneController LexOPDPostPoneController.init('123'); LexOPDPostPoneController.init(opd.Id); LexOPDPostPoneController.findRecordId(); } }