You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
In the fflib_SObjects class, all these methods:
getStringFieldValues
getRecordsWithBlankFieldValues
getRecordsWithAllBlankFieldValues
getRecordsWithNotBlankFieldValues
getRecordsWithAllNotBlankFieldValues
are type casting SObjectFields to String. This is fine for all the field types that can be casted to String. However, type casting the number types to a String as all the above methods are doing: (String) record.get(field) throws errors like Invalid conversion from runtime type Integer to String, or Invalid conversion from runtime type Decimal to String
To Reproduce
Modify the generateDomain method from the fflib_SObjectsTest class to include in the Accounts the NumberOfEmployees field with a random Integer value and then run the entire test class. The tests for all the above methods will now fail.
Steps to reproduce the behavior:
Create a regular scratch org
Deploy ApexMocks and apex-common to it
Modify the fflib_SObjectsTest.cls to include the NumberOfEmployees field with an interger value to one or more of the new Accounts and deploy the changes
Run the entire test class
Notice error: System.TypeException: Invalid conversion from runtime type Integer to String
Expected behavior
When the above methods are called for any field no matter its type, they correctly return the promised values or records.
Screenshots and text of error observed
Example of modified generateDomain method:
and the error for one of the existing tests (more are needed to be added to show the extent of the failures)
fflib_SObjectsTest.itShouldReturnRecordsWithAllFieldValues fflib_Objects Fail 14% System.TypeException: Invalid conversion from runtime type Integer to String
Class.fflib_SObjects.getRecordsWithAllNotBlankFieldValues: line 340, column 1
Class.fflib_SObjectsTest.DomainAccounts.selectPopulatedRecords: line 343, column 1
Class.fflib_SObjectsTest.itShouldReturnRecordsWithAllFieldValues: line 141, column 1 8
Version
Did you try to reproduce the problem against the latest fflib-apex-common code?
Yes,
The text was updated successfully, but these errors were encountered:
Describe the bug
In the
fflib_SObjects
class, all these methods:are type casting SObjectFields to String. This is fine for all the field types that can be casted to String. However, type casting the number types to a String as all the above methods are doing:
(String) record.get(field)
throws errors likeInvalid conversion from runtime type Integer to String
, orInvalid conversion from runtime type Decimal to String
To Reproduce
Modify the
generateDomain
method from thefflib_SObjectsTest
class to include in the Accounts theNumberOfEmployees
field with a random Integer value and then run the entire test class. The tests for all the above methods will now fail.Steps to reproduce the behavior:
fflib_SObjectsTest.cls
to include theNumberOfEmployees
field with an interger value to one or more of the new Accounts and deploy the changesSystem.TypeException: Invalid conversion from runtime type Integer to String
Expected behavior
When the above methods are called for any field no matter its type, they correctly return the promised values or records.
Screenshots and text of error observed
Example of modified
generateDomain
method:and the error for one of the existing tests (more are needed to be added to show the extent of the failures)
fflib_SObjectsTest.itShouldReturnRecordsWithAllFieldValues fflib_Objects Fail 14% System.TypeException: Invalid conversion from runtime type Integer to String Class.fflib_SObjects.getRecordsWithAllNotBlankFieldValues: line 340, column 1 Class.fflib_SObjectsTest.DomainAccounts.selectPopulatedRecords: line 343, column 1 Class.fflib_SObjectsTest.itShouldReturnRecordsWithAllFieldValues: line 141, column 1 8
Version
Did you try to reproduce the problem against the latest fflib-apex-common code?
Yes,
The text was updated successfully, but these errors were encountered: