+ 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