@isTest private class LexOtherButtonMcTest { @isTest static void test_method_one() { Oly_TriggerHandler.bypass(Product2Handler.Class.getName()); Oly_TriggerHandler.bypass(AssetHandler.Class.getName()); Oly_TriggerHandler.bypass(FixtureSetHandler.Class.getName()); Oly_TriggerHandler.bypass(RentalApplyTriggerHandler.Class.getName()); Oly_TriggerHandler.bypass(RentalApplyEquipmentSetHandler.Class.getName()); Oly_TriggerHandler.bypass(RentalApplyEquipmentSetDetailHandler.Class.getName()); Oly_TriggerHandler.bypass(ContactTriggerHandler.Class.getName()); Oly_TriggerHandler.bypass('AssetTrigger'); Oly_TriggerHandler.bypass('MaintenanceContractTrigger'); Oly_TriggerHandler.bypass('MaintenanceContractAfterUpdate'); Oly_TriggerHandler.bypass('MaintenanceContractBeforeDelete'); Oly_TriggerHandler.bypass('MaintenanceContractHpDeptUpd'); Oly_TriggerHandler.bypass('NFM106Controller'); Oly_TriggerHandler.bypass('NFM101Controller'); Oly_TriggerHandler.bypass('NFM001AgencyContract'); // 病院を作る 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; // 戦略科室を得る List strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_GI']; // 診療科を作る Account dep = new Account(); dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_GI'].id; dep.Name = 'test dep'; dep.ParentId = strategicDep[0].Id; dep.Department_Class__c = strategicDep[0].Id; dep.Hospital__c = hospital.Id; insert dep; // 维修合同を作成する Maintenance_Contract__c contract = new Maintenance_Contract__c(); contract.Name = 'tect contract'; contract.Hospital__c = hospital.Id; contract.Department_Class__c = strategicDep[0].Id; contract.Department__c = dep.Id; insert contract; // 维修合同を作成する Maintenance_Contract__c contract1 = new Maintenance_Contract__c(); contract1.Name = 'tect contract'; contract1.Hospital__c = hospital.Id; contract1.Department_Class__c = strategicDep[0].Id; contract1.Department__c = dep.Id; contract1.Maintenance_Contract_No__c = 'contact1'; contract1.Contract_Conclusion_Date__c = Date.today(); contract1.Inspection_Time__c = '4'; contract1.Contract_End_Date__c = Date.today().addMonths(+28); contract1.Contract_Start_Date__c = Date.today(); contract1.Contract_Range__c = Decimal.valueOf('28'); insert contract1; List mcidList = new List(); mcidList.add(contract1.Id); LexOtherButtonMc.up2sap(contract.Id); LexOtherButtonMc.up2sap(contract1.Id); delete contract; LexOtherButtonMc.up2sap(contract.Id); LexOtherButtonMc.Check_plan(mcidList); } @isTest static void test_method_two() { Oly_TriggerHandler.bypass(Product2Handler.Class.getName()); Oly_TriggerHandler.bypass(AssetHandler.Class.getName()); Oly_TriggerHandler.bypass(FixtureSetHandler.Class.getName()); Oly_TriggerHandler.bypass(RentalApplyTriggerHandler.Class.getName()); Oly_TriggerHandler.bypass(RentalApplyEquipmentSetHandler.Class.getName()); Oly_TriggerHandler.bypass(RentalApplyEquipmentSetDetailHandler.Class.getName()); Oly_TriggerHandler.bypass(ContactTriggerHandler.Class.getName()); Oly_TriggerHandler.bypass('AssetTrigger'); Oly_TriggerHandler.bypass('MaintenanceContractTrigger'); Oly_TriggerHandler.bypass('MaintenanceContractAfterUpdate'); Oly_TriggerHandler.bypass('MaintenanceContractBeforeDelete'); Oly_TriggerHandler.bypass('MaintenanceContractHpDeptUpd'); Oly_TriggerHandler.bypass('NFM106Controller'); Oly_TriggerHandler.bypass('NFM101Controller'); Oly_TriggerHandler.bypass('NFM001AgencyContract'); // 病院を作る 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; // 戦略科室を得る List strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_GI']; // 診療科を作る Account dep = new Account(); dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_GI'].id; dep.Name = 'test dep'; dep.ParentId = strategicDep[0].Id; dep.Department_Class__c = strategicDep[0].Id; dep.Hospital__c = hospital.Id; insert dep; // 维修合同を作成する Maintenance_Contract__c contract = new Maintenance_Contract__c(); contract.Name = 'tect contract'; contract.Hospital__c = hospital.Id; contract.Department_Class__c = strategicDep[0].Id; contract.Department__c = dep.Id; insert contract; // 维修合同を作成する Maintenance_Contract__c contract1 = new Maintenance_Contract__c(); contract1.Name = 'tect contract'; contract1.Hospital__c = hospital.Id; contract1.Department_Class__c = strategicDep[0].Id; contract1.Department__c = dep.Id; contract1.Maintenance_Contract_No__c = 'contact1'; contract1.Contract_Conclusion_Date__c = Date.today(); contract1.Inspection_Time__c = '1'; contract1.Contract_End_Date__c = Date.today().addMonths(+20); contract1.Contract_Start_Date__c = Date.today(); contract1.Contract_Range__c = Decimal.valueOf('20'); contract1.old_Is_RecognitionModel__c = true; contract1.Is_Recognition_Model_True__c = false; insert contract1; List mcidList = new List(); mcidList.add(contract1.Id); LexOtherButtonMc.up2sap(contract.Id); LexOtherButtonMc.up2sap(contract1.Id); contract1.old_Is_RecognitionModel__c = false; contract1.Is_Recognition_Model_True__c = false; update contract1; delete contract; LexOtherButtonMc.up2sap(contract.Id); LexOtherButtonMc.Check_plan(mcidList); } }