@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(); } }