-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTEST_CTRL_PickListDescriber.cls
55 lines (40 loc) · 2.07 KB
/
TEST_CTRL_PickListDescriber.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
@isTest(SeeAllData = false)
private class TEST_CTRL_PickListDescriber
{
static testMethod void getExistingObjectPickValues()
{
//This controller will test the behaviour of the controller retrieving pick values
//for a user (i.e. based on what they can see for a recordtype)
//on an existing object's pick field
User user = DAL_User.getRandomActiveUser();
PageReference pickListDescriberPage = Page.VFP_PickListDescriber;
Test.setCurrentPage(pickListDescriberPage);
//Make sure we set the page's required parameters
Map<String, String> pageParameters = ApexPages.currentPage().getParameters();
pageParameters.put(UTIL_PickList.PARAM_OBJECT_ID, User.Id);
pageParameters.put(UTIL_PickList.PARAM_PICK_LIST_NAME, DAL_User.FIELD_EMAIL_ENCODING_KEY);
pageParameters.put(UTIL_PickList.PARAM_OBJECT_TYPE, DAL_User.OBJECT_NAME);
Test.startTest();
//On contructing the controller, the controller will retrieve the relevant object for the page.
CTRL_PickListDescriber controller = new CTRL_PickListDescriber();
Test.stopTest();
System.assert(controller.SObj != null);
}
static testMethod void getNewObjectPickValues()
{
//This controller will test the behaviour of the controller retrieving pick values
//for a Account (i.e. based on what they can see for a recordtype)
PageReference pickListDescriberPage = Page.VFP_PickListDescriber;
Test.setCurrentPage(pickListDescriberPage);
//Make sure we set the page's required parameters
Map<String, String> pageParameters = ApexPages.currentPage().getParameters();
pageParameters.put(UTIL_PickList.PARAM_RECORD_TYPE, DAL_Case.RT_DEFAULT);
pageParameters.put(UTIL_PickList.PARAM_PICK_LIST_NAME, DAL_Case.FIELD_STATUS);
pageParameters.put(UTIL_PickList.PARAM_OBJECT_TYPE, DAL_Case.OBJECT_NAME);
Test.startTest();
//On contructing the controller, the controller will retrieve the relevant object for the page.
CTRL_PickListDescriber controller = new CTRL_PickListDescriber();
Test.stopTest();
System.assert(controller.SObj != null);
}
}