• Rupesh Ranjan 5
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
Write some apex class to Check code coverage of apex class through Apex programming
Vf
<apex:page controller="DisplayPicklistvalue">
<apex:form >


<apex:pageBlock title="Country" >
      <apex:pageBlockTable value="{!Countries}" var="a">
         <apex:column headerValue="{!Countries}" >
         <apex:inputCheckbox value="{!Countries}"/> 
         
         
         </apex:column>

      </apex:pageBlockTable>
   </apex:pageBlock>
Controller
public class DisplayPicklistvalue {
public List<String> getCountries()
{

List<String> options = new List<String>();
        
   Schema.DescribeFieldResult fieldResult =
 OfficeLocation__c.Country__c.getDescribe();
   List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        
   for( Schema.PicklistEntry f : ple)
   {
      options.add(f.getvalue());
   }       
   return options;
   }
  


}


 
Vf
<apex:page controller="DisplayPicklistvalue">
<apex:form >


<apex:pageBlock title="Country" >
      <apex:pageBlockTable value="{!Countries}" var="a">
         <apex:column headerValue="{!Countries}" >
         <apex:inputCheckbox value="{!Countries}"/> 
         
         
         </apex:column>

      </apex:pageBlockTable>
   </apex:pageBlock>
Controller
public class DisplayPicklistvalue {
public List<String> getCountries()
{

List<String> options = new List<String>();
        
   Schema.DescribeFieldResult fieldResult =
 OfficeLocation__c.Country__c.getDescribe();
   List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        
   for( Schema.PicklistEntry f : ple)
   {
      options.add(f.getvalue());
   }       
   return options;
   }
  


}