liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
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
@isTest
private class PBIAuthorizationControllerTest {
    @isTest static void test_init() {
 
        PageReference page = new PageReference('/apex/PBIAuthorization?userid=12');
        System.Test.setCurrentPage(page);
        PBIAuthorizationController controller = new PBIAuthorizationController();
        controller.init();
 
 
        PageReference page1 = new PageReference('/apex/PBIAuthorization?userid=123456789012345');
        System.Test.setCurrentPage(page1);
        PBIAuthorizationController controller1 = new PBIAuthorizationController();
        controller.init();
 
        PageReference page2 = new PageReference('/apex/PBIAuthorization?userid='+ UserInfo.getUserId());
        System.Test.setCurrentPage(page2);
        PBIAuthorizationController controller2 = new PBIAuthorizationController();
        controller2.init();
 
        PBIAuthorization__c tempPBIA = new PBIAuthorization__c();
        tempPBIA.name = '*';
        tempPBIA.User__c = UserInfo.getUserId();
        insert tempPBIA;
        controller2.init();
    }
 
}