aplex commented on a change in pull request #3281:
URL: https://github.com/apache/gobblin/pull/3281#discussion_r646915386



##########
File path: 
gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/ControllerUserDefinedMessageHandlerFactory.java
##########
@@ -51,7 +51,7 @@
 class ControllerUserDefinedMessageHandlerFactory implements 
MessageHandlerFactory {
   private boolean flowCatalogLocalCommit;
   private GobblinServiceJobScheduler jobScheduler;
-  private GobblinServiceFlowConfigResourceHandler resourceHandler;
+  private FlowConfigsResourceHandler resourceHandler;

Review comment:
       Instead of injecting a specific implementation, we inject an interface. 
GobblinServiceFlowConfigResourceHandler  implements this 
FlowConfigsResourceHandler.
   
   It's generally a good practice to use interface-based dependency injection 
everywhere. That will allow us to replace implementations completely, and its 
more convenient to mock in unit tests. 
   
   For example, some of our classes inherit from Guava service class. And that 
service class has final methods. Mockito by default cannot override final 
methods, so when we try to mock such dependency, part of the calls go to the 
mocked methods, while others go to real implementation, causing complicated 
bugs. If the dependency is an interface, we can mock it fully.
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to