I have a VisualForce page which uses a controller. Within the controller I have a couple of wrapper classes which hold various form elements on the page. Everything works great, but now it is time to write some test code for it...
I am not able to access the wrapper class from my test class. It errors out saying Invalid type: someWrapper
. The wrapper is a public class but I don't think that I have properly instantiated the wrapper class within the controller class.
Here is a general look at what my controller looks like:
public with sharing class someController
@TestVisible private List<someWrapper> wrapperList {get; set;}
public class someWrapper {
public Opportunity someOpportunity {get; set;}
public Boolean someBoolean {get; set;}
public someWrapper(Opportunity opp){
someOpportunity = opp;
someBoolean = true;
}
}
}
And here is my test class. It errors out when I am trying to for loop through the wrapperList
list.
someController controller = new someController();
for(someWrapper thisListItem : controller.wrapperList){
// Do stuff
}
I realize that I must have to instantiate the wrapper class somehow, but I can't figure out how to do it properly.
I have tried the following:
controller.someWrapper wrapperForUseInTest = new controller.someWrapper();
someWrapper wrapperForUseInTest = new controller.someWrapper();
class wrapperForUseInTest = new controller.someWrapper()
Any help would be greatly appreciated!