@isTest public with sharing class ProRegisterLinkHandlerTest { static testMethod void AfterInsert() { Product_Register__c prorec = new Product_Register__c(); prorec.Name = 'SFDCTEST2018001'; prorec.MedPrdClass__c = '3'; prorec.RegisterNoClass_New__c = ''; prorec.RegisterNoClass_Old__c = '6822'; prorec.PrdCompanyAddr__c = '名称:奥林巴斯医疗株式会社;住所:日本国东京都涩谷区幡之谷二丁目43番地2号;联系方式:0081-426-42-2667'; prorec.RegisterNoStatus__c = '有效'; prorec.ValidTo__c = Date.today(); insert prorec; Product2__c product2 = new Product2__c(); product2.Name = 'WD18100A'; insert product2; Product2 pro = new Product2(); pro.Name = 'A00507A:密封圈, 透明, 黑色'; pro.MDM_Model_No__c = 'A00507A'; //pro.Register_Latest__c = 'a2wp0000000QYv3AAG'; pro.Brand_Name__c = '奥林巴斯'; pro.SFDA_Approbation_No__c = '国械注进20162220210'; pro.SFDA_Approbated_Date__c = Date.valueOf('2016-05-19'); pro.SFDA_Expiration_Date__c = Date.valueOf('2021-01-23'); pro.ProduceCompany__c = '名称:奥林巴斯苇音特和意北公司;住所:Kuehnstr.6122045 汉堡德国;联系方式:0049-40-66966-0'; pro.SFDA_Approbated_Status__c = '有效'; pro.RegisterNo_ALL__c = '国械注进20162220210'; insert pro; Product_Register_Link__c prl = new Product_Register_Link__c(Product_Register__c = prorec.ID); prl.Product2__c = pro.ID; insert prl; System.Test.startTest(); Product_Register_Link__c prl001 = new Product_Register_Link__c(Product_Register__c = prorec.ID); prl001.Product2__c = pro.ID; insert prl001; System.Test.stopTest(); } static testMethod void AfterUpdate() { Product_Register__c prorec = new Product_Register__c(); prorec.Name = 'SFDCTEST2018001'; prorec.MedPrdClass__c = '3'; prorec.RegisterNoClass_New__c = ''; prorec.RegisterNoClass_Old__c = '6822'; prorec.PrdCompanyAddr__c = '名称:奥林巴斯医疗株式会社;住所:日本国东京都涩谷区幡之谷二丁目43番地2号;联系方式:0081-426-42-2667'; prorec.RegisterNoStatus__c = '有效'; prorec.ValidTo__c = Date.today(); insert prorec; Product2__c product2 = new Product2__c(); product2.Name = 'WD18100A'; insert product2; Product2 pro = new Product2(); pro.Name = 'A00507A:密封圈, 透明, 黑色'; pro.MDM_Model_No__c = 'A00507A'; //pro.Register_Latest__c = 'a2wp0000000QYv3AAG'; pro.Brand_Name__c = '奥林巴斯'; pro.SFDA_Approbation_No__c = '国械注进20162220210'; pro.SFDA_Approbated_Date__c = Date.valueOf('2016-05-19'); pro.SFDA_Expiration_Date__c = Date.valueOf('2021-01-23'); pro.ProduceCompany__c = '名称:奥林巴斯苇音特和意北公司;住所:Kuehnstr.6122045 汉堡德国;联系方式:0049-40-66966-0'; pro.SFDA_Approbated_Status__c = '有效'; pro.RegisterNo_ALL__c = '国械注进20162220210'; insert pro; Product_Register_Link__c prl = new Product_Register_Link__c(Product_Register__c = prorec.ID); prl.Product2__c = pro.ID; insert prl; System.Test.startTest(); Product_Register_Link__c prl001 = new Product_Register_Link__c(Product_Register__c = prorec.ID); prl001.Product2__c = pro.ID; insert prl001; update prl001; System.Test.stopTest(); } static testMethod void AfterDelete() { Product_Register__c prorec = new Product_Register__c(); prorec.Name = 'SFDCTEST2018001'; prorec.MedPrdClass__c = '3'; prorec.RegisterNoClass_New__c = ''; prorec.RegisterNoClass_Old__c = '6822'; prorec.PrdCompanyAddr__c = '名称:奥林巴斯医疗株式会社;住所:日本国东京都涩谷区幡之谷二丁目43番地2号;联系方式:0081-426-42-2667'; prorec.RegisterNoStatus__c = '有效'; prorec.ValidTo__c = Date.today(); insert prorec; Product2__c product2 = new Product2__c(); product2.Name = 'WD18100A'; insert product2; Product2 pro = new Product2(); pro.Name = 'A00507A:密封圈, 透明, 黑色'; pro.MDM_Model_No__c = 'A00507A'; //pro.Register_Latest__c = 'a2wp0000000QYv3AAG'; pro.Brand_Name__c = '奥林巴斯'; pro.SFDA_Approbation_No__c = '国械注进20162220210'; pro.SFDA_Approbated_Date__c = Date.valueOf('2016-05-19'); pro.SFDA_Expiration_Date__c = Date.valueOf('2021-01-23'); pro.ProduceCompany__c = '名称:奥林巴斯苇音特和意北公司;住所:Kuehnstr.6122045 汉堡德国;联系方式:0049-40-66966-0'; pro.SFDA_Approbated_Status__c = '有效'; pro.RegisterNo_ALL__c = '国械注进20162220210'; insert pro; Product_Register_Link__c prl = new Product_Register_Link__c(Product_Register__c = prorec.ID); prl.Product2__c = pro.ID; insert prl; System.Test.startTest(); Product_Register_Link__c prl001 = new Product_Register_Link__c(Product_Register__c = prorec.ID); prl001.Product2__c = pro.ID; insert prl001; delete prl001; System.Test.stopTest(); } }