Skip to content

Commit

Permalink
Make sure method return non-null values
Browse files Browse the repository at this point in the history
  • Loading branch information
wimvelzeboer committed May 27, 2022
1 parent a64b4a2 commit 4ad786c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sfdx-source/apex-common/main/classes/fflib_SObjects.cls
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,13 @@ public virtual class fflib_SObjects
* @return Return a set with all the Id values of the given field
*/
@TestVisible
protected Set<Id> getIdFieldValues(Schema.SObjectField field)
protected virtual Set<Id> getIdFieldValues(Schema.SObjectField field)
{
Set<Id> result = new Set<Id>();
for (SObject record : getRecords())
{
if (record.get(field) == null) continue;

result.add((Id) record.get(field));
}
return result;
Expand All @@ -177,11 +179,13 @@ public virtual class fflib_SObjects
* @return Return a set with all the String values of the given field
*/
@TestVisible
protected Set<String> getStringFieldValues(Schema.SObjectField field)
protected virtual Set<String> getStringFieldValues(Schema.SObjectField field)
{
Set<String> result = new Set<String>();
for (SObject record : getRecords())
{
if (record.get(field) == null) continue;

result.add((String) record.get(field));
}
return result;
Expand Down

0 comments on commit 4ad786c

Please sign in to comment.