@isTest
public class NewAndEditOrderControllerTest {
    @TestSetup
    static void makeData(){
        TestDataUtility.CreatePIPolicyConfiguration();
    }
    static testMethod void NewAndEditOrderController() {
        Test.setMock(HttpCalloutMock.class, new TestDataUtility.CreateMetaDataUtilityHttpMock());
        Order od = TestDataUtility.CreateOrders(1)[0];
        
        Test.startTest();
        ApexPages.StandardController sc =  new ApexPages.StandardController(od);
        NewAndEditOrderController qis = new NewAndEditOrderController(sc);
        qis.contactId = 'test';
        qis.PIPL_Input_Account_Error_Msg = 'test';
        String qisJson = '{"Name":"test123","ApproveStatus__c":"Draft","AccountId":"0010l00001Q1r4e","EndUserD__c":"0030l00000mqae5AAA","SpecialDeliveryAccount_D__c":"0010l00001Q1r4e","TradeMagNo__c":"","CurrencyIsoCode":"CNY","TradeMagCategory__c":"","confirm__c":false,"Status__c":"Active","IsOrderPassed__c":false,"IsSpPassed__c":false,"IsNew__c":false,"CustomerContractPrice__c":"","SAP_Order__c":"","OlympusContractPrices__c":"","SAP_Contract__c":"","PaymentCondition_D__c":"","AlongProduct__c":"","Olympus_Price_BeforeDiscount_D__c":"","EffectiveDate":"2022-4-8","Discount_D__c":"","ServiceFee__c":"","Cost__c":"","ForeignTradeCompany_D__c":"0010l00001Q1Jxd","SpecialDeliveryAccountText__c":"","Shipment_Term_D__c":"","SpecialDeliveryContactText__c":"","Shipment_Term2_D__c":"","Shipping_Address_Text__c":"","ShippedDate__c":"","OrderDate__c":"","InstalledDate__c":"","WarrantyStartDateFromOCN__c":"","CancelReason__c":"","SplitReason__c":"","Split_Approved__c":false,"ChangeReason__c":"","ChangeContent__c":"","Contract_Status__c":"Active","RecordTypeId":"01228000000NJt6","OrderUpdateDateTime__c":"","Status":"Draft","Description":"","PDF_By_Add_Encrypted__c":null,"PDF_By_Tel_Encrypted__c":null,"PDF_Sign_Name_Encrypted__c":null,"PDF_Sign_Title_Encrypted__c":null,"SpecialDeliveryAddress_D_Encrypted__c":null,"SpecialDeliveryAddress_Encrypted__c":null,"PDF_C_CONTACT_Encrypted__c":null,"PDF_C_Consignee_Encrypted__c":null,"PDF_C_FAX_Encrypted__c":null,"PDF_C_TEL_Encrypted__c":null,"PDF_C_THECONSIGNE_Encrypted__c":null,"PDF_F_ContactPerson_Encrypted__c":null,"PDF_F_FAX_Encrypted__c":null,"PDF_F_TEL_Encrypted__c":null,"PDF_S_TEL_Encrypted__c":null,"PDF_N_CONTACT_Encrypted__c":null,"PDF_N_FAX_Encrypted__c":null,"PDF_N_NotifyParty_Encrypted__c":null,"SpecialDeliveryContact_D_Encrypted__c":null,"SpecialDeliveryContact_Encrypted__c":null,"Shipping_Address_Text_Encrypted__c":"","SpecialDeliveryContactText_Encrypted__c":"","SpecialDeliveryPhone_D_Encrypted__c":null,"SpecialDeliveryPhone_Encrypted__c":null,"PDF_By_Add__c":null,"PDF_By_Tel__c":null,"PDF_Sign_Name__c":null,"PDF_Sign_Title__c":null,"SpecialDeliveryAddress_D__c":null,"SpecialDeliveryAddress__c":null,"PDF_C_CONTACT__c":null,"PDF_C_Consignee__c":null,"PDF_C_FAX__c":null,"PDF_C_TEL__c":null,"PDF_C_THECONSIGNE__c":null,"PDF_F_ContactPerson__c":null,"PDF_F_FAX__c":null,"PDF_S_TEL__c":null,"PDF_N_CONTACT__c":null,"PDF_N_NotifyParty__c":null,"SpecialDeliveryContact_D__c":null,"SpecialDeliveryContact__c":null,"SpecialDeliveryPhone_D__c":null,"SpecialDeliveryPhone__c":null,"AWS_Data_Id__c":"962013895902363649"}';
        NewAndEditOrderController.saveOrder(qisJson,'avgwshDFcxAS',False);
        NewAndEditOrderController.saveOrder(qisJson,'avgwshDFcxAS',True);
        qis.contactAWSDataId = 'test';
		qis.endUserDAWSDataId = 'test';  
        qis.contact2AWSDataId = 'test';  
        qis.contact2Name = 'test';  
        qis.contact2DAWSDataId = 'test';  
        
        Test.stopTest();
    }
}