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

Test Class Help

please help me in writing test coverage for this property



   public String sortDirection = 'ASC';
    public String sortExp = 'Model__r.ProductCategory__r.Name';
    public string sortFullExp;
    public String sortExpression
            return sortExp;
             //if the column is clicked on then switch between Ascending and Descending modes
             if (value == sortExp)
             sortDirection = (sortDirection == 'ASC')? 'DESC' : 'ASC';
             sortDirection = 'ASC';
             sortExp = value;




Can you give complete apex page and apex class coding. then only i will write test class.

Kamatchi Devi SargunanathanKamatchi Devi Sargunanathan



Try the following way,



public class TEST_class1{

     public static testMethod void test1(){

          yourclassname c = new yourclassname();

              // insert the records based on the codition for Model__r.ProductCategory__r.Name'

          c.sortExp = 'give the inserted id for Model__r.ProductCategory__r.Name';

          c.sortExpression =  c.sortExp;





Hope so this helps you...!

Please mark this answer a Solution and please give kudos by clicking on the star icon, if you found this answer as helpful.