Skip to content

Commit

Permalink
fix: don't add custom key if it's null
Browse files Browse the repository at this point in the history
  • Loading branch information
waltjones committed Jun 5, 2020
1 parent 8da5e23 commit 42cbd4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion force-app/main/default/classes/DataBuilder.cls
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ public with sharing class DataBuilder {
structure.put('environment', environment);
structure.put('framework', 'apex');
structure.put('body', body);
structure.put('custom', custom);

if (custom != null) {
structure.put('custom', custom);
}

return structure;
}
Expand Down
4 changes: 4 additions & 0 deletions force-app/main/default/tests/DataBuilderTest.cls
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public class DataBuilderTest

Map<String, Object> data = (Map<String, Object>)result.get('data');

System.assertEquals(data.containsKey('custom'), false);

Map<String, Object> notifierMap = (Map<String, Object>)data.get('notifier');

System.assertEquals(Notifier.NAME, (String)notifierMap.get('name'));
Expand Down Expand Up @@ -87,6 +89,8 @@ public class DataBuilderTest

Map<String, Object> data = (Map<String, Object>)result.get('data');

System.assertEquals(data.containsKey('custom'), false);

Map<String, Object> notifierMap = (Map<String, Object>)data.get('notifier');
System.assertEquals(Notifier.NAME, (String)notifierMap.get('name'));
System.assertEquals(Notifier.VERSION, (String)notifierMap.get('version'));
Expand Down

0 comments on commit 42cbd4d

Please sign in to comment.