-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
63 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
48 changes: 48 additions & 0 deletions
48
force-app/main/default/classes/test/classes/function/MatchFieldsTest.cls
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
@IsTest | ||
private class MatchFieldsTest { | ||
@IsTest | ||
static void containsDecimal() { | ||
System.Assert.isTrue(new MatchFields().field(Opportunity.Amount).isIn(new Set<Decimal>{10.0}).call(new Opportunity(Amount = 10.0))); | ||
} | ||
|
||
@IsTest | ||
static void containsDouble() { | ||
System.Assert.isTrue(new MatchFields().field(Opportunity.Amount).isIn(new Set<Double>{10.0}).call(new Opportunity(Amount = 10.0))); | ||
} | ||
|
||
@IsTest | ||
static void containsInteger() { | ||
System.Assert.isTrue(new MatchFields().field(Account.NumberOfEmployees).isIn(new Set<Integer>{10}).call(new Account(NumberOfEmployees = 10))); | ||
} | ||
|
||
@IsTest | ||
static void containsBoolean() { | ||
System.Assert.isTrue(new MatchFields().field(Contact.DoNotCall).isIn(new Set<Boolean>{false}).call(new Contact(DoNotCall = false))); | ||
System.Assert.isFalse(new MatchFields().field(Contact.DoNotCall).isIn(new Set<Boolean>{true}).call(new Contact(DoNotCall = false))); | ||
} | ||
|
||
@IsTest | ||
static void containsDate() { | ||
Date today = Date.today(); | ||
System.Assert.isTrue(new MatchFields().field(Event.ActivityDate).isIn(new Set<Date>{today}).call(new Event(ActivityDate = today))); | ||
} | ||
|
||
@IsTest | ||
static void containsDatetime() { | ||
Datetime now = Datetime.now(); | ||
System.Assert.isTrue(new MatchFields().field(Event.ActivityDateTime).isIn(new Set<Datetime>{now}).call(new Event(ActivityDateTime = now))); | ||
} | ||
|
||
@IsTest | ||
static void containsId() { | ||
Id oppId = TestUtility.getFakeId(Opportunity.SObjectType); | ||
System.Assert.isTrue(new MatchFields().field(Opportunity.Id).isIn(new Set<Id>{oppId}).call(new Opportunity(Id = oppId))); | ||
System.Assert.isFalse(new MatchFields().field(Opportunity.Id).isIn(new Set<Id>{oppId}).call(new Opportunity(Id = TestUtility.getFakeId(Opportunity.SObjectType)))); | ||
} | ||
|
||
@IsTest | ||
static void containsString() { | ||
System.Assert.isTrue(new MatchFields().field(Opportunity.Name).isIn(new Set<String>{'foo'}).call(new Opportunity(Name = 'foo'))); | ||
System.Assert.isFalse(new MatchFields().field(Opportunity.Name).isIn(new Set<String>{'foo'}).call(new Opportunity(Name = 'bar'))); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
force-app/main/default/classes/test/classes/function/MatchFieldsTest.cls-meta.xml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>61.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
This file contains 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