Add method overload for fflib_ArrayUtils.replaceValues (#70)
Adds compatibility with Boolean values
This commit is contained in:
@@ -322,6 +322,34 @@ private class fflib_ArrayUtilsTest
|
||||
System.Assert.isNull(result.get(accountIdC));
|
||||
}
|
||||
|
||||
@IsTest
|
||||
static void itShouldReplaceValueInTheMap_boolean()
|
||||
{
|
||||
Id accountIdA = fflib_IDGenerator.generate(Schema.Account.SObjectType);
|
||||
Id accountIdB = fflib_IDGenerator.generate(Schema.Account.SObjectType);
|
||||
Id accountIdC = fflib_IDGenerator.generate(Schema.Account.SObjectType);
|
||||
Id contactIdA = fflib_IDGenerator.generate(Schema.Contact.SObjectType);
|
||||
Id contactIdB = fflib_IDGenerator.generate(Schema.Contact.SObjectType);
|
||||
Map<Id, Id> source = new Map<Id, Id>
|
||||
{
|
||||
accountIdA => contactIdA,
|
||||
accountIdB => contactIdB,
|
||||
accountIdC => fflib_IDGenerator.generate(Schema.Contact.SObjectType)
|
||||
};
|
||||
Map<Id, Boolean> replacement = new Map<Id, Boolean>
|
||||
{
|
||||
contactIdA => true,
|
||||
contactIdB => false
|
||||
};
|
||||
|
||||
Map<Id, Boolean> result = fflib_ArrayUtils.replaceValue(source, replacement);
|
||||
|
||||
System.Assert.areEqual(3, result.size());
|
||||
System.Assert.isTrue(result.get(accountIdA));
|
||||
System.Assert.isFalse(result.get(accountIdB));
|
||||
System.Assert.isNull(result.get(accountIdC));
|
||||
}
|
||||
|
||||
@IsTest
|
||||
static void itShouldReturnAllValuesForTheGivenIds()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user