I have a helper class that has a wrapper class in it. I use the wrapper to return two lists in a method.
Example:
public static revenueWrapper createRevenue(List<Project_Submission__c> projSubList, Map<String, Period> periodMap)
{
revenueWrapper rev = new revenueWrapper();
for(Project_Submission__c ps : projSubList)
{
Revenue_Pipeline__c revPipe = new Revenue_Pipeline__c();
revPipe.External_Id__c = extCom;
revPipe.NPD_Forecast_Category__c = 'Commercial Budget';
revPipe.CurrencyIsoCode = ps.CurrencyIsoCode;
revPipe.Project_Submission__c = ps.Id;
rev.revPipe.add(revPipe);
rev.revPipeSchedule.addAll(createschedule(ps.Id, launch));
}
public class revenueWrapper
{
List<Revenue_Pipeline__c> revPipe = new List<Revenue_Pipeline__c>();
List<Revenue_Pipeline_Schedule__c> revPipeSchedule = new List<Revenue_Pipeline_Schedule__c>();
}
Now in my test I'm sending info to the method and returning a result:
@isTest static void testcreateRevenue_B1()
{
List<Project_Submission__c> ps = [
SELECT Id,
CurrencyISOCode,
Year_1_Commercial_Budget__c
FROM Project_Submission__c];
ps[0].Target_Launch_Date__c = System.Date.today();
ps[0].Year_1_Commercial_Budget__c = 1000;
List<Period> periodList = NPD_ProjectSubmissionHelper.getfiscalPeriod();
Map<String, Period> periodMap = NPD_ProjectSubmissionHelper.makeMap(periodList);
Test.startTest();
NPD_ProjectSubmissionHelper.revenueWrapper results = new NPD_ProjectSubmissionHelper.revenueWrapper();
results = NPD_ProjectSubmissionHelper.createRevenue(ps, periodMap);
System.debug('results are:: ' + results);
//System.assertEquals(1, results,
//'The revenue should have been created');
Test.stopTest();
}
In the dev console in the debug log I can see that the the revPipe list is populated from the wrapper
|DEBUG|results are:: revenueWrapper:[revPipe=(Revenue_Pipeline__c:{External_Id__c=a0Gm00000037U18EAE-CommercialBudget, NPD_Forecast_Category__c=Commercial Budget, CurrencyIsoCode=USD, Project_Submission__c=a0Gm00000037U18EAE})...
My problem is when I try to reference the list I get the error:
Variable is not visible: NPD_ProjectSubmissionHelper.revenueWrapper.revPipe
How can I get to the wrapper list to assert on? Changing the class to @testVisible does nothing