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
developer_forcedeveloper_force 

Help with custom setting Test class

HI,

 

Help needed in writing the test class for below class

 

      

public with sharing class ReportParam {

    Public PageReference redirectReport()
    {
    
        Id testId = ApexPages.currentPage().getParameters().get('id'); 
        String cn = ApexPages.currentPage().getParameters().get('cn');
        ReportParamBuilder_Config__c  r = ReportParamBuilder_Config__c.getValues(cn);
        string qry = 'select '+r.QueryObjectField__c+' from '+r.QueryObjectName__c+' where '+r.QueryObjectPrimaryRefField__c+'=\''+testId+'\'';
        List<SObject> resList = database.query(qry);
    System.debug('----------ResultList:'+resList);
        String stringUrl='';
        if(r.QueryObjectName__c == 'Relationship_Group_Member__c'){
            List<Relationship_Group_Member__c> rgmList = (List<Relationship_Group_Member__c>)resList;
            for(Relationship_Group_Member__c obj : rgmList)
            stringUrl = stringUrl +',' + obj.Group_Id__r.GCIF__c;

}


PageReference p = new PageReference('/'+r.ReportId__c+'?pv0='+stringUrl);
        Return p;
    }

}

 

Thanks