-
Notifications
You must be signed in to change notification settings - Fork 54
@W-10778096@ Minor error message fixes #770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,15 +81,7 @@ static String constructMessageInternal(FlsViolationInfo flsViolationInfo) { | |
|
|
||
| final String fieldInformation = | ||
| getFieldInformation(fieldNames, allFields, flsViolationInfo.getObjectName()); | ||
| final String validationInformation = | ||
| getValidationInformation(flsViolationInfo, violationType); | ||
|
|
||
| // Return the full validation message | ||
| return validationInformation + fieldInformation; | ||
| } | ||
|
|
||
| private static String getValidationInformation( | ||
| FlsViolationInfo flsViolationInfo, ViolationType violationType) { | ||
| // Use the template that corresponds to the instance of flsViolationInfo. | ||
| // This is necessary since individual subtypes have different message templates. | ||
| final String messageTemplate = flsViolationInfo.getMessageTemplate(); | ||
|
|
@@ -99,7 +91,10 @@ private static String getValidationInformation( | |
| messageTemplate, | ||
| violationType, | ||
| flsViolationInfo.getValidationType().name(), | ||
| flsViolationInfo.getObjectName()); | ||
| flsViolationInfo.getObjectName(), | ||
| fieldInformation); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now passing in fieldInformation as another parameter. |
||
|
|
||
| // Return the full validation message | ||
| return validationInformation; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
| import static org.hamcrest.Matchers.equalToIgnoringCase; | ||
|
|
||
| import com.salesforce.collections.CollectionUtil; | ||
| import com.salesforce.config.UserFacingMessages; | ||
| import java.util.TreeSet; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
|
|
@@ -76,7 +77,17 @@ public void testMessageWithRelationalField() { | |
| assertThat( | ||
| message, | ||
| equalToIgnoringCase( | ||
| "FLS validation is missing for [UPDATE] operation on [My_Obj__c] with field(s) [Name,Status__c] - SFGE may not have parsed some objects/fields correctly. Please confirm if the objects/fields involved in these segments have FLS checks: [Relational_Field__r.Another_field__c]")); | ||
| String.format( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Modified failing tests to use String formats instead of hardcoding the message. Will clean up the remaining tests at another iteration while applying Teresa's feedback. |
||
| UserFacingMessages.VIOLATION_MESSAGE_TEMPLATE, | ||
| "FLS", | ||
| "UPDATE", | ||
| "My_Obj__c", | ||
| String.format( | ||
| UserFacingMessages.FIELDS_MESSAGE_TEMPLATE, | ||
| "Name,Status__c")) | ||
| + String.format( | ||
| UserFacingMessages.FIELD_HANDLING_NOTICE, | ||
| "Relational_Field__r.Another_field__c"))); | ||
| } | ||
|
|
||
| @Test | ||
|
|
@@ -91,7 +102,17 @@ public void testMessageWithRelationalObject() { | |
| assertThat( | ||
| message, | ||
| equalToIgnoringCase( | ||
| "FLS validation is missing for [UPDATE] operation on [My_Relational_Obj__r] with field(s) [Name,Status__c] - SFGE may not have parsed some objects/fields correctly. Please confirm if the objects/fields involved in these segments have FLS checks: [My_Relational_Obj__r]")); | ||
| String.format( | ||
| UserFacingMessages.VIOLATION_MESSAGE_TEMPLATE, | ||
| "FLS", | ||
| "UPDATE", | ||
| "My_Relational_Obj__r", | ||
| String.format( | ||
| UserFacingMessages.FIELDS_MESSAGE_TEMPLATE, | ||
| "Name,Status__c")) | ||
| + String.format( | ||
| UserFacingMessages.FIELD_HANDLING_NOTICE, | ||
| "My_Relational_Obj__r"))); | ||
| } | ||
|
|
||
| @Test | ||
|
|
@@ -105,7 +126,16 @@ public void testMessageWithIllegibleField() { | |
| assertThat( | ||
| message, | ||
| equalToIgnoringCase( | ||
| "FLS validation is missing for [UPDATE] operation on [My_Obj__c] with field(s) [Name,Status__c] - SFGE may not have parsed some objects/fields correctly. Please confirm if the objects/fields involved in these segments have FLS checks: [{1}{2}{3}]")); | ||
| String.format( | ||
| UserFacingMessages.VIOLATION_MESSAGE_TEMPLATE, | ||
| "FLS", | ||
| "UPDATE", | ||
| "My_Obj__c", | ||
| String.format( | ||
| UserFacingMessages.FIELDS_MESSAGE_TEMPLATE, | ||
| "Name,Status__c")) | ||
| + String.format( | ||
| UserFacingMessages.FIELD_HANDLING_NOTICE, "{1}{2}{3}"))); | ||
| } | ||
|
|
||
| @Test | ||
|
|
@@ -119,7 +149,16 @@ public void testMessageWithIllegibleFieldWithAllFields() { | |
| assertThat( | ||
| message, | ||
| equalToIgnoringCase( | ||
| "FLS validation is missing for [UPDATE] operation on [My_Obj__c] with field(s) [ALL_FIELDS] - SFGE may not have parsed some objects/fields correctly. Please confirm if the objects/fields involved in these segments have FLS checks: [{1}{2}{3}]")); | ||
| String.format( | ||
| UserFacingMessages.VIOLATION_MESSAGE_TEMPLATE, | ||
| "FLS", | ||
| "UPDATE", | ||
| "My_Obj__c", | ||
| String.format( | ||
| UserFacingMessages.FIELDS_MESSAGE_TEMPLATE, | ||
| "ALL_FIELDS")) | ||
| + String.format( | ||
| UserFacingMessages.FIELD_HANDLING_NOTICE, "{1}{2}{3}"))); | ||
| } | ||
|
|
||
| @Test | ||
|
|
@@ -132,7 +171,14 @@ public void testMessageWithOnlyIllegibleFields() { | |
| assertThat( | ||
| message, | ||
| equalToIgnoringCase( | ||
| "FLS validation is missing for [UPDATE] operation on [My_Obj__c] - SFGE may not have parsed some objects/fields correctly. Please confirm if the objects/fields involved in these segments have FLS checks: [{1}{2}{3}]")); | ||
| String.format( | ||
| UserFacingMessages.VIOLATION_MESSAGE_TEMPLATE, | ||
| "FLS", | ||
| "UPDATE", | ||
| "My_Obj__c", | ||
| "") | ||
| + String.format( | ||
| UserFacingMessages.FIELD_HANDLING_NOTICE, "{1}{2}{3}"))); | ||
| } | ||
|
|
||
| @Test | ||
|
|
@@ -145,7 +191,16 @@ public void testMessageWithOnlyIllegibleFieldsWithAllFields() { | |
| assertThat( | ||
| message, | ||
| equalToIgnoringCase( | ||
| "FLS validation is missing for [UPDATE] operation on [My_Obj__c] with field(s) [ALL_FIELDS] - SFGE may not have parsed some objects/fields correctly. Please confirm if the objects/fields involved in these segments have FLS checks: [{1}{2}{3}]")); | ||
| String.format( | ||
| UserFacingMessages.VIOLATION_MESSAGE_TEMPLATE, | ||
| "FLS", | ||
| "UPDATE", | ||
| "My_Obj__c", | ||
| String.format( | ||
| UserFacingMessages.FIELDS_MESSAGE_TEMPLATE, | ||
| "ALL_FIELDS")) | ||
| + String.format( | ||
| UserFacingMessages.FIELD_HANDLING_NOTICE, "{1}{2}{3}"))); | ||
| } | ||
|
|
||
| @Test | ||
|
|
@@ -158,7 +213,15 @@ public void testMessageWithIllegibleObject() { | |
| assertThat( | ||
| message, | ||
| equalToIgnoringCase( | ||
| "FLS validation is missing for [UPDATE] operation on [{1}] with field(s) [Name,Status__c] - SFGE may not have parsed some objects/fields correctly. Please confirm if the objects/fields involved in these segments have FLS checks: [{1}]")); | ||
| String.format( | ||
| UserFacingMessages.VIOLATION_MESSAGE_TEMPLATE, | ||
| "FLS", | ||
| "UPDATE", | ||
| "{1}", | ||
| String.format( | ||
| UserFacingMessages.FIELDS_MESSAGE_TEMPLATE, | ||
| "Name,Status__c")) | ||
| + String.format(UserFacingMessages.FIELD_HANDLING_NOTICE, "{1}"))); | ||
| } | ||
|
|
||
| @Test | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jfeingold35 I've changed the format based on our conversation.