Skip to content

Commit

Permalink
Remove use of UTIL_Finder because it appears when the field is encryp…
Browse files Browse the repository at this point in the history
…ted, it's not available for SOSL fast enough for the test to work
  • Loading branch information
force2b committed Jan 12, 2024
1 parent 5b8f1ad commit 802c198
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions force-app/test/ADDR_Addresses_TEST.cls
Original file line number Diff line number Diff line change
Expand Up @@ -809,13 +809,14 @@ public with sharing class ADDR_Addresses_TEST {
);
insert contact;

UTIL_Finder queryByState = new UTIL_Finder(Address__c.SObjectType)
.withSelectFields(new List<String>{ 'Undeliverable__c' })
.withWhere(new UTIL_Where.FieldExpression(Address__c.MailingState__c).equals('Pennsylvania'));


Address__c overrideAddress = (Address__c)(queryByState.find()[0]);

Address__c overrideAddress;
for (Address__c addr : [SELECT Id, MailingState__c, Undeliverable__c FROM Address__c]) {
if (addr.MailingState__c == 'Pennsylvania') {
overrideAddress = addr;
break;
}
}

Test.startTest();
overrideAddress.Undeliverable__c = true;
update overrideAddress;
Expand Down Expand Up @@ -2232,12 +2233,14 @@ public with sharing class ADDR_Addresses_TEST {
insert testContact;
Test.stopTest();

UTIL_Finder queryByState = new UTIL_Finder(Address__c.SObjectType)
.withSelectFields(new List<String>{ 'Latest_Start_Date__c', 'Default_Address__c' })
.withWhere(new UTIL_Where.FieldExpression(Address__c.MailingState__c).equals('Washington'))
.withLimit(1);
Address__c testAddress;
for (Address__c addr : [SELECT Id, MailingState__c, Latest_Start_Date__c, Default_Address__c FROM Address__c]) {
if (addr.MailingState__c == 'Washington') {
testAddress = addr;
break;
}
}

Address__c testAddress = (Address__c)(queryByState.find()[0]);
System.assertEquals(true, testAddress.Default_Address__c, 'Address should be set as the default address.');
System.assertEquals(System.today(), testAddress.Latest_Start_Date__c, 'The default address latest start date ' +
'should be set to today\'s date.');
Expand Down

0 comments on commit 802c198

Please sign in to comment.