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
Saransh Bharadwaj 1Saransh Bharadwaj 1 

Test Class Issue

Hi,

I have a test class in which I am deleting all custom setting records first and then doing :
deleteAllCustomSettings(); //Custom method deleting all custom settings before starting a test.
my_custom_settings__c settings = my_custom_settings__c.getInstance();
When I am checking debig log for this "settings" object, I can see result like my_custom_setting__c:{SetupOwnerId = 005********} as a result but I am expecting "null"

Has any one had ever encounter this?
 
surasura
your test classes does not DMLs done by your test methods to org data .
refer http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_testing_data.htm
Saransh Bharadwaj 1Saransh Bharadwaj 1
Hi Sura,

I understand that but my question was that I have to do it because there is a condition in my class where I am checking that if instance of Custom setting object is null. To cover that part I need to run this deleteAllCustomSettings() method to delete it. So that its instance become null and code will get covered.

Hope you got what I am trying to say here.

Thanks
Saransh
surasura
sorry my  bad , as far as I know that type of a action is not possible