You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by zh...@apache.org on 2022/06/20 08:07:01 UTC

[flink] branch master updated (210c6275c08 -> 44b941557e1)

This is an automated email from the ASF dual-hosted git repository.

zhuzh pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


    from 210c6275c08 [FLINK-27159][table] Support firstValue/lastValue in the Table API
     new 99bbca16649 [hotfix] Rework GlobFilePathFilterTest to be based on AssertJ & JUnit5
     new 44b941557e1 [FLINK-28105][Tests] test the copied object in GlobFilePathFilterTest#testGlobFilterSerializable

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../api/common/io/GlobFilePathFilterTest.java      | 88 ++++++++++++----------
 1 file changed, 47 insertions(+), 41 deletions(-)


[flink] 01/02: [hotfix] Rework GlobFilePathFilterTest to be based on AssertJ & JUnit5

Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zhuzh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 99bbca16649cdd60fe0932563d3af61170d1c793
Author: zhouli <zh...@foxmail.com>
AuthorDate: Mon Jun 20 09:43:23 2022 +0800

    [hotfix] Rework GlobFilePathFilterTest to be based on AssertJ & JUnit5
---
 .../api/common/io/GlobFilePathFilterTest.java      | 88 ++++++++++++----------
 1 file changed, 47 insertions(+), 41 deletions(-)

diff --git a/flink-core/src/test/java/org/apache/flink/api/common/io/GlobFilePathFilterTest.java b/flink-core/src/test/java/org/apache/flink/api/common/io/GlobFilePathFilterTest.java
index 08437c28d7a..ee2491da64c 100644
--- a/flink-core/src/test/java/org/apache/flink/api/common/io/GlobFilePathFilterTest.java
+++ b/flink-core/src/test/java/org/apache/flink/api/common/io/GlobFilePathFilterTest.java
@@ -21,20 +21,20 @@ import org.apache.flink.core.fs.Path;
 import org.apache.flink.core.testutils.CommonTestUtils;
 import org.apache.flink.util.OperatingSystem;
 
-import org.junit.Assume;
-import org.junit.Test;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.Test;
 
 import java.io.IOException;
 import java.util.Collections;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assumptions.assumeThat;
 
 public class GlobFilePathFilterTest {
     @Test
     public void testDefaultConstructorCreateMatchAllFilter() {
         GlobFilePathFilter matcher = new GlobFilePathFilter();
-        assertFalse(matcher.filterPath(new Path("dir/file.txt")));
+        assertThat(matcher.filterPath(new Path("dir/file.txt"))).isFalse();
     }
 
     @Test
@@ -43,7 +43,7 @@ public class GlobFilePathFilterTest {
                 new GlobFilePathFilter(
                         Collections.<String>emptyList(), Collections.<String>emptyList());
 
-        assertFalse(matcher.filterPath(new Path("dir/file.txt")));
+        assertThat(matcher.filterPath(new Path("dir/file.txt"))).isFalse();
     }
 
     @Test
@@ -52,8 +52,8 @@ public class GlobFilePathFilterTest {
                 new GlobFilePathFilter(
                         Collections.singletonList("dir/*"), Collections.<String>emptyList());
 
-        assertFalse(matcher.filterPath(new Path("dir/file.txt")));
-        assertTrue(matcher.filterPath(new Path("dir1/file.txt")));
+        assertThat(matcher.filterPath(new Path("dir/file.txt"))).isFalse();
+        assertThat(matcher.filterPath(new Path("dir1/file.txt"))).isTrue();
     }
 
     @Test
@@ -63,7 +63,7 @@ public class GlobFilePathFilterTest {
                         Collections.singletonList("dir/*"),
                         Collections.singletonList("dir/file.txt"));
 
-        assertTrue(matcher.filterPath(new Path("dir/file.txt")));
+        assertThat(matcher.filterPath(new Path("dir/file.txt"))).isTrue();
     }
 
     @Test
