Skip to content

Commit

Permalink
Fixed some test asserts in LogEntryFieldSetPicklist_Tests that failed…
Browse files Browse the repository at this point in the history
… when running with a namespace
  • Loading branch information
jongpie committed Jan 18, 2024
1 parent 17ff6c9 commit 47e07a4
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ private class LogEntryFieldSetPicklist_Tests {
static void it_should_return_non_null_for_default_value_when_valid_value_is_configured() {
String validFieldSetName = 'Related_List_Defaults';
Schema.FieldSet expectedFieldSet = Schema.SObjectType.LogEntry__c.fieldSets.getMap().get(validFieldSetName);
String expectedFieldSetNamespacePrefix = String.isBlank(expectedFieldSet.getNameSpace()) ? '' : expectedFieldSet.getNameSpace() + '__';
String qualifiedValidFieldSetName = expectedFieldSetNamespacePrefix + expectedFieldSet.getName();
System.Assert.isNotNull(expectedFieldSet);
LoggerParameter__mdt mockParameter = new LoggerParameter__mdt(DeveloperName = 'DefaultLogEntryRelatedListFieldSet', Value__c = validFieldSetName);
LoggerParameter__mdt mockParameter = new LoggerParameter__mdt(
DeveloperName = 'DefaultLogEntryRelatedListFieldSet',
Value__c = qualifiedValidFieldSetName
);
LoggerParameter.setMock(mockParameter);

LogEntryFieldSetPicklist instance = new LogEntryFieldSetPicklist();
Expand All @@ -56,12 +61,13 @@ private class LogEntryFieldSetPicklist_Tests {
List<VisualEditor.DataRow> dataRows = instance.getValues().getDataRows();
System.Assert.areEqual(expectedFieldSets.size(), dataRows.size());
for (VisualEditor.DataRow dataRow : dataRows) {
String fieldSetLabel = (String) dataRow.getLabel();
String fieldSetName = (String) dataRow.getValue();
System.Assert.isTrue(expectedFieldSets.containsKey(fieldSetName));
Schema.FieldSet fieldSet = expectedFieldSets.get(fieldSetName);
System.Assert.areEqual(fieldSet.getLabel(), fieldSetLabel);
System.Assert.areEqual(fieldSet.getName(), fieldSetName);
String dataRowLabel = (String) dataRow.getLabel();
String dataRowValue = (String) dataRow.getValue();
System.Assert.isTrue(expectedFieldSets.containsKey(dataRowValue));
Schema.FieldSet matchingFieldSet = expectedFieldSets.get(dataRowValue);
String matchingFieldSetNamespacePrefix = String.isBlank(matchingFieldSet.getNameSpace()) ? '' : matchingFieldSet.getNameSpace() + '__';
System.Assert.areEqual(matchingFieldSet.getLabel(), dataRowLabel);
System.Assert.areEqual(matchingFieldSetNamespacePrefix + matchingFieldSet.getName(), dataRowValue);
}
}
}

0 comments on commit 47e07a4

Please sign in to comment.