/* * Author: Zhang,Heyang * Created Date: 2023/08/07 * Purpose: TestClass * * */ @isTest private class LexSearchLookupControllerTest { @isTest static void tesMethod1(){ List rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院']; Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888'); 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__c proG = new Product2__c(Name='MH-155:白平衡帽',OT_CODE_Text__c='Test001',Product2__c = prod07.Id); insert proG; String RecordTypeId = Schema.SObjectType.Asset.getRecordTypeInfosByDeveloperName().get('HPAsset').getRecordTypeId(); System.debug(RecordTypeId); //住所阶层1 Address_Level__c ad = new Address_Level__c(); ad.Name = 'Test'; insert ad; Address_Level2__c add = new Address_Level2__c(); add.Address_Level__c = ad.Id; insert add; Asset ass = new Asset(); ass.Hospital__c = myAccount1.Id; ass.RecordTypeId = RecordTypeId; ass.Product_Old__c = prod07.Id; ass.Product2Id = prod07.Id; 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 = '01210000000QmS9AAK'; // rep.Agreed_Date__c = System.today(); // insert rep; Opportunity opp = new Opportunity(); opp.Hospital__c = myAccount1.Id; opp.Opportunity_Category__c = 'GI'; opp.SAP_Province__c = '安徽省'; opp.StageName = '询价'; opp.Name = 'Test'; opp.ifOpenBid__c = '公开招标'; opp.Sales_Method__c = '政府招标'; opp.CloseDate = System.today(); insert opp; Contact con = new Contact(); con.LastName = 'Test'; insert con; // LexSearchLookupController.getCityByProvince(add.Address_Level__c); // LexSearchLookupController.getCityByProvince(''); // LexSearchLookupController.getCityByProvince('1234'); // LexSearchLookupController.getAssetByAccount(ass.Hospital__c); // LexSearchLookupController.getAssetByAccount('Test'); // LexSearchLookupController.getAssetByAccount(''); // LexSearchLookupController.getRepairByAccount(rep.Hospital__c); // LexSearchLookupController.getRepairByAccount(''); // LexSearchLookupController.getRepairByAccount('Test'); // LexSearchLookupController.getOpportunityByAccount(opp.Hospital__c); // LexSearchLookupController.getOpportunityByAccount('Test'); // LexSearchLookupController.getOpportunityByAccount(''); List searchFieldArray = new List(); List searchFieldArray1 = new List(); searchFieldArray.add('LastName'); searchFieldArray1.add(con.LastName); LexSearchLookupController.getObjectInfo('Contact',searchFieldArray,'','LastName','Test'); LexSearchLookupController.getObjectInfo('Contact',searchFieldArray1,'','LastName','Test'); } }