Li Jun
2022-03-31 3ba0123db48f8bab81ddf0913e1b95280ef545e8
force-app/main/default/classes/ConsumTrialPDFControllerTest.cls
@@ -2,6 +2,13 @@
private class ConsumTrialPDFControllerTest {
    @testSetup
    static void setupTestData() {
        List<String> strList = new List<String>();
        strList.add('Consum_Apply_Equipment_Set_Detail__c');
        strList.add('Consum_Apply__c');
        strList.add('Document');
        TestDataUtility.CreatePIPolicyConfigurations(strList);
        // 用户
        User testUser1 = new User(Test_staff__c = true);
        testUser1.LastName = 'TestLastName';
@@ -241,10 +248,15 @@
            System.assertEquals(1, testAppList.size());
            Consum_Apply__c testAppObj = testAppList[0];
            PageReference ref =  new PageReference('/apex/ConsumTrialPDF?Id=' + testAppObj.Id);
            ref.getParameters().put('id',testAppObj.Id);
            Test.setCurrentPage(ref);
            ConsumTrialPDFController ctp = new ConsumTrialPDFController();
            Test.startTest();
            ctp.init();
            ref.getParameters().put('id','');
            ctp.init();
            ref.getParameters().put('id','dokmqfqqvdqawhdsa');
            ctp.init();
            Test.stopTest();
@@ -261,7 +273,7 @@
            // 发货地址
            System.assertEquals('北京市', ctp.shippmentAddress);
            // 所有PDF页集合
            System.assertEquals(1, ctp.pdfPageList.size());
            System.assertEquals(3, ctp.pdfPageList.size());
            ConsumTrialPDFController.PdfPageClass testPdfPage = ctp.pdfPageList[0];
            Consum_Apply_Equipment_Set_Detail__c testDetail1 = testPdfPage.equipSetDetailList[0];
            System.assertEquals('No02', testDetail1.Fixture_Model_No_F__c);  // 明细型号