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

Test methods for a wrapper class
I have used a wrapper class for selecting and deselecting a checkbox. But i am stuck when writing test methods for a wrapper class. How can we select/unselectt he value of a checkbox inside a test method? Please let me know
Thanks
What do you mean by a wrapper for checkbox? Can you post some sample code here?
Here is some sample code :
<apex:outputPanel layout="block" style="overflow:auto;width:750px;height:250px">
<apex:pageBlockSection title="Search Results" id="resultsBlock" columns="1">
<apex:pageBlockTable value="{!searchResults}" var="c" rendered="{!NOT(ISNULL(searchResults))}">
<apex:column width="25px">
<apex:facet name="header">Select</apex:facet>
<apex:inputCheckbox value="{!c.checked}"/>
</apex:column>
<apex:column value="{!c.cat.Name}" headerValue="Name"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:outputPanel>
Wrapper class :
public class CategoryWrapper
{
public Boolean checked{ get; set; }
public Boolean checked1{ get; set; }
public string profileid { get; set; }
public profile cat { get; set;}
public CategoryWrapper()
{
cat = new profile();
;
checked1 = false;
}
public CategoryWrapper(profile c)
{
cat = c;
profileid = c.Id;
;
checked1 = false;
}
}
Please let me know if you need any more information . Thanks!
Your test methods should look something like this.
Hope that helps.
Afzal