@isTest private class Xin_Infrastructure_ProjectTest { static testMethod void testMethod1() { RecordType rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'Hp']; Account acc = new Account(); acc.RecordTypeId = rectCo.Id; acc.Name = 'HP test1'; acc.Assume_Change__c = true; insert acc; Infrastructure_Project__c jijian = new Infrastructure_Project__c(); jijian.Name = 'ceshi jijian '; jijian.OCSM_Hospital__c = acc.Id; insert jijian; String a = acc.id; Xin_Infrastructure_Project xip = new Xin_Infrastructure_Project(); xip.getIsOverLimit(); xip.search(); try { xip.search('ceshi jijian',a); }catch(exception e){ } } }