• kishor chilukuri
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi, I have a custom setting "XYZ" and Name . I want to write a test class for retriving value of URLLink for custom settin "XYZ" . 
I have written my test class, and have properly inserted values for custom setting and URLLink but still i am getting " 
System.NullPointerException: Attempt to de-reference a null object.
can somebody pls help 


@AuraEnabled
    public static string GetCustomsettingValueName()
    {
        
        Object_Name Obj= Object_Name.getValues('XYZ settin'); 
        return Obj.URLLink;
    }

Testclass : 

 Custom_obj CDH = new Custom_obj();
         Custom_ob.Name = 'Test Custom settinges';
        CDH.URLLink='http://www.Test';
        insert CDH;
  • November 01, 2018
  • Like
  • 0