@isTest
public class NewAndEditLoanerApplicationControlTest {
    @TestSetup
    static void makeData(){
        TestDataUtility.CreatePIPolicyConfiguration();
    }
    static testMethod void NewAndEditLoanerApplicationController() {
        Test.setMock(HttpCalloutMock.class, new TestDataUtility.CreateMetaDataUtilityHttpMock());
        loaner_application__c la = TestDataUtility.Createloanerapplications(1)[0];

        Test.startTest();
        ApexPages.StandardController con =  new ApexPages.StandardController(la);
        NewAndEditLoanerApplicationController qis = new NewAndEditLoanerApplicationController(con);
        
        String qisJson = '{"Status__c":"草案中","Name":"test1","RecordTypeId":"0120K000000wDzQ","loaner_request_number__c":"","Equipment_Type__c":"IE","AllLead_OrderName__c":"","Loaner_Ser__c":"","Approval_Step__c":"","loaner_place__c":"","Approval_Date__c":"","Is_High_end_Products__c":false,"Is_Repair_Products__c":false,"Is_time_out__c":false,"Is_Automatic_Received__c":false,"Demo_purpose__c":"演示","Demo_purpose_text__c":"","Follow_Opp_text__c":"","ProductCount1__c":"","EC_Code_1__c":"","ProductCount2__c":"","EC_Code_2__c":"","ProductCount3__c":"","EC_Code_3__c":"","ProductCount4__c":"","EC_Code_4__c":"","ProductCount5__c":"","EC_Code_5__c":"","ProductCount6__c":"","EC_Code_6__c":"","ProductCount7__c":"","EC_Code_7__c":"","ProductCount8__c":"","EC_Code_8__c":"","ProductCount9__c":"","EC_Code_9__c":"","ProductCount10__c":"","EC_Code_10__c":"","ProductCount11__c":"","EC_Code_11__c":"","ProductCount12__c":"","EC_Code_12__c":"","ProductCount13__c":"","EC_Code_13__c":"","ProductCount14__c":"","EC_Code_14__c":"","ProductCount15__c":"","EC_Code_15__c":"","ProductCount16__c":"","EC_Code_16__c":"","ProductCount17__c":"","EC_Code_17__c":"","ProductCount18__c":"","EC_Code_18__c":"","ProductCount19__c":"","EC_Code_19__c":"","ProductCount20__c":"","EC_Code_20__c":"","Request_shipping_Date__c":"2022-4-8","Rental_Start_Date__c":"2022-4-8","Request_return_Date__c":"2022-4-10","Rental_End_Date__c":"2022-4-8","Loaner_receive_staff__c":"***","pickup_time__c":"","direct_shippment_address__c":"**********","Loaner_receive_staff_phone__c":"***********","Post_Code__c":"******","delivery_company__c":"test","Return_Track_Company__c":"test","Tracking_Number__c":"","Return_Track_Number__c":"","Return_Trake_Staff__c":"","loaner_manage_place__c":"","loaner_return__c":false,"loaner_Remark__c":"","HP_Received_Sign_Date__c":"","Cancel_Reason__c":"","Cancel_Date__c":"","Bollow_Date__c":"","Asset_Return_Date__c":"","Shipping_Finished_Date__c":"","Asset_Return_Date_All__c":"","Shipping_Finished_Date_All__c":"","LoanerClosedDateAll__c":"","Finished_Date__c":"","Loaner_Renewal__c":"未申请","Loaner_Renewal_Reason__c":"","Loaner_Apply_Renewal_Date__c":"","Loaner_Renewal_Date__c":"","Renewal_Examine_Date__c":"","Renew_Num__c":"0","Loaner_LendOrder__c":false,"Dealer_From_txt__c":"","Service_Approval__c":false,"Product_Approval__c":false,"Loaner_AgreementPDF__c":false,"Installation_Qualification_Attachment__c":false,"Remind_Date__c":"","Loaner_Ser_Encrypted__c":"","Post_Code_Encrypted__c":"ecec26168c09cf090b8b4a95ca524a61","return_Number_Encrypted__c":null,"Return_Trake_Staff_Encrypted__c":"","Loaner_receive_staff_phone_Encrypted__c":"64bd0db056d0bfd21fae76cc5dbdf4d1","direct_shippment_address_Encrypted__c":"2df1bc4bf3800c5e05e3d9f394c3446567d1f05482d2295650b7b50e9e4aa97a92338985c9693f576e1e6df667aaee46","Loaner_receive_staff_Encrypted__c":"dcce196c4cfc273a83777852ddd486ab","return_Number__c":null,"AWS_Data_Id__c":"962025468062597121"}';
        NewAndEditLoanerApplicationController.saveLoanerApplication(qisJson,'avgwshDFcxAS',False);
        NewAndEditLoanerApplicationController.saveLoanerApplication(qisJson,'avgwshDFcxAS',True);
        Test.stopTest();
    }
}