@isTest public class InquiryFormControllerTest { private static User setupUser(){ User u = new User(alias = 'manager', email='manager@acme.com', emailencodingkey='UTF-8', lastname='manager', languagelocalekey='en_US', localesidkey='ja_JP', profileid = System.Label.ProfileId_SystemAdmin, timezonesidkey='Asia/Shanghai', username='manager@acme.com' + Datetime.now().getTime(), ZongjianApprovalManager__c = UserInfo.getUserId() ); insert u; return u; } static testMethod void testMethod1() { User u = setupUser(); System.runAs (u){ Inquiry_form__c inquiryform = new Inquiry_form__c(); inquiryform.Name = '2019102101'; inquiryform.Request1__c = '需要报价'; inquiryform.Product1__c = '超声'; inquiryform.FSE_Owner__c = u.id; insert inquiryform; InquiryFormController.init(inquiryform.Id); InquiryFormController.init(null); // InquiryFormController.getUserName(''); InquiryFormController.sqlResult(inquiryform.Id); InquiryFormController.sqlResult(null); } } }