@isTest private class AfterUpdateAssetTriggerTest { /*final static Integer okStatus = 99; static testMethod void myUnitTest() { // 病院を作る 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; // 产品 Product2 pro1 = new Product2(Name='name01',IsActive=true,Family='GI',Asset_Model_No__c='n01',Serial_Lot_No__c='S/N tracing',ProductCode_Ext__c='pc01',Manual_Entry__c=false); Product2 pro2 = new Product2(Name='name02',IsActive=true,Family='GI',Asset_Model_No__c='n02',Serial_Lot_No__c='Lot tracing',ProductCode_Ext__c='pc02',Manual_Entry__c=false); insert new Product2[] {pro1, pro2}; // 资产 Asset asset1 = new Asset(Asset_Owner__c = 'Olympus'); asset1.RecordTypeId = System.Label.Asset_RecordType; asset1.SerialNumber = 'ass01'; asset1.Internal_Asset_number__c = 'ian01'; asset1.Name = 'ass01'; asset1.AccountId = dep.Id; asset1.Department_Class__c = strategicDep[0].Id; asset1.Hospital__c = hospital.Id; asset1.Product2Id = pro1.Id; asset1.Internal_asset_location__c = '北京'; Asset asset2 = new Asset(Asset_Owner__c = 'Olympus'); asset2.RecordTypeId = System.Label.Asset_RecordType; asset2.SerialNumber = 'ass02'; asset2.Internal_Asset_number__c = 'ian02'; asset2.Name = 'ass02'; asset2.AccountId = dep.Id; asset2.Department_Class__c = strategicDep[0].Id; asset2.Hospital__c = hospital.Id; asset2.Product2Id = pro2.Id; asset2.Internal_asset_location__c = '北京'; insert new Asset[] {asset1, asset2}; //备品set Equipment_Set__c equipmentSet1 = new Equipment_Set__c(); equipmentSet1.Name = '备品Set01'; equipmentSet1.CurrencyIsoCode = 'CNY'; equipmentSet1.Loaner_code__c = '备品Set01'; equipmentSet1.Internal_asset_location__c = '北京'; insert new Equipment_Set__c[] {equipmentSet1}; //备品set明细 Equipment_Set_Detail__c equipmentSetDetail1 = new Equipment_Set_Detail__c(); equipmentSetDetail1.Name = '备品set明细01'; equipmentSetDetail1.Equipment_Set__c = equipmentSet1.Id; equipmentSetDetail1.Asset__c = asset1.Id; equipmentSetDetail1.CurrencyIsoCode = 'CNY'; equipmentSetDetail1.Active_judgement_text__c = okStatus; Equipment_Set_Detail__c equipmentSetDetail2 = new Equipment_Set_Detail__c(); equipmentSetDetail2.Name = '备品set明细02'; equipmentSetDetail2.Equipment_Set__c = equipmentSet1.Id; equipmentSetDetail2.Asset__c = asset2.Id; equipmentSetDetail2.CurrencyIsoCode = 'CNY'; equipmentSetDetail2.Active_judgement_text__c = okStatus; insert new Equipment_Set_Detail__c[] {equipmentSetDetail1, equipmentSetDetail2}; asset1.Internal_asset_location__c = '上海'; asset2.Internal_asset_location__c = '上海'; update new Asset[] {asset1,asset2}; Equipment_Set__c es = [select id,Internal_asset_location__c from Equipment_Set__c where Id = :equipmentSet1.id]; System.assertEquals('上海', es.Internal_asset_location__c); try { asset1.Internal_asset_location__c = '北京'; update asset1; } catch (Exception e) { System.assertEquals(false, String.isBlank(e.getMessage())); } Equipment_Set__c es2 = [select id,Internal_asset_location__c from Equipment_Set__c where Id = :equipmentSet1.id]; System.assertEquals('上海', es2.Internal_asset_location__c); Asset ass1 = [select id,Internal_asset_location__c from Asset where id = :asset1.id]; Asset ass2 = [select id,Internal_asset_location__c from Asset where id = :asset2.id]; System.assertEquals('上海', ass1.Internal_asset_location__c); System.assertEquals('上海', ass2.Internal_asset_location__c); }*/ }