pnowojski commented on a change in pull request #7031: 
[FLINK-10800][network][test] Abstract StreamPartitionerTest for common codes
URL: https://github.com/apache/flink/pull/7031#discussion_r231042037
 
 

 ##########
 File path: 
flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/partitioner/ShufflePartitionerTest.java
 ##########
 @@ -30,35 +26,23 @@
 /**
  * Tests for {@link ShufflePartitioner}.
  */
-public class ShufflePartitionerTest {
-
-       private ShufflePartitioner<Tuple> shufflePartitioner;
-       private StreamRecord<Tuple> streamRecord = new 
StreamRecord<Tuple>(null);
-       private SerializationDelegate<StreamRecord<Tuple>> sd = new 
SerializationDelegate<StreamRecord<Tuple>>(
-                       null);
+public class ShufflePartitionerTest extends StreamPartitionerTest {
 
        @Before
        public void setPartitioner() {
-               shufflePartitioner = new ShufflePartitioner<Tuple>();
-       }
-
-       @Test
-       public void testSelectChannelsLength() {
-               sd.setInstance(streamRecord);
-               assertEquals(1, shufflePartitioner.selectChannels(sd, 
1).length);
-               assertEquals(1, shufflePartitioner.selectChannels(sd, 
2).length);
-               assertEquals(1, shufflePartitioner.selectChannels(sd, 
1024).length);
+               streamPartitioner = new ShufflePartitioner<>();
 
 Review comment:
   If you define abstract method `StreamPartitioner<Tuple> createPartitioner()` 
in `StreamParitionerTest` then if someone forgets to override it he will get a 
compilation error instead of `NullPointerException` as he would now (if he 
would forgot to declare `@Before` method).
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to