-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTEST_UTIL_System_Omit.cls
34 lines (27 loc) · 1.19 KB
/
TEST_UTIL_System_Omit.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
@isTest(SeeAllData = false)
private class TEST_UTIL_System_Omit
{
static testMethod void testOmit()
{
List<Account> accounts = new List<Account>
{
DAL_Account.insertItem(),
DAL_Account.insertItem(),
DAL_Account.insertItem()
};
Account a1 = DAL_Account.insertItem();
Account a2 = DAL_Account.insertItem();
accounts.add(a1);
accounts.add(a2);
Set<ID> idList = UTIL_System.extractListIds(accounts);
Set<ID> idToBeOmited = new Set<ID>{a1.ID, a2.ID};
Test.startTest();
Set<ID> results = UTIL_System.omit(idList, idToBeOmited);
List<Account> omitWhereResutls = UTIL_System.omitWhere(accounts, DAL_BaseObject.ID_FIELD, (Id)a1.get(DAL_BaseObject.ID_FIELD));
Set<ID> concatResults = UTIL_System.concat(results, idToBeOmited);
Test.stopTest();
System.assertEquals(3, results.size(), 'Should be left 3 Ids in list');
System.assertEquals(4, omitWhereResutls.size(), 'Should remove one account from list and be left 4 items in list');
System.assertEquals(5, concatResults.size(), 'Should add 2 into set and be size of 5');
}
}