-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestHelperBulkData.cls
58 lines (49 loc) · 3.08 KB
/
TestHelperBulkData.cls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
@isTest(seeAllData=false)
private class TestHelperBulkData{
@isTest
private static void testBulkAppCreation(){
//create custom settings
SeedCustomSettings.createCustomSettings(new Set<String>{Constants.CUSTOM_SETTING_CUSTOM_NUMBER_FORMAT});
//create company and branch
Company_Setup__c testCompany = TestHelperCompany.getTestCompanySetup('Test Company', 'TESTCO', '123456789');
insert testCompany;
System.assert(testCompany.Id != null, 'Test company created assert');
Branch_Setup__c testBranch = TestHelperCompany.getTestBranchSetup('Test Branch', 'TBRCH', testCompany.Id, null, null);
insert testBranch;
System.assert(testBranch.Id != null, 'Test branch created assert');
//
//create product
//
Product_Setup__c testProduct = TestHelperProduct.getTestProductSetup('Test Product'
, 'TPROD'
, Constants.PRODUCT_FAMILY_LOAN
, Constants.CYCLE_MONTHLY
, 1);
insert testProduct;
System.assert(testProduct.Id != null, 'Test product created assert');
//
//create contract template
//
Payment_Allocation_Method_Setup__c testPaymentAlloc = TestHelperFinancial.getTestPaymentAllocMethod('Test Payment Allocation');
insert testPaymentAlloc;
Contract_Template_Setup__c testContractTemplate = TestHelperProduct.getTestContractTemplateSetup
('Test Contract Template'
, Constants.PRODUCT_FAMILY_LOAN
, testPaymentAlloc.Id
, 1);
insert testContractTemplate;
System.assert(testContractTemplate.Id != null, 'Test contract template created assert');
//
//create Lending Applications by populating company, branch, product, contract template
//
Test.startTest();
List<Lending_Application__c> testApps = TestHelperLendingApplication.getTestApplicationBulk(testCompany
, testBranch
, testProduct
, testContractTemplate
, 1000);
DMLResult saveRslt = LendingApplicationDMLWrapper.getInstance().insertData(testApps);
Test.stopTest();
System.assertEquals(1000, saveRslt.getSuccessRecordList().size());
}
}