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
venkyyyvenkyyy 

complete code coverage lines for the follwoing class

Hi all,
Can anybody give me the complete code coverage lines for the follwoing class(only one method i have copied bellow, means its not full class, i  need to cover these lines only to fullfill my class code coverage):

public class getusers{
 public PageReference modifyUsers() {
        PageReference skillPage = Page.skill;
        //Set the skill id if it is set from skill list
        if(String.isNotBlank(skillId)) {
            skillPage.getParameters().put('id', skillId);
            skillPage.getParameters().put('act', 'eu');
        }
        skillPage.setRedirect(true);
        return skillPage;
    }
}
----------------
Alexander TsitsuraAlexander Tsitsura
Hi venkyyy

I recomended u to read this article https://developer.salesforce.com/page/An_Introduction_to_Apex_Code_Test_Methods

And try this code
@isTest
public class TestGetUser {
    @isTest static void testModifyUserMethod() {
        getusers cntrl = new getusers();
        
        // maybe you need set skillId
        cntrl.skillId = '123';
        
        Test.startTest();
            PageReference pRef = cntrl.modifyUsers();
        Test.stopTest();
        
        System.assertNotEquals(null, pRef);
        System.assertEquals('eu', pRef.getParameters().get('act'));
        System.assertEquals(cntrl.skillId, pRef.getParameters().get('id'));
    }
}

As a common practice, if your question is answered, please choose 1 best answer. 
But you can give every answer a thumb up if that answer is helpful to you.

Thanks,
Alex