Github user mxm commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2618#discussion_r84284953
  
    --- Diff: 
flink-tests/src/test/java/org/apache/flink/test/checkpointing/RichFileInputSplitTest.java
 ---
    @@ -0,0 +1,106 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.flink.test.checkpointing;
    +
    +import org.apache.flink.core.fs.FileInputSplit;
    +import org.apache.flink.core.fs.Path;
    +import org.apache.flink.streaming.api.functions.source.RichFileInputSplit;
    +import org.junit.Assert;
    +import org.junit.Test;
    +
    +public class RichFileInputSplitTest {
    +
    +   @Test
    +   public void testSplitEquality() {
    +
    +           RichFileInputSplit eos1 = RichFileInputSplit.EOS;
    +           RichFileInputSplit eos2 = RichFileInputSplit.EOS;
    +
    +           Assert.assertEquals(eos1, eos2);
    +
    +           FileInputSplit firstSplit = new FileInputSplit(2, new 
Path("test"), 0, 100, null);
    +           RichFileInputSplit richFirstSplit = new RichFileInputSplit(10, 
firstSplit);
    +           Assert.assertNotEquals(eos1, richFirstSplit);
    +           Assert.assertNotEquals(richFirstSplit, firstSplit);
    +
    +           FileInputSplit secondSplit = new FileInputSplit(2, new 
Path("test"), 0, 100, null);
    +           RichFileInputSplit richSecondSplit = new RichFileInputSplit(10, 
secondSplit);
    +           Assert.assertEquals(richFirstSplit, richSecondSplit);
    +           Assert.assertNotEquals(richFirstSplit, firstSplit);
    +
    +           FileInputSplit modSecondSplit = new FileInputSplit(2, new 
Path("test"), 0, 100, null);
    +           RichFileInputSplit richModSecondSplit = new 
RichFileInputSplit(11, modSecondSplit);
    +           Assert.assertNotEquals(richSecondSplit, richModSecondSplit);
    +
    +           FileInputSplit thirdSplit = new FileInputSplit(2, new 
Path("test/test1"), 0, 100, null);
    +           RichFileInputSplit richThirdSplit = new RichFileInputSplit(10, 
thirdSplit);
    +           Assert.assertEquals(richThirdSplit.getModificationTime(), 10);
    +           Assert.assertNotEquals(richFirstSplit, richThirdSplit);
    +
    +           FileInputSplit thirdSplitCopy = new FileInputSplit(2, new 
Path("test/test1"), 0, 100, null);
    +           RichFileInputSplit richThirdSplitCopy = new 
RichFileInputSplit(10, thirdSplitCopy);
    +           Assert.assertEquals(richThirdSplitCopy, richThirdSplit);
    +   }
    +
    +   @Test
    +   public void testSplitComparison() {
    +           FileInputSplit firstSplit = new FileInputSplit(3, new 
Path("test/test1"), 0, 100, null);
    +           RichFileInputSplit richFirstSplit = new RichFileInputSplit(10, 
firstSplit);
    +
    +           FileInputSplit secondSplit = new FileInputSplit(2, new 
Path("test/test2"), 0, 100, null);
    +           RichFileInputSplit richSecondSplit = new RichFileInputSplit(10, 
secondSplit);
    +
    +           FileInputSplit thirdSplit = new FileInputSplit(1, new 
Path("test/test2"), 0, 100, null);
    +           RichFileInputSplit richThirdSplit = new RichFileInputSplit(10, 
thirdSplit);
    +
    +           FileInputSplit forthSplit = new FileInputSplit(0, new 
Path("test/test3"), 0, 100, null);
    +           RichFileInputSplit richForthSplit = new RichFileInputSplit(11, 
forthSplit);
    +
    +           // lexicographically on the path order
    +           Assert.assertTrue(richFirstSplit.compareTo(richSecondSplit) < 
0);
    +           Assert.assertTrue(richFirstSplit.compareTo(richThirdSplit) < 0);
    +
    +           // same mod time, same file so smaller split number first
    +           Assert.assertTrue(richThirdSplit.compareTo(richSecondSplit) < 
0);
    +
    +           // smaller modification time first
    +           Assert.assertTrue(richThirdSplit.compareTo(richForthSplit) < 0);
    +   }
    +
    +   @Test
    +   public void testIllegalArgument() {
    +           try {
    +                   FileInputSplit firstSplit = new FileInputSplit(2, new 
Path("test"), 0, 100, null);
    +                   new RichFileInputSplit(-10, firstSplit); // invalid 
modification time
    +           } catch (Throwable e) {
    --- End diff --
    
    Should be 
    
    ```java
    } catch (IllegalArgumentException) {
    ```
    
    without the loop following.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to