You need to sign in to do that
Don't have an account?
Archestain
Required test classes for wrapper class
Hi,
Can someone help provide the testclasses for the below wrapper class?
archestain@boom.com
Class 1:
public with sharing Class OwnerWrapper{
public Integer Index {get;set;}
public List<String> tcOwner {get;set;}
public OwnerWrapper(){
}
}
Class 2:
public with sharing class AddressWrapper {
public Integer Index {get;set;}
public List<String> Addressed {get;set;}
publicAddressWrapper(){
}
}
Can someone help provide the testclasses for the below wrapper class?
archestain@boom.com
Class 1:
public with sharing Class OwnerWrapper{
public Integer Index {get;set;}
public List<String> tcOwner {get;set;}
public OwnerWrapper(){
}
}
Class 2:
public with sharing class AddressWrapper {
public Integer Index {get;set;}
public List<String> Addressed {get;set;}
publicAddressWrapper(){
}
}
You need to instantiate the wrapper class like below .
ClassName.WrapperclassName wrp=new ClassName.WrapperclassName();
Both the scenario you have given can be solved by above coding style .
One morescenario may come where you have parameter in your wrapper class constructor .In that case you need to pass the parater in side .
ClassName.WrapperclassName wrp=new ClassName.WrapperclassName(Parameters );
Check below link for some tips.
http://manojjena20.blogspot.in/2015/06/tips-and-tricks-for-test-class.html
Let me know if it helps !!
Thanks
Manoj
All Answers
You need to instantiate the wrapper class like below .
ClassName.WrapperclassName wrp=new ClassName.WrapperclassName();
Both the scenario you have given can be solved by above coding style .
One morescenario may come where you have parameter in your wrapper class constructor .In that case you need to pass the parater in side .
ClassName.WrapperclassName wrp=new ClassName.WrapperclassName(Parameters );
Check below link for some tips.
http://manojjena20.blogspot.in/2015/06/tips-and-tricks-for-test-class.html
Let me know if it helps !!
Thanks
Manoj