@isTest
public class NewAndEditOpportunityControllerTest {
    @TestSetup
    static void makeData(){
        TestDataUtility.CreatePIPolicyConfiguration();
    }
    static testMethod void NewAndEditOpportunityController() {
        Test.setMock(HttpCalloutMock.class, new TestDataUtility.CreateMetaDataUtilityHttpMock());
        Opportunity opp = TestDataUtility.CreateOpportunitys(1)[0];
        Test.startTest();
        ApexPages.StandardController sc =  new ApexPages.StandardController(opp);
        NewAndEditOpportunityController qis = new NewAndEditOpportunityController(sc);
        qis.contactId = 'test';

        String qisJson = '{"Is_Decided__c":false,"the_Upload_of_quotation_number__c":"","Cancel_Fail_Approve__c":"","SAP_QuotationCode__c":"","compo_opp__c":false,"CanChangeOpp__c":true,"Name":"test1","AccountId":"0010l00001Q1r4e","RecordTypeId":"012280000005hjO","Type":"","ApprovalStatus_D__c":"Draft","ProductSegment__c":"IE","SpecialPriceApproveStatus__c":"","BudgetAmount__c":"","Machine_Parts__c":"Machine","Amount":"","CurrencyIsoCode":"CNY","customerType__c":"","IsFirstDecide__c":false,"IE_need_business_approve__c":false,"IE_Discount_Special__c":"","IE_ShippingHandling__c":"","IE_local_cost__c":"","IE_Custom_Price__c":"","IE_Payment_terms__c":"","StockAnswerSummary__c":"","Phase1Date__c":"","InquiryResult__c":"","Phase2Date__c":"","ExpectedOrderDate__c":"","Phase3Date__c":"","ExpectedDeliveryDate__c":"","Order_Date__c":"","DeliveryDate__c":"","InquiryResultOrder__c":"","LeadSource":"","TradeType__c":"Taxation","CustomerSourceIE__c":"","SalesChannel__c":"dealer","Trade_Type_D__c":"Taxation","Dealer__c":"0010l00001Pj768","DealerSalesStaffName__c":"***","DealerService__c":"***","SubDealer__c":"test","Dealer_Sales_Staff_Name_D__c":"***","Dealer_Service_D__c":"***","Competitor_Product__c":"","CompetitorProductCode__c":"","Competitor_Product2__c":"","CompetitorProductCode2__c":"","Competitor_Product3__c":"","CompetitorProductCode3__c":"","Competitor_Product4__c":"","CompetitorProductCode4__c":"","Competitor_Product5__c":"","CompetitorProductCode5__c":"","Competitor_Product6__c":"","CompetitorProductCode6__c":"","Competitor_Product7__c":"","CompetitorProductCode7__c":"","Competitor_Product8__c":"","CompetitorProductCode8__c":"","CompetitorCompany__c":"_0001_","LostAmount__c":"","LostCompetitorProduct__c":"","InquiryResultLost__c":"","LostReason__c":"","LostReasonText__c":"","CancelReason__c":"","InquiryResultCancel__c":"","CancelReasonText__c":"","Have_Computer__c":false,"Remark__c":"","NewInquiryDate__c":"2022-4-8","StageName":"Prospect Created","Probability":"","OppUpdateDateTime__c":"","CloseDate":"2022-4-8","ProductSegmentCompetitor__c":"","IsNew__c":false,"OpportunityAmount_text__c":"","OpportunityLineItem_text__c":"","OpportunityLineItemOT_text__c":"","IsSendEmail__c":true,"IsUpdate__c":false,"OppUpdateDate__c":"","DealerSalesStaffName_Encrypted__c":"dcce196c4cfc273a83777852ddd486ab","Dealer_Sales_Staff_Name_D_Encrypted__c":"dcce196c4cfc273a83777852ddd486ab","DealerService_Encrypted__c":"dcce196c4cfc273a83777852ddd486ab","Dealer_Service_D_Encrypted__c":"dcce196c4cfc273a83777852ddd486ab","AWS_Data_Id__c":"961991622629785601"}';
        NewAndEditOpportunityController.saveOpportunity(qisJson,'avgwshDFcxAS',False);
        NewAndEditOpportunityController.saveOpportunity(qisJson,'avgwshDFcxAS',True);
        Test.stopTest();
    }
}