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
domdickdomdick 

Need help on Test class

Hi,

 

I have following class for VF page. But without the test class, i can not process to Production site.

Can someone please help me to write a test class?

 

Many thanks in advace!

 

Class:

public String sortExpression {
        get {
            return sortExp;
        }
        set {
            //if the column is clicked on then switch between Ascending and Descending modes
            if(value == sortExp)
                sortDirection = (sortDirection == 'Asc')? 'Desc' : 'Asc';
            else
                sortDirection = 'Asc';
            sortExp = value;
        }
    }
    
    public String getSortDirection() {
        //if not column is selected 
    	if (sortExpression == null || sortExpression == '')
      		return 'Asc';
    	else
     		return sortDirection;
    }
    
    public void setSortDirection(String value) {
        sortDirection = value;
    }

 

domdickdomdick

Any idea?

 

Any help would be appreciated.

 

Devendra@SFDCDevendra@SFDC

 

Domdick,

 

You will have to assign value to extsnion variables and then call class methods, something like below:


ExtensionClass ext = new ExtensionClass();


ext.sortDirection = 'ASC';

 

// call class methods using extension


ext.sortDirection = 'DESC';

 

// Call class methods using extension

 

Hope this helps :)

 

Thanks,

Devendra