You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/01/24 07:25:26 UTC

[GitHub] pnowojski commented on a change in pull request #7570: [FLINK-11422] Prefer testing class to mock StreamTask in AbstractStre…

pnowojski commented on a change in pull request #7570: [FLINK-11422] Prefer testing class to mock StreamTask in AbstractStre…
URL: https://github.com/apache/flink/pull/7570#discussion_r250487400
 
 

 ##########
 File path: flink-streaming-java/src/test/java/org/apache/flink/streaming/util/AbstractStreamOperatorTestHarness.java
 ##########
 @@ -636,4 +597,81 @@ public void close() {
 			// ignore
 		}
 	}
+
+	private class MockStreamTask extends StreamTask {
 
 Review comment:
   Can you try to convert this class to public non inner class? This class can definitely evolve into something that's re-used across multiple tests, since this is not the only place that's using `mock(StreamTask.class)`. 
   
   I think it's easy to do with "refactor" options in Intellij:
   1. refactor -> convert to static class (to generate a constructor for passing all of the fields)
   2. refactor -> move (to move from inner class to outer level)
   
   I guess the only "problematic" thing to solve is `streamTaskStateInitializer` field, which is non final.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services