You need to sign in to do that
Don't have an account?
Natraj
Need help to do the test coverage for the below code.... i couldn cover the below code....
CODE IN APEX CLASS:
public List<String> PrimaryRoles {
get {
if (PrimaryRoles == null) {
PrimaryRoles = new List<String>();
Schema.DescribeFieldResult field = Contact.Primary_Role__c.getDescribe();
for (Schema.PicklistEntry f : field.getPicklistValues())
PrimaryRoles.add(f.getLabel());
}
return PrimaryRoles;
}
set;
}
VF CODE:
<td style="font-weight:bold;">Primary Role<br/>
<select id="primaryRole" onchange="doSearch();">
<option value=""></option>
<apex:repeat value="{!primaryRoles}" var="prole">
<option value="{!prole}">{!prole}</option>
</apex:repeat>
</select>
</td>
in your test class
just pass the list of string values.....
list<string> lst = new list<string>{'first',second'};
like classobject.primaryroles = lst;
try this
All Answers
in your test class
just pass the list of string values.....
list<string> lst = new list<string>{'first',second'};
like classobject.primaryroles = lst;
try this
Thanks a lot... It worked fine