@isTest private class LexRepairCloneButtonControllerTest { @testSetup static void setupTestData(){ } @isTest static void tesMethod1(){ List rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院']; Account myAccount1 = new Account(name='Testaccount001-1',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888',GI_Main__c = '00510000001rcZh'); insert myAccount1; Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false); insert prod07; Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false); insert prod01; String ReRecordTypeId = Schema.SObjectType.Repair__c.getRecordTypeInfosByDeveloperName().get('Repair').getRecordTypeId(); System.debug(ReRecordTypeId); String AsRecordTypeId = Schema.SObjectType.Asset.getRecordTypeInfosByDeveloperName().get('HPAsset').getRecordTypeId(); System.debug(AsRecordTypeId); Asset ass = new Asset(); ass.Hospital__c = myAccount1.Id; // ass.Hospital__c = '0011000000VAVA5'; ass.RecordTypeId = AsRecordTypeId; ass.Product2Id = prod07.Id; // ass.AccountId = '0011000000VAVA5'; ass.AccountId = myAccount1.Id; ass.Asset_Owner__c = '医院资产'; ass.Name = 'Test'; ass.SerialNumber = '1234567'; insert ass; Repair__c rep = new Repair__c(); rep.Delivered_Product__c = ass.Id; rep.Hospital__c = myAccount1.Id; rep.SalesOfficeCode_selection__c = '北京'; rep.SalesOfficeCode_selection__c = 'RC修理'; rep.work_location_select__c = '北京办事处'; rep.Repair_Detail__c = 'Test'; rep.RecordTypeId = ReRecordTypeId; rep.Agreed_Date__c = System.today(); rep.Status__c = '0.删除'; insert rep; // List rep2 = [SELECT Id FROM Repair__c WHERE Status__c = '0.删除' LIMIT 1]; LexRepairCloneButtonController.checkStatus(rep.Id); // List rep1 = [SELECT Id FROM Repair__c WHERE Status__c != '0.删除' LIMIT 1]; LexRepairCloneButtonController.checkStatus(rep.Id); // LexRepairCloneButtonController.LexRepairCloneButtonController(); LexRepairCloneButtonController repController= new LexRepairCloneButtonController(); } }