-
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.
Move RecordTransform functionality to CopyFields to make purpose more…
… explicit
- Loading branch information
Showing
8 changed files
with
20 additions
and
26 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
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
10 changes: 7 additions & 3 deletions
10
src/classes/RecordTransform.cls → src/classes/CopyFields.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
2 changes: 1 addition & 1 deletion
2
src/classes/Transform.cls-meta.xml → src/classes/CopyFields.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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>44.0</apiVersion> | ||
<apiVersion>45.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
10 changes: 5 additions & 5 deletions
10
src/classes/RecordTransformTest.cls → src/classes/CopyFieldsTest.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 |
---|---|---|
@@ -1,19 +1,19 @@ | ||
@IsTest | ||
public class RecordTransformTest { | ||
public class CopyFieldsTest { | ||
@IsTest | ||
public static void definedFieldsAreUsed() { | ||
Opportunity opp = new Opportunity(); | ||
RecordTransform t = Transform.record(new Opportunity(Amount = 1000, Name = 'Test')); | ||
t.apply(opp); | ||
CopyFields c = CopyFields.fromRecord(new Opportunity(Amount = 1000, Name = 'Test')); | ||
c.apply(opp); | ||
System.assertEquals(1000, opp.Amount); | ||
System.assertEquals('Test', opp.Name); | ||
} | ||
|
||
@IsTest | ||
public static void fieldsAreOverwritten() { | ||
Opportunity opp = new Opportunity(Amount = 1000); | ||
RecordTransform t = Transform.record(new Opportunity(Amount = 2000)); | ||
t.apply(opp); | ||
CopyFields c = CopyFields.fromRecord(new Opportunity(Amount = 2000)); | ||
c.apply(opp); | ||
System.assertEquals(2000, opp.Amount); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/classes/RecordTransform.cls-meta.xml → src/classes/CopyFieldsTest.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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>44.0</apiVersion> | ||
<apiVersion>45.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.