function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
chanbasha nbskchanbasha nbsk 

Help me to write a Test class?

Hi All,

 Anyone please help to write a test class for the below apex class
 
 public with sharing class Page2Controller {
    
    public Integration__c ic {get;set;}
    
    public String selectedVal{get;set;} 
    
    
    Map<ID, Integration__c> existingIntegrations = new Map<ID, Integration__c>();
    List<SelectOption> options = new List<SelectOption>(); 
    
    public Page2Controller(){
       
     for(Integration__c intgr : [Select Id,Name, IntegrationAccount__c, In__c, password__c, URL__c, username__c FROM Integration__c]){ 
         existingIntegrations.put(intgr.id, intgr);
         options.add(new SelectOption(intgr.Id, intgr.Name));
     }
        selectedVal = options.get(0).getValue();
        System.debug('Initially selected value:::: ' + selectedVal);
        updateSelection();
        System.debug('current IC:::: ' +ic);
    }
    public List<SelectOption> getExistingIntegrations(){
        return options;
    }
    
    public void updateSelection(){
        System.debug('Selection Changed to::: ' +selectedVal);
        ic = existingIntegrations.get(selectedVal);
    }
   
    
     public PageReference Move1() {     // used in update existing one                     
        
       update ic;
    
       PageReference Page = new PageReference('https://c.na40.visual.force.com/apex/Page2');

       Page.setRedirect(true);
       
       return Page;       
   
       }   
          
       public PageReference Move2() {     // Used to create new record
    
       PageReference Page = new PageReference('https://c.na40.visual.force.com/apex/Page1');

       Page.setRedirect(true);
       
       return Page;       
   
       }
}         
       Thanks In Advance