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
TechEd_ProgrammerTechEd_Programmer 

Code Coverage for a method using List<Id>

I have a VF Page that simply displays two graphs that I have created for display. The controller for this is an extension. I am not great with Test Code Coverage, so I was hoping for some help. My class is below:
public with sharing class TestResultGraphConroller {

    public string strTrial;
 
    public TestResultGraphConroller(ApexPages.StandardController stdController){
        strTrial = ApexPages.currentPage().getParameters().get('Id');
    }
   
   
    public String getTimeVolume(){
        return getTimeVolume(null);
    }
   
    public String getTimeVolume(List<Id> ids){
        GoogleViz gv = new GoogleViz();             
        gv.cols = new list<GoogleViz.col> {
            new GoogleViz.Col('col2','Interval','number'),
            new GoogleViz.Col('col1','Channel Volume','number')
            };
        decimal interval = 0;
       
        for(Trial__c tv : [Select Id, DisplayChannelVolume__c, TimeZeroOffset__c from Trial__c where Id = :strTrial limit 1])
        {
          String x = tv.DisplayChannelVolume__c;
          List<String> channelvolumevalues = x.split(' ');
         
          interval = tv.TimeZeroOffset__c;
         
          for(String cv: channelvolumevalues)
          {
            GoogleViz.row r = new GoogleViz.row();
            r.cells.add ( new GoogleViz.cell( interval));//interval
            r.cells.add ( new GoogleViz.cell( cv ));//X-Axis
            gv.addRow( r );
            interval = interval + .04;
            }
        }
        return gv.toJsonString();
    }
   
    public String getFlowVolume(){
        return getFlowVolume(null);
    }
   
  public String getFlowVolume(List<Id> ids){
        GoogleViz gv = new GoogleViz();             
        gv.cols = new list<GoogleViz.col> {
            new GoogleViz.Col('col1','Channel Volume','number'),
            new GoogleViz.col('col2','Channel Flow','number')   
            };             
              
        for(Trial__c tfv : [Select Id, DisplayChannelFlow__c, DisplayChannelVolume__c From Trial__c where Id = :strTrial limit 1])
        {                                                         
            String x = tfv.DisplayChannelVolume__c;
            String y = tfv.DisplayChannelFlow__c;
            List<String> channelvolumevalues = x.split(' ');
            List<String> channelflowvalues = y.split(' ');
           
            for(integer i=0; i< channelvolumevalues.size(); i++) //iterate using an integer
            {
              String cv = channelvolumevalues[i]; //get the element at the ith position
              String cf = channelflowvalues[i]; //get matching element at the ith position
              GoogleViz.row r = new GoogleViz.row();
              r.cells.add ( new GoogleViz.cell( cv ));//Y-Axis
              r.cells.add ( new GoogleViz.cell( cf ));//X-Axis
              gv.addRow( r );
            }
        }

        return gv.toJsonString();
    }
}

And my Test Class:

@isTest
public class testTestResultGraphConroller {

    private static testMethod void testTestResultGraphConroller() {
    
     Trial_Session__c tts1 = new Trial_Session__c();
     tts1.Lab__c = 'Test1';
    
     insert tts1;
    
     Trial__c tt1 = new Trial__c();
        tt1.Channel_Flow__c = '0.123456789 0.223456789';
        tt1.Channel_Flow_2__c = '0.423456789 0.523456789 0.623456789';    
     tt1.Channel_Volume__c = '0.123456789 0.223456789';
        tt1.Channel_Volume_2__c = '0.423456789 0.523456789 0.623456789';    
     tt1.DisplayChannelFlow__c = '-0.01114792 0.0204 0.051 0.0714 0.0918';
     tt1.DisplayChannelVolume__c = '0.9639643 0.9641174 0.9645764 0.9652394 0.9661258';
     tt1.TimeZeroOffset__c = 12.0;
     tt1.Trial_Session__c = tts1.Id;
    
     insert tt1;   
    
     Test.startTest();
    
     ApexPages.currentPage().getParameters().put('Id',tts1.Id);
     ApexPages.Standardcontroller stdTrialSession = new ApexPages.Standardcontroller(tts1);
     TestResultGraphConroller trgc = new TestResultGraphConroller(stdTrialSession);
    
     trgc.getFlowVolume();
     trgc.getFlowVolume(??????);
     trgc.getTimeVolume();
     trgc.getTimeVolume(??????);
    
     Test.stopTest();
    }
}

I am not sure what to write into the ??????'s

Thank you for your help.
Elie.RodrigueElie.Rodrigue
It seems like your class code dont even use the list of id parameter so you could just remove them.

But to properly answer your question, you could instantiate a list, fill it and send it to your method : 
List<Id> tempList = new List<Id>();
tempList.add(tt1.Id);

trgc.getFlowVolume(tempList);


or you could instantiate an array on the spot :
trgc.getFlowVlume(new Id[]{tt1.Id});