azagrebin commented on a change in pull request #7822: [FLINK-11726][network] 
Refactor the creation of ResultPartition and InputGate into NetworkEnvironment
URL: https://github.com/apache/flink/pull/7822#discussion_r278618535
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskTest.java
 ##########
 @@ -940,9 +943,7 @@ private void setState(Task task, ExecutionState state) {
                        consumableNotifier = new 
NoOpResultPartitionConsumableNotifier();
                        partitionProducerStateChecker = 
mock(PartitionProducerStateChecker.class);
 
-                       final ResultPartitionManager partitionManager = 
mock(ResultPartitionManager.class);
-                       networkEnvironment = mock(NetworkEnvironment.class);
-                       
when(networkEnvironment.getResultPartitionManager()).thenReturn(partitionManager);
+                       network = networkEnvironment;
 
 Review comment:
   I would rather make this `{ .. }` initialiser a proper `TaskBuilder` 
constructor and pass `networkEnvironment` to it to avoid implicit things going 
on. Also, `TaskBuilder` class can be static. You could also add:
   ```
   private TaskBuilder newTaskBuilder() {
     return new TaskBuilder(networkEnvironment); // later also other 
pre-created components
   }
   ```

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to