Li Jun
2022-04-06 fb04e7c01d119c60632b4298d18fd93f3ccb3d79
force-app/main/default/classes/OFSInsReportLayoutControllerTest.cls
@@ -1,5 +1,9 @@
@isTest
private class OFSInsReportLayoutControllerTest {
    @TestSetup
    static void makeData(){
        TestDataUtility.CreatePIPolicyConfiguration('Inspection_Report__c');
    }
    public class TestRepo {
        public final Integer ASSETMAX = 8;
        public OFSInsReportLayout__c layout { get; private set; }
@@ -39,7 +43,8 @@
            //Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证'];
            User loginUser = [Select Id, Alias, Province__c from User where Id =: UserInfo.getUserId()];
            loginUser.Job_Category__c = '销售服务';
            update loginUser;
            //update loginUser;
            loginUser = [Select Id, Alias, Province__c from User where Job_Category__c = '销售服务' limit 1];
            ir = new Inspection_Report__c(Name = '*', Inspection_Date__c = inspectionDate, Hospital__c = hp.Id);
            ir.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Inspection_Report__c' and DeveloperName = 'EndoscopeSystem'].id;
@@ -257,8 +262,10 @@
        Test.startTest();
        TestRepo repo = new TestRepo();
        repo.createInspectionReport(null);
        repo.initAssets();
        repo.sqlIr();
        String wrongId = repo.ir.Id;
        wrongId = wrongId.substring(0, 14) + wrongId.substring(13, 14);
        Apexpages.currentPage().getParameters().put('id', wrongId);