@@ -72,8 +72,8 @@ public class GlobFilePathFilterTest {
                 new GlobFilePathFilter(
                         Collections.singletonList("dir/?.txt"), Collections.<String>emptyList());
 
-        assertFalse(matcher.filterPath(new Path("dir/a.txt")));
-        assertTrue(matcher.filterPath(new Path("dir/aa.txt")));
+        assertThat(matcher.filterPath(new Path("dir/a.txt"))).isFalse();
+        assertThat(matcher.filterPath(new Path("dir/aa.txt"))).isTrue();
     }
 
     @Test
@@ -83,10 +83,10 @@ public class GlobFilePathFilterTest {
                         Collections.singletonList("dir/[acd].txt"),
                         Collections.<String>emptyList());
 
-        assertFalse(matcher.filterPath(new Path("dir/a.txt")));
-        assertFalse(matcher.filterPath(new Path("dir/c.txt")));
-        assertFalse(matcher.filterPath(new Path("dir/d.txt")));
-        assertTrue(matcher.filterPath(new Path("dir/z.txt")));
+        assertThat(matcher.filterPath(new Path("dir/a.txt"))).isFalse();
+        assertThat(matcher.filterPath(new Path("dir/c.txt"))).isFalse();
+        assertThat(matcher.filterPath(new Path("dir/d.txt"))).isFalse();
+        assertThat(matcher.filterPath(new Path("dir/z.txt"))).isTrue();
     }
 
     @Test
@@ -96,11 +96,11 @@ public class GlobFilePathFilterTest {
                         Collections.singletonList("dir/[a-d].txt"),
                         Collections.<String>emptyList());
 
-        assertFalse(matcher.filterPath(new Path("dir/a.txt")));
-        assertFalse(matcher.filterPath(new Path("dir/b.txt")));
-        assertFalse(matcher.filterPath(new Path("dir/c.txt")));
-        assertFalse(matcher.filterPath(new Path("dir/d.txt")));
-        assertTrue(matcher.filterPath(new Path("dir/z.txt")));
+        assertThat(matcher.filterPath(new Path("dir/a.txt"))).isFalse();
+        assertThat(matcher.filterPath(new Path("dir/b.txt"))).isFalse();
+        assertThat(matcher.filterPath(new Path("dir/c.txt"))).isFalse();
+        assertThat(matcher.filterPath(new Path("dir/d.txt"))).isFalse();
+        assertThat(matcher.filterPath(new Path("dir/z.txt"))).isTrue();
     }
 
     @Test
@@ -110,23 +110,24 @@ public class GlobFilePathFilterTest {
                         Collections.singletonList("**"),
                         Collections.singletonList("/dir/file2.txt"));
 
-        assertFalse(matcher.filterPath(new Path("hdfs:///dir/file1.txt")));
-        assertTrue(matcher.filterPath(new Path("hdfs:///dir/file2.txt")));
-        assertFalse(matcher.filterPath(new Path("hdfs:///dir/file3.txt")));
+        assertThat(matcher.filterPath(new Path("hdfs:///dir/file1.txt"))).isFalse();
+        assertThat(matcher.filterPath(new Path("hdfs:///dir/file2.txt"))).isTrue();
+        assertThat(matcher.filterPath(new Path("hdfs:///dir/file3.txt"))).isFalse();
     }
 
     @Test
     public void testExcludeFilenameWithStart() {
-        Assume.assumeTrue(
-                "Windows does not allow asterisks in file names.", !OperatingSystem.isWindows());
+        assumeThat(OperatingSystem.isWindows())
+                .as("Windows does not allow asterisks in file names.")
+                .isFalse();
 
         GlobFilePathFilter matcher =
                 new GlobFilePathFilter(
                         Collections.singletonList("**"), Collections.singletonList("\\*"));
 
-        assertTrue(matcher.filterPath(new Path("*")));
-        assertFalse(matcher.filterPath(new Path("**")));
-        assertFalse(matcher.filterPath(new Path("other.txt")));
+        assertThat(matcher.filterPath(new Path("*"))).isTrue();
+        assertThat(matcher.filterPath(new Path("**"))).isFalse();
+        assertThat(matcher.filterPath(new Path("other.txt"))).isFalse();
     }
 
     @Test
