@isTest private class Solution_ProgrammeTriggerTest { private static User getUser() { String timenow = Datetime.now().format('yyyyMMddHHmmss'); User user1 = new User(Test_staff__c = true, LastName = 'TestMao', FirstName = 'TestMaoF', Alias = 'hp', CommunityNickname = 'TestMao', Email = 'Test@sunbridge.com', Username = 'Test' + timenow + '@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = System.Label.ProfileId_SystemAdmin, Dept__c = '医疗华北营业本部', Job_Category__c = '销售服务', Province__c = '北京'); List p = [Select Id From Profile Where Name = '2S1_销售医院担当']; System.assertEquals(p.size(), 1); System.runAs(new User(Id = Userinfo.getUserId())) { insert user1; } return user1; } static testMethod void testMethod1() { User user = getUser(); SolutionProjectRequirements__c solProject = new SolutionProjectRequirements__c(); solProject.Name = 'Test'; solProject.HospitalOwner__c = user.Id; solProject.Sales_Assistant__c = user.Id; solProject.GIR_Assistant__c = user.Id; solProject.Project_Type__c = '新建大楼'; solProject.Purpose_Proposal__c = '促进销售商谈'; insert solProject; Solution_Programme__c solProgramme1 = new Solution_Programme__c(); solProgramme1.Name = 'test'; solProgramme1.SolutionProjectRequirements__c = solProject.Id; solProgramme1.Business_Promotion__c = user.id; insert solProgramme1; solProgramme1.Proposal_Date__c = Date.today(); solProgramme1.ProcessOfApproval__c = true; solProgramme1.Confirmation_Result__c = '01采纳/部分采纳'; solProgramme1.Remarks__c = '01'; update solProgramme1; solProgramme1.Confirmation_Result__c = '02未采纳'; solProgramme1.ProcessOfApproval__c = true; solProgramme1.Remarks__c = '02'; update solProgramme1; solProgramme1.Confirmation_Result__c = '03跟进中'; solProgramme1.ProcessOfApproval__c = true; solProgramme1.Remarks__c = '03'; update solProgramme1; solProgramme1.Confirmation_Result__c = '04其他'; solProgramme1.ProcessOfApproval__c = true; solProgramme1.Remarks__c = '04'; update solProgramme1; } }