Questions tagged [fflib]
Questions relating to fflib patterns being used in the Apex classes.
89 questions
0 votes
1 answer
30 views
Where do we instantiate Unit of Work? Domain or Service layer?
I’m implementing the fflib-style Apex Enterprise Patterns in my org and I’m confused about the correct place to instantiate the Unit of Work (UoW). From what I understand: The purpose of UoW is to ...
0 votes
1 answer
33 views
Is it okay to call both domain & service layer from trigger handlers?
I’m implementing the fflib-style Apex Enterprise Patterns in my org and need some clarity on how trigger handlers should interact with the Domain and Service layers. My current understanding is: ...
0 votes
1 answer
44 views
Mocking newInstance(Set<Id>) using fflib
Following suggestions from @wimvelzeboer and replacing SOQL queries and selecting parent fields by multiple domain newInstance(Set<Id>) to optimize performance. E.g. Races races = Races....
1 vote
1 answer
99 views
fflib - How to handle before context trigger updates in domain class methods
To note: I've just implemented fflib and have thus separated TriggerHandler logic from SObject Domain classes. That is, I have (for example) two classes: AccountsTriggerHandler extends ...
0 votes
2 answers
178 views
Help with JSON Deserialization Failed on Token 'null' Error While Parsing Nested JSON
I'm trying to write a unit test that mocks child records related to a parent. I'm attempting to use the fflib_ApexMocksUtils.makeRelationship(), but I'm getting a deserialization failure. Json ...
0 votes
1 answer
99 views
ApexMocks throwing System.TypeException: Class IEmailService__sfdc_ApexStub must implement the method
When running a unit test, I get the following error: System.TypeException: Class IEmailService__sfdc_ApexStub must implement the method: void IEmailService.sendErrorToAdmins(String, Exception) (System ...
1 vote
0 answers
123 views
Design pattern using fflib (Injector/Selector)
I'm working on a project that is using the fflib package. This is my first project using fflib and so far I'm really enjoying it, because it can do a lot of things and leaves a structure ready to be ...
1 vote
2 answers
151 views
fflib Unit of Work Mocking with registerNew More Than Once with a Single Record
Having some issues mocking the below scenario. Let's say we are registering inserts for two objects and then relating them I'm unable to get the verifier to pass. I can only verify one record using ...
0 votes
2 answers
529 views
Accessing relationship fields in fflib
We are trying to develop our code using fflib. Can we access relationship fields directly in the child domain class or do we need to use the parent object domain to access the field values and sent it ...
0 votes
0 answers
127 views
Accessing relationship fields for setting and filtering using fflib
We are starting to use fflib in our projects. We generally run into disagreements on how we access relationship fields and as well copy values from related fields and set a object field. To set a ...
1 vote
2 answers
524 views
How to mock when calling a factory class
Using below as a dummy example I can mock the service I'm calling, but I think there should be a better way other than I'm doing it when calling a factory class. Any suggestions? Thanks in advance. ...
2 votes
2 answers
400 views
fflib: selector Method query giving me error of Duplicate field selected
I have created following method in my Opportunity selector class. I am passing my query fields dynamically from another class. public List<Opportunity> selectByDynamicFilter(List<String&...
1 vote
2 answers
383 views
Unit testing generating and sending emails with fflib-Apexmocks
I am currently struggling to write a unit test for a method in my domain class, and I'm finding it challenging to understand the logic, especially since I'm new to using the fflib-Apexmocks library. I ...
0 votes
1 answer
928 views
Mocking a Batch class?
Is there any way to mock a batch class for unit testing and predefine the scope passed to execute method? I am using a selector class method for Database.getQueryLocator at start method. public class ...
0 votes
1 answer
342 views
SObject type offer__c is not supported by this unit of work
In the project, we use fflib as the Apex enterprise framework. Executing this code: uow.registerDirty(offers); uow.commitWork(); I get this error: The object type offer__c is not supported by this ...