You need to sign in to do that
Don't have an account?
Samhita Argula
Testing wrapper class in salesforce
This is my wrapper class
class wrapper{ public list<Myobject> varList{ get; set; } public set<id> IdVar{ get; set; } public wrapper(list<Myobject> wrapList, set<id> IdSet){ varList = wrapList; IdVar = IdSet; } }When I am testing it,
wrapper wrapReq = new wrapper(varList, IdSet); //1st condition wrapReq = calling my method(); //2nd condition wrapReq = calling my method();The first wrapReq works fine. The second wrapReq is always getting NULL value. Why isn't the value being reset like it should?
Wrapper cant be reset like other types for example a list or string variable.
You have to initialize it again and use it, in a different test class method.
All Answers
>> https://salesforce.stackexchange.com/questions/87533/writing-test-class-for-wrapper-class
The above link has an implementation of writing test class for wrapper class you can try checking this and modify as needed.
Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Thanks.
Wrapper cant be reset like other types for example a list or string variable.
You have to initialize it again and use it, in a different test class method.