You need to sign in to do that
Don't have an account?

Test coverage on get methods
Hi,
How can i have coverage on get methods in a controller?
public List<SelectOption> Listtype { get { List<SelectOption> Val = new List<SelectOption>(); Val.add(new SelectOption('First', 'One')); Val.add(new SelectOption('second', 'two')); Val.add(new SelectOption('Third', 'three')); return Val; } }
Any pointers
I guess you will need to use something like the following
Regards
All Answers
I guess you will need to use something like the following
Regards
Hi,
See your Solution.
public class main{
public List<SelectOption> Listtype
{
get
{
List<SelectOption> Val = new List<SelectOption>();
Val.add(new SelectOption('First', 'One'));
Val.add(new SelectOption('second', 'two'));
Val.add(new SelectOption('Third', 'three'));
return Val;
}
}
Private Static testmethod void Testclass()
{
main test = new main();
List<SelectOption> Values= test.Listtype;
}
}
You can also create a pagereference in your test class
pageRef = Page.Opp_PAgeName;
Test.setCurrentPage(pageRef);
ApexPages.StandardController sc = new ApexPages.StandardController(opp);
ControllerClass controller = new ControllerClass (sc);