/* * Author: Guo, Aline Yaying * Created Date: 03/22/2022 * Purpose: Test Class * History: * 03/22/2022 - Guo, Aline Yaying - Initial Code. * * */ @isTest private class NewAndEditInspectionReportControllerTest { static testMethod void testMethod1() { TestDataUtility.CreatePIPolicyConfiguration(); Test.setMock(HttpCalloutMock.class, new TestDataUtility.CreateMetaDataUtilityHttpMock()); Inspection_Report__c insTest = new Inspection_Report__c(); // List asdf = TestDataUtility.CreateInspectionReport(1); insTest = TestDataUtility.CreateInspectionReport(1)[0]; Test.startTest(); ApexPages.StandardController con = new ApexPages.StandardController(insTest); NewAndEditInspectionReportController ins = new NewAndEditInspectionReportController(con); String insJson = '{"Name":"test123","RecordTypeId":"01210000000RLeX","Hospital__c":"0011m00000Xm6Lk","Status__c":"草案中","Approved_date__c":"2022/03/29","if_UpdateAsset__c":true,"Inspection_StartTime__c":"2022/03/29 16:22","Inspection_Date__c":"2022/03/29","Inspection_EndTime__c":"2022/03/29 16:22","Contract__c":"000000000000000","spotCheckBatch__c":"","Submit_date__c":"2022/03/29","Inspectup_Plan__c":"000000000000000","Technician_HP__c":"","Remarks__c":"","Department__c":"000000000000000","ResponsiblePerson_Sign__c":"
","Reporter__c":"00510000000gW9S","Technician_HP_Encrypted__c":"","phone_Encrypted__c":null,"Responsible_Person_Encrypted__c":null,"phone__c":null,"Responsible_Person__c":null,"AWS_Data_Id__c":"958401040867131393"}'; NewAndEditInspectionReportController.saveInspectionReport(insJson,'avgwshDFcxAS',False); NewAndEditInspectionReportController.saveInspectionReport(insJson,'avgwshDFcxAS',True); Test.stopTest(); } }