As we saw earlier, the supporting library, or Apex Enterprise Patterns, provides methods that provide a dependency injection facility through the factories in the Application class. This facility is also compatible with the use of ApexMocks and the Apex Stub API. The following sections contain examples of the use of ApexMocks to unit test the layers within the application architecture introduced in earlier chapters.
ApexMocks and Apex Enterprise Patterns
Unit testing a controller method
The following test can be found in the RaceControllerTest class and demonstrates how to mock a service layer class:
@IsTest private static void whenAwardPointsCalledIdPassedToService() { fflib_ApexMocks mocks = new fflib_ApexMocks...