| | |
| | | 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'; |
| | |
| | | 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(); |
| | | |
| | |
| | | // 发货地址 |
| | | 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); // 明细型号 |