function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ashish jadhav 9ashish jadhav 9 

Need help for test class coverage

Hello experts,

I've to increase test class code coverage, but I'm new to salesforce and not able to figure out the solution, please help me for the below method.

I've several method but need to know any one so that I can debug with remaining classes. Here I'm getting red line i.e. not covered in test is marked in bold.

please guide me how can I pass the value to the method, what should be my approach and best practice in industry. This method is called from constructor and it is not parameterised. please guide a test class for this.

public void initializeRollouts()
        projectId = ApexPages.currentPage().getParameters().get(IPM_ConstantUtils.SF_ID);
        if (projectId != null)
            isEditable = IPM_Utils.getIPMRollOutUser(projectId);
                errorMessage = String.valueOf(new ApexPages.message(ApexPages.severity.INFO,Label.IPM_PLEASE_CONTACT_ADMINISTRATOR));
Try something like:

pagereference pageref = page.PageName;
pageref.getParameters().put('projectId', IPM_ConstantUtils.SF_ID); //pass valid IPM_ConstantUtils.SF_ID