@@ -135,9 +136,9 @@ public class GlobFilePathFilterTest {
                 new GlobFilePathFilter(
                         Collections.singletonList("*"), Collections.<String>emptyList());
 
-        assertFalse(matcher.filterPath(new Path("a")));
-        assertTrue(matcher.filterPath(new Path("a/b")));
-        assertTrue(matcher.filterPath(new Path("a/b/c")));
+        assertThat(matcher.filterPath(new Path("a"))).isFalse();
+        assertThat(matcher.filterPath(new Path("a/b"))).isTrue();
+        assertThat(matcher.filterPath(new Path("a/b/c"))).isTrue();
     }
 
     @Test
@@ -146,19 +147,23 @@ public class GlobFilePathFilterTest {
                 new GlobFilePathFilter(
                         Collections.singletonList("**"), Collections.<String>emptyList());
 
-        assertFalse(matcher.filterPath(new Path("a")));
-        assertFalse(matcher.filterPath(new Path("a/b")));
-        assertFalse(matcher.filterPath(new Path("a/b/c")));
+        assertThat(matcher.filterPath(new Path("a"))).isFalse();
+        assertThat(matcher.filterPath(new Path("a/b"))).isFalse();
+        assertThat(matcher.filterPath(new Path("a/b/c"))).isFalse();
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testIncluePatternIsNull() {
-        new GlobFilePathFilter(null, Collections.<String>emptyList());
+        Assertions.assertThatThrownBy(
+                        () -> new GlobFilePathFilter(null, Collections.<String>emptyList()))
+                .isInstanceOf(NullPointerException.class);
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testExcludePatternIsNull() {
-        new GlobFilePathFilter(Collections.singletonList("**"), null);
+        Assertions.assertThatThrownBy(
+                        () -> new GlobFilePathFilter(Collections.singletonList("**"), null))
+                .isInstanceOf(NullPointerException.class);
     }
 
     @Test
@@ -168,8 +173,9 @@ public class GlobFilePathFilterTest {
                         Collections.singletonList("**"), Collections.<String>emptyList());
 
         GlobFilePathFilter matcherCopy = CommonTestUtils.createCopySerializable(matcher);
-        assertFalse(matcher.filterPath(new Path("a")));
-        assertFalse(matcher.filterPath(new Path("a/b")));
-        assertFalse(matcher.filterPath(new Path("a/b/c")));
+
+        assertThat(matcher.filterPath(new Path("a"))).isFalse();
+        assertThat(matcher.filterPath(new Path("a/b"))).isFalse();
+        assertThat(matcher.filterPath(new Path("a/b/c"))).isFalse();
     }
 }


[flink] 02/02: [FLINK-28105][Tests] test the copied object in GlobFilePathFilterTest#testGlobFilterSerializable

Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zhuzh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 44b941557e131ea03486ba5324232fe7b421a6c4
Author: zhouli <zh...@foxmail.com>
AuthorDate: Mon Jun 20 09:44:04 2022 +0800

    [FLINK-28105][Tests] test the copied object in GlobFilePathFilterTest#testGlobFilterSerializable
---
 .../java/org/apache/flink/api/common/io/GlobFilePathFilterTest.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/flink-core/src/test/java/org/apache/flink/api/common/io/GlobFilePathFilterTest.java b/flink-core/src/test/java/org/apache/flink/api/common/io/GlobFilePathFilterTest.java
index ee2491da64c..d9ecb595cf4 100644
--- a/flink-core/src/test/java/org/apache/flink/api/common/io/GlobFilePathFilterTest.java
+++ b/flink-core/src/test/java/org/apache/flink/api/common/io/GlobFilePathFilterTest.java
@@ -174,8 +174,8 @@ public class GlobFilePathFilterTest {
 
         GlobFilePathFilter matcherCopy = CommonTestUtils.createCopySerializable(matcher);
 
-        assertThat(matcher.filterPath(new Path("a"))).isFalse();
-        assertThat(matcher.filterPath(new Path("a/b"))).isFalse();
-        assertThat(matcher.filterPath(new Path("a/b/c"))).isFalse();
+        assertThat(matcherCopy.filterPath(new Path("a"))).isFalse();
+        assertThat(matcherCopy.filterPath(new Path("a/b"))).isFalse();
+        assertThat(matcherCopy.filterPath(new Path("a/b/c"))).isFalse();
     }
 }