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 2022/05/05 20:40:01 UTC

[GitHub] [flink] snuyanzin commented on a diff in pull request #19538: [FLINK-27323][flink-table-api-java][tests] Migrate tests to JUnit5

snuyanzin commented on code in PR #19538:
URL: https://github.com/apache/flink/pull/19538#discussion_r866296097


##########
flink-table/flink-table-api-java/src/test/java/org/apache/flink/table/typeutils/FieldInfoUtilsTest.java:
##########
@@ -25,55 +25,63 @@
 import org.apache.flink.api.java.typeutils.RowTypeInfo;
 import org.apache.flink.table.expressions.Expression;
 
-import org.junit.Test;
-import org.junit.experimental.runners.Enclosed;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.Nested;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
 
 import java.sql.Timestamp;
 import java.util.Arrays;
-import java.util.Collection;
+import java.util.stream.Stream;
 
 import static org.apache.flink.table.api.Expressions.$;
 import static org.assertj.core.api.Assertions.assertThat;
 
 /** Test suite for {@link FieldInfoUtils}. */
-@RunWith(Enclosed.class)
-public class FieldInfoUtilsTest {
+class FieldInfoUtilsTest {
 
     /** Test for ByNameMode. */
-    @RunWith(Parameterized.class)
-    public static final class TestByNameMode {
-
-        @Parameterized.Parameters(name = "{0}")
-        public static Collection<TypeInformation> parameters() throws Exception {
-            return Arrays.asList(
-                    new RowTypeInfo(
-                            new TypeInformation[] {Types.INT, Types.LONG, Types.SQL_TIMESTAMP},
-                            new String[] {"f0", "f1", "f2"}),
-                    new PojoTypeInfo(
-                            MyPojo.class,
-                            Arrays.asList(
-                                    new PojoField(MyPojo.class.getDeclaredField("f0"), Types.INT),
-                                    new PojoField(MyPojo.class.getDeclaredField("f1"), Types.LONG),
-                                    new PojoField(
-                                            MyPojo.class.getDeclaredField("f2"),
-                                            Types.SQL_TIMESTAMP))));
+    @Nested
+    @TestInstance(TestInstance.Lifecycle.PER_CLASS)
+    class TestByNameMode {
+
+        Stream<Arguments> parameters() throws Exception {

Review Comment:
   yes, you're right



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

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org