@isTest private class EnquiryDetailsWebServiceTest { @isTest static void TestMethod1() { List users = [select Id,Name,LastName, FirstName from User]; Opportunity opp = new Opportunity(); opp.Name = 'Testname0801'; opp.StageName = '目標'; opp.Close_Forecasted_Date__c = Date.today(); opp.Close_Forecasted_Assume_Date__c = Date.today().addDays(2); opp.Opportunity_No__c = '0801'; opp.CloseDate = Date.today().addDays(1); opp.Sales_assistant_name_text__c = users[0].Id; opp.Manager_name_text__c = users[0].Id; insert opp; InquiryPredictsDateChange__c ipd = new InquiryPredictsDateChange__c(); ipd.Opportunity__c = opp.Id; ipd.Date_InAdvance_Delay__c = '提前'; ipd.CloseDate__c = Date.today(); ipd.Close_Forecasted_Date__c = Date.today(); ipd.Close_Forecasted_Assume_Date__c = Date.today(); ipd.Predicted_date_ChangeReason__c = '20220801'; ipd.Predicted_Date_Status__c = '审批中'; ipd.Manager_name__c = users[0].Id; ipd.Sales_assistant_name__c = users[0].Id; insert ipd; EnquiryDetailsWebService.change(opp.Id); } @isTest static void TestMethod2() { List users = [select Id,Name,LastName, FirstName from User]; Opportunity opp = new Opportunity(); opp.Name = 'Testname0801'; opp.StageName = '目標'; opp.Close_Forecasted_Date__c = Date.today(); opp.Close_Forecasted_Assume_Date__c = Date.today().addDays(2); opp.Opportunity_No__c = '0801'; opp.CloseDate = Date.today().addDays(1); opp.Sales_assistant_name_text__c = users[0].Id; opp.Manager_name_text__c = users[0].Id; insert opp; EnquiryDetailsWebService.change(opp.Id); } }