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
EnozzirEnozzir 

lowly intern is search of help regarding wrapper class test coverage

public class Risk_AnalysisExtController {
    
    public String server {get;set;}
    public String rootURL {get;set;}
    public string uId {get;set;}
    public String inputSer {get; set;} //line290
    public List<Risk_Analysis__c> listRiskAnalysis {get; set;} //All
    public List<Risk_Analysis__c> custListHistory {get; set;} //when user select customer
    public List<Risk_Analysis__c> serListHistory {get; set;} //when user select serial 
    public List<Risk_Analysis__c> serListAllExist {get; set;}
    public List<Risk_Analysis__c> serList {get; set;}
    public List<Risk_Analysis__c> serListAllNew {get; set;}
    public string paramCust {get; set;}
    public string paramSer {get; set;}
    public string paramThem {get; set;}
    public string inputComment {get; set;}
    public string paramCustText {get; set;}
    public string paramThemText {get; set;}
    public string paramBrandT {get; set;} 
    public string paramMat {get; set;}
    public string actionOpt {get; set;}
    public date inputDate {get; set;}
    public string removalReason {get; set;}
    //public Id machId {get; set;} 
    Map<string, Risk_Analysis__c> MapCheckSer = new Map<string, Risk_Analysis__c>(); 
    Map<string, Risk_Analysis__c> MapCheckExist = new Map<string, Risk_Analysis__c>(); 
    Map<string, string> MapCommentsExist = new Map<string, string>(); 
    public string outputSer {get; set;} //line292 
    //public string delCust {get; set;}
    //public string delSer {get; set;}
    
    //private list<Risk_Analysis__c> delRisk = new list<Risk_Analysis__c>(); 
    private Risk_Analysis__c delRisk ; 
    public PageReference pageRef; 
    public Map<string, string> URLParameters = ApexPages.currentPage().getParameters(); 
    
    public Id currentPageId; 
    
    List<riskWrapper> rList = new List<riskWrapper>();
    List<Risk_Analysis__c> selectedRecords = new List<Risk_Analysis__c>();
    public List<Risk_Analysis__c> delRecords = new List<Risk_Analysis__c>();
    public list<riskWrapper> riskList = new List<riskWrapper>();// {get; set;} 
    
    
    
    
    public Risk_AnalysisExtController(ApexPages.StandardController stdController) {
        string trustedTicket ='';
        //dashboard url with trusted ticket
        server = 'https://test.tableaureporting.test.com';
        if (Functions.isProduction()) server = 'https://tableaureporting.test.com';
        
        //currently loggedin user 
        User u = [select name, Alias, CommunityNickname, FederationIdentifier, Domain_Credential__c, SAP_Partner_Number__c from user where Id = :UserInfo.getUserId() limit 1]; //added Domain_Credential__c
        string userid = ''; 
        if(vUser(u.id).equals('Correct'))
            userid =u.Domain_Credential__c.toLowerCase();
        
        if(u.SAP_Partner_Number__c!=null)uId = String.valueof('000'+u.SAP_Partner_Number__c); 
      //  system.debug('uId'+uId); 
        
      //  system.debug('userid = ' +userid);
      //  system.debug('server = '+ server);
        //retrieve trusted ticket
        trustedTicket = getTicket(userid, 'Sales_Ops', server);
        rootURL = server+ '/trusted/'+trustedTicket;
        system.debug('rootURL = '+rootURL);
        system.debug('trustedTicket = '+ trustedTicket);
        
        //buffer
        serListHistory = [Select Id, Customer__c, Comments__c, Serial_Number__c, Theme__c, End_of_Life_Date__c, Action__c, 
                          Removal_Reason__c, Customer_Name__c, Brand_Name__c, Theme_Name__c, Cabinet__c
                          from Risk_Analysis__c where  Serial_Number__c=: paramSer];   
        serListAllExist = [Select Id, Customer__c, Comments__c, Serial_Number__c, Theme__c, End_of_Life_Date__c, Action__c, 
                           Removal_Reason__c, Customer_Name__c, Brand_Name__c, Theme_Name__c, Cabinet__c
                           from Risk_Analysis__c where  Serial_Number__c=: paramSer];  
        serListAllNew = [Select Id, Customer__c, Comments__c, Serial_Number__c, Theme__c, End_of_Life_Date__c, Action__c, 
                         Removal_Reason__c, Customer_Name__c, Brand_Name__c, Theme_Name__c, Cabinet__c
                         from Risk_Analysis__c where  Serial_Number__c=: paramSer]; 
        
        listRiskAnalysis = [Select Id, Customer__c, Comments__c, Serial_Number__c, Theme__c, End_of_Life_Date__c, Action__c, 
                            Removal_Reason__c, Customer_Name__c, Brand_Name__c, Theme_Name__c, Cabinet__c
                            from Risk_Analysis__c]; 
       
        
        
        
        
        /*if(paramCust!= null && paramCust.isNumeric() && (paramSer == null || paramSer == '')) {
            
            String CustNumTemp; 
            CustNumTemp = paramCust.right(7);
            custListHistory = [Select Id, Customer__c, Comments__c, Serial_Number__c, Theme__c, End_of_Life_Date__c, Action__c, 
                               Removal_Reason__c, Customer_Name__c, Brand_Name__c, Theme_Name__c, Cabinet__c, Delete__c 
                               from Risk_Analysis__c where Customer__c =: CustNumTemp];
            
        }
        
        MapCommentsExist.put(paramSer, inputComment);*/
               
    
    }
    
    
      
        public class riskWrapper
    {
        public Risk_Analysis__c risk{get; set;}
        public Boolean selected {get; set;}
        public RiskWrapper(Risk_Analysis__c r)
        {
            risk = r;
            selected = false;
        }
    }

So here's a section of of a class i have to write a test class for. They want 90% coverage, I'm at 87%, lol woe is me. 

My one problem is the wrapper class, through the rest of the code and this snippet it's the one thing i can't seem to get coverage one.... I've tried 
 
class.wrapper wrap = new class.wrapper();
But i cant seem to figure that one out....i tried to insert and also map<string,string> mapvr = new map<string,string(); refer to the class set var; list<apexpages.message>msgs = apexpages.getmessages(); then mpvr.put(field, data) then trying to force the wrapper by referencing to it directly..

I only need coverage not functionality at this point because that's all been tested and the rest of my test class covers 87% of the functionallity.

 
Prem RPrem R
Hi, 

Can you please paste your test class code here, so I can check and assit you to increase the coverage.  

Thanks,
Prem