Created
March 1, 2012 18:19
-
-
Save mjgallag/1951883 to your computer and use it in GitHub Desktop.
BUG FIXED! See All Data Custom Setting Tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <CustomObject xmlns="http://soap.sforce.com/2006/04/metadata"> | |
| <customSettingsType>List</customSettingsType> | |
| <customSettingsVisibility>Public</customSettingsVisibility> | |
| <enableFeeds>false</enableFeeds> | |
| <label>See All Data Custom Setting</label> | |
| </CustomObject> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @isTest class SeeAllDataCustomSettingTests { | |
| @isTest (SeeAllData=true) static void trueSeeAllDataCustomSettingTest() { | |
| final SeeAllDataCustomSetting__c seeAllDataCustomSetting = new SeeAllDataCustomSetting__c(Name = 'Name'); | |
| System.assertEquals(0, [SELECT COUNT() FROM SeeAllDataCustomSetting__c]); | |
| System.assertEquals(0, SeeAllDataCustomSetting__c.getAll().size()); | |
| insert seeAllDataCustomSetting; | |
| System.assertEquals(1, [SELECT COUNT() FROM SeeAllDataCustomSetting__c]); | |
| System.assertEquals(1, SeeAllDataCustomSetting__c.getAll().size()); | |
| delete seeAllDataCustomSetting; | |
| System.assertEquals(0, [SELECT COUNT() FROM SeeAllDataCustomSetting__c]); | |
| System.assertEquals(0, SeeAllDataCustomSetting__c.getAll().size()); | |
| } | |
| @isTest (SeeAllData=false) static void falseSeeAllDataCustomSettingTest() { | |
| final SeeAllDataCustomSetting__c seeAllDataCustomSetting = new SeeAllDataCustomSetting__c(Name = 'Name'); | |
| System.assertEquals(0, [SELECT COUNT() FROM SeeAllDataCustomSetting__c]); | |
| System.assertEquals(0, SeeAllDataCustomSetting__c.getAll().size()); | |
| insert seeAllDataCustomSetting; | |
| System.assertEquals(1, [SELECT COUNT() FROM SeeAllDataCustomSetting__c]); | |
| System.assertEquals(1, SeeAllDataCustomSetting__c.getAll().size()); | |
| delete seeAllDataCustomSetting; | |
| System.assertEquals(0, [SELECT COUNT() FROM SeeAllDataCustomSetting__c]); | |
| // FIXED! BUG: Custom Settings not being flushed from application cache on delete when (SeeAllData=false) | |
| System.assertEquals(0, SeeAllDataCustomSetting__c.getAll().size()); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment