-
Notifications
You must be signed in to change notification settings - Fork 533
Simplification of setting mocks for Selectors and Domains #453
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
base: master
Are you sure you want to change the base?
Simplification of setting mocks for Selectors and Domains #453
Conversation
Sync to latest version
…ories with setMock() method which doesn't require .sObjectType() to be mocked * Feature to allow simplifying how a Selector and/or Domain are being stubbed * To prevent forgetting to mocks.when() the method .sObjectType(), causing unexpected and undesired test method results (especially for juniors) * Additionally, this aligns nicely with setMock() for Services where the Interface method is provided * New approach is 100% backward compatible with a little hint for developers as reminder to mock the sObjectType()-method * Original code to mock a Domain class: mocks.startStubbing(); mocks.when( m_domLeads.sObjectType() ).thenReturn( Lead.SObjectType ); mocks.stopStubbing(); fflib.domain.setMock( m_domLeads ); * New code: fflib.domain.setMock( Lead.SObjectType, m_domLeads );
@ImJohnMDaniel I've updated the branch to match master again, but not sure if that was the only reason why you assigned it back to me? Thanks! |
@foxysolutions -- you are all good. I routinely "assign" PRs to the person that opened it. Just waiting for reviews from other team members (who may actually be on PTO this week), so I ask for your patience. |
@afawcett @ImJohnMDaniel any review possible on this small change, to simplify how mocks are being set? It was already reviewed once, so pending for 2nd one. Cheers! |
2023-06-05: fflib_Application.cls: Extending Selector and Domain Factories with setMock() method which doesn't require .sObjectType() to be mocked
Application.domain.setMock( Lead.SObjectType, m_domLeads );
This